From owner-freebsd-hackers Sun Nov 4 8:11:21 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from kitkat.hotpop.com (kitkat.hotpop.com [204.57.55.30]) by hub.freebsd.org (Postfix) with ESMTP id C0CD137B417 for ; Sun, 4 Nov 2001 08:11:17 -0800 (PST) Received: from hotpop.com (unknown [204.57.55.31]) by kitkat.hotpop.com (Postfix) with SMTP id BD6F83062F for ; Sun, 4 Nov 2001 16:10:51 +0000 (UTC) Received: from hotpop.com (shiva-dhcp-89.dial.upmc.edu [128.147.34.89]) by zagnut.hotpop.com (Postfix) with SMTP id 3C62C50014 for ; Sun, 4 Nov 2001 16:10:51 +0000 (UTC) Date: Sun, 4 Nov 2001 11:05:59 -0500 From: Rod Person To: Hackers FreeBSD Subject: Trying to learn X programming. Message-Id: <20011104110559.4cf7d0b0.roddierod@hotpop.com> Reply-To: roddierod@hotpop.com Organization: Open Source Beef X-Mailer: Sylpheed version 0.6.3 (GTK+ 1.2.8; i386--freebsd4.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-HotPOP: ----------------------------------------------- Sent By HotPOP.com FREE Email Get your FREE POP email at www.HotPOP.com ----------------------------------------------- Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a little Linux code that changes resolution of X on the fly. There seems to be some differences in the Linux and FreeBSD use of XOpenDisplay. I read the man pages and tried changing the code a few different ways but it won't compile. Here's how I try to compile.... gcc -o wmres wmres.c -I/usr/X11R6/include -IXmu -IX11 Any pointers or a good reference on the web somewhere. All I have are man pages and code at this point. #include #include #include #include int main (int argc, char *argv[]) { Display *dpy; XF86VidModeModeInfo **vm_modelines; int vm_count; int i; int width, height; dpy=XOpenDisplay(DefaultScreen(0)); XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy),&vm_count,&vm_modelines); if(!(vm_count)) { fprintf(stderr,"error: no video modes found\n"); exit(1); } if(argc > 2) { width = atoi(argv[1]); height = atoi(argv[2]); for(i=0; i < vm_count; i++) { if(vm_modelines[i]->hdisplay==width && vm_modelines[i]->vdisplay==height) { XF86VidModeSwitchToMode(dpy,XDefaultScreen(dpy),vm_modelines[i]); XFlush(dpy); return 0; } } } printf("\"Resolutions\" MENU\n"); for(i=0; i < vm_count; i++) { printf("\"%dx%d\" EXEC %s %d %d\n",vm_modelines[i]->hdisplay,vm_modelines[i]->vdisplay, argv[0], vm_modelines[i]->hdisplay, vm_modelines[i]->vdisplay); } printf("\"Resolutions\" END\n"); return 0; } thanks Rod roddierod@hotpop.com http://storm.prohosting.com/osbeef/osbeef.htm To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message