On Friday, June 27, 2003 1:21 pm, Ethan Trevino wrote:
> ///////Compiler Output//////////////////
> # gcc -o screen screen.c -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm
> screen.c: In function `changeResolution':
> screen.c:45: warning: passing arg 4 of `XF86VidModeGetModeLine' from
> incompatible pointer type

---//---
/* The documentation says that XF86VidModeModeInfo wants a double
* pointer. But the function definition says that it wants a triple
* pointer. So, we declare a double and pass the address
* XF86VidModeModeInfo **modes; */
---//---

Huh?  XF86VidModeModeInfo is a data type, not a function.  What you're 
probably thinking of is XF86VidModeGetAllModeLines, whose prototype reads:
Bool XF86VidModeGetAllModeLines(Display*, int, int*, XF86VidModeModeInfo***);
(xc/include/X11/extensions/xf86vmode.h, lines 197-202)
This is definitely different from what XF86VIDMODE(3X11) says, so yeah, there 
is a documentation bug here.  (Somebody please fix this!)

But your problem isn't with XF86VidModeGetAllModeLines.  It's with 
XF86VidModeGetModeLine.  Its fourth parameter is supposed to be an 
XF86VidModeModeLine*, but you give it an XF86VidModeModeInfo***.  That's two 
too many *'s and you use ___Info instead of ___Line.

---//---
XF86VidModeModeInfo **modes, **oldMode;
XF86VidModeGetModeLine(dpy, 0, &dotclock, &modes);
---//---

This alone should cause a SIGSEGV.  (I know that if I were the computer, I 
wouldn't settle for anything less, hehehe.)

> screen.c: In function `changeResBack':
> screen.c:70: warning: passing arg 3 of `XF86VidModeSwitchToMode' from
> incompatible pointer type
> screen.c:71: warning: passing arg 3 of `XF86VidModeSwitchToMode' from
> incompatible pointer type

---//---
XF86VidModeSwitchToMode(dpy,0,oldMode);
XF86VidModeSwitchToMode(dpy,0,oldMode);
---//---

Both xc/include/X11/extensions/xf86vmode.h and XF86VIDMODE(3X11) say that 
XF86VidModeSwitchToMode's prototype is:
"Bool XF86VidModeSwitchToMode(Display*, int, XF86VidModeModeInfo*);"

But you pass it a XF86VidModeModeInfo**, with one too many *'s.  Why is 
oldMode a ** anyway?

Good luck.  You might want to read the SwitchCB function in 
xc/programs/xvidtune/xvidtune.c .  In 4.3.0, it starts on line 930.  Also 
check out the xrandr program for a more flexible way of doing almost the same 
thing.  (Except that xrandr doesn't appear to work at all with xinerama, so 
it's currently useless to me...)

Heh, I just noticed a misspelling on line 5 of xrandr.c...

-- 
Andy Goth  |  [EMAIL PROTECTED]  |  http://ioioio.net/
End communication.

_______________________________________________
XFree86 mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xfree86

Reply via email to