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 <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
#include <X11/extensions/xf86vmode.h>
#include <stdio.h>
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
[EMAIL PROTECTED]
http://storm.prohosting.com/osbeef/osbeef.htm
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message