Package: koules Version: 1.4-16 Followup-For: Bug #412056 Attached is a patch that fixes this bug, and also a patch to fix the -y option.
The code koules uses to detect the display capabilities is broken: if the server reports supporting a 32-bit visual (such as ARGB), koules blindly assumes that's the one being used. The patch modifies koules to explicitly ask the server about the capabilities of the default visual.
Index: koules-1.4/xlib/init.c =================================================================== --- koules-1.4.orig/xlib/init.c 2007-09-03 20:29:10.000000000 +0200 +++ koules-1.4/xlib/init.c 2007-09-03 20:29:29.000000000 +0200 @@ -386,6 +386,8 @@ printf ("could not open display\n"); exit (0); } + if (Sync) + XSynchronize (dp, 1); XSetCloseDownMode (dp, DestroyAll); screen = DefaultScreen (dp); fadeenable = 1; @@ -578,8 +580,6 @@ } #endif - if (Sync) - XSynchronize (dp, 1); #if defined(NAS_SOUND)||defined(RSOUND) printf ("Initializing sound server...\n"); if (sndinit) @@ -666,7 +666,7 @@ "\n\n\n\n" " Copyright(c) Jan Hubicka 1995, 1996\n\n\n"); useprivate = 0; - while ((c = mygetopt (argc, argv, "KWD:P:L:C:SxslEMmpdhfb")) != -1) + while ((c = mygetopt (argc, argv, "KWD:P:L:C:SxyslEMmpdhfb")) != -1) { switch (c) {
Index: koules-1.4/xlib/init.c =================================================================== --- koules-1.4.orig/xlib/init.c 2007-09-03 20:46:52.000000000 +0200 +++ koules-1.4/xlib/init.c 2007-09-03 21:38:49.000000000 +0200 @@ -95,7 +95,6 @@ Bool * sharedpixmaps); static int haderror; static int (*origerrorhandler) (Display *, XErrorEvent *); -static int bpp; static int @@ -179,14 +178,14 @@ VfTime = 1000000 / 25 * 12; pixmap->ximage = XCreateImage (dp, DefaultVisual (dp, screen), depth, ZPixmap, 0, - NULL, Width, Height, bpp * 8, 0); + NULL, Width, Height, depth, 0); if (!pixmap->ximage) { fprintf (stderr, "Can't get image\n"); return 0; } /*Calculate size of shared memory */ - memsize = ((Width + 1) * (Height + 1) * bpp); + memsize = ((Width + 1) * (Height + 1) * depth / 8); if ((data = malloc (memsize)) == NULL) { printf ("Can't malloc memory for image\n"); @@ -340,7 +339,6 @@ char *title1 = "Koules"; Font f; - XVisualInfo vinfo_return; XGCValues values; #ifndef NAS_SOUND #ifndef RSOUND @@ -390,54 +388,46 @@ XSynchronize (dp, 1); XSetCloseDownMode (dp, DestroyAll); screen = DefaultScreen (dp); - fadeenable = 1; - if (XMatchVisualInfo (dp, DefaultScreen (dp), - 8, PseudoColor, &vinfo_return) == False) - { - fadeenable = 0; - printf ("X: Screen doesn't support PseudoColor!\n"); - if (XMatchVisualInfo (dp, DefaultScreen (dp), - 32, TrueColor, &vinfo_return) == True) - { - useprivate = 0; - bpp = 4; - } - else if (XMatchVisualInfo (dp, DefaultScreen (dp), - 24, TrueColor, &vinfo_return) == True) - { - useprivate = 0; - bpp = 4; - } - else if (XMatchVisualInfo (dp, DefaultScreen (dp), - 16, TrueColor, &vinfo_return) == True) - { - useprivate = 0; - bpp = 2; - } - else if (XMatchVisualInfo (dp, DefaultScreen (dp), - 15, TrueColor, &vinfo_return) == True) - { - useprivate = 0; - bpp = 2; - } - else if (XMatchVisualInfo (dp, DefaultScreen (dp), - 8, GrayScale, &vinfo_return) == True) - { - useprivate = 0; - monochrome = 1; - bpp = 2; - } - else - { - printf ("Unsupported visual! Using slow and reliable mode\n"); + { + XVisualInfo template; + XVisualInfo * vinfo; + int nitems_return; + template.visualid = XVisualIDFromVisual (DefaultVisual (dp, DefaultScreen (dp))); + vinfo = XGetVisualInfo (dp, VisualIDMask, &template, &nitems_return); + if (nitems_return == 0) + { + printf ("X server does not know about the default visual..."); + exit (0); + } + + if (vinfo->class == PseudoColor && vinfo->depth == 8) + { + fadeenable = 1; + } + else + { + fadeenable = 0; + printf ("X: Screen doesn't support PseudoColor!\n"); + if (vinfo->class == TrueColor) + { + useprivate = 0; + } + else if (vinfo->class == GrayScale) + { + useprivate = 0; + monochrome = 1; + } + else + { + printf ("Unsupported visual! Using slow and reliable mode\n"); #ifdef MITSHM - shm = 0; + shm = 0; #endif - } - } - else - bpp = 1; - depth = vinfo_return.depth; + } + } + depth = vinfo->depth; + XFree(vinfo); + } #ifdef MITSHM /* Make sure all is destroyed if killed off */
_______________________________________________ Pkg-games-devel mailing list Pkg-games-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/pkg-games-devel