src/video/x11/SDL_x11modes.c
changeset 2916 ffdd533f7add
parent 2906 c4150600b3ae
child 2920 cdb01906cb7e
--- a/src/video/x11/SDL_x11modes.c	Wed Dec 24 13:13:38 2008 +0000
+++ b/src/video/x11/SDL_x11modes.c	Thu Dec 25 04:42:28 2008 +0000
@@ -136,6 +136,8 @@
         SDL_VideoDisplay display;
         SDL_DisplayData *displaydata;
         SDL_DisplayMode mode;
+        XPixmapFormatValues *pixmapFormats;
+        int i, n;
 
         if (get_visualinfo(data->display, screen, &vinfo) < 0) {
             continue;
@@ -155,6 +157,18 @@
         displaydata->visual = vinfo.visual;
         displaydata->depth = vinfo.depth;
 
+        displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format)*8;
+        pixmapFormats = XListPixmapFormats(data->display, &n);
+        if (pixmapFormats) {
+            for (i = 0; i < n; ++i) {
+                if (pixmapFormats[i].depth == displaydata->depth) {
+                    displaydata->scanline_pad = pixmapFormats[i].scanline_pad;
+                    break;
+                }
+            }
+            XFree(pixmapFormats);
+        }
+
         SDL_zero(display);
         display.desktop_mode = mode;
         display.current_mode = mode;