Blob Blame History Raw
Imlib picks visual with highest possible depth, which are ARGB visuals in
case Composite extensions are in use, and which it can not handle. Use the
default, RGB, instead.

Lubomir Rintel <lkundrak@v3.sk>

diff -up xteddy-2.0.1/xteddy.c.visual xteddy-2.0.1/xteddy.c
--- xteddy-2.0.1/xteddy.c.visual	2008-12-04 12:30:18.000000000 +0100
+++ xteddy-2.0.1/xteddy.c	2008-12-04 12:30:21.000000000 +0100
@@ -122,6 +122,8 @@ int main(int argc, char **argv)
   Cursor               cursor;
   char                *teddy;
   char                *file;
+  ImlibInitParams      params;
+  Visual              *visual;
 
   /* Window movement variables */
   XWindowChanges       winchanges;
@@ -172,7 +174,12 @@ int main(int argc, char **argv)
   display_width  = DisplayWidth(display, screen_num);
   display_height = DisplayHeight(display, screen_num);
 
-  if ( !(id=Imlib_init(display)) ) return -1;
+  /* Determine the correct visual */
+  visual = DefaultVisual(display, screen_num);
+  params.flags = PARAMS_VISUALID;
+  params.visualid = visual->visualid;
+
+  if ( !(id=Imlib_init_with_params(display, &params)) ) return -1;
   if ( !(file = InitTeddy(teddy)) ) {
     fprintf(stderr, "Can not find any image with name %s.\n", teddy);
     return -1;