diff src/video/x11/SDL_x11modes.c @ 4154:db4007f17bc8 SDL-1.2

Correct fix for Bugzilla #602.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 15 Sep 2008 20:47:55 +0000
parents 0e44c6f90b95
children a1b03ba2fcd0
line wrap: on
line diff
--- a/src/video/x11/SDL_x11modes.c	Mon Sep 15 05:08:53 2008 +0000
+++ b/src/video/x11/SDL_x11modes.c	Mon Sep 15 20:47:55 2008 +0000
@@ -52,8 +52,25 @@
 #if SDL_VIDEO_DRIVER_X11_VIDMODE
 Bool SDL_NAME(XF86VidModeGetModeInfo)(Display *dpy, int scr, SDL_NAME(XF86VidModeModeInfo) *info)
 {
-    SDL_NAME(XF86VidModeModeLine) *l = (SDL_NAME(XF86VidModeModeLine)*)((char*)info + sizeof info->dotclock);
-    return SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, (int*)&info->dotclock, l);
+    Bool retval;
+    int dotclock;
+    SDL_NAME(XF86VidModeModeLine) l;
+    SDL_memset(&l, 0, sizeof(l));
+    retval = SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, &dotclock, &l);
+    info->dotclock = dotclock;
+    info->hdisplay = l.hdisplay;
+    info->hsyncstart = l.hsyncstart;
+    info->hsyncend = l.hsyncend;
+    info->htotal = l.htotal;
+    info->hskew = l.hskew;
+    info->vdisplay = l.vdisplay;
+    info->vsyncstart = l.vsyncstart;
+    info->vsyncend = l.vsyncend;
+    info->vtotal = l.vtotal;
+    info->flags = l.flags;
+    info->privsize = l.privsize;
+    info->private = l.private;
+    return retval;
 }
 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */