Re: gdk-imlib example will not run




Todd Dukes <tdukes@ibmoto.com> writes:

> This is a multi-part message in MIME format.
> --------------88CAB16DF9D5E3640DC41F0B
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> I am trying to use gdk-imlib 1.8.2 I cut the
> example out of the documentation and tried to run it
> with a jpg image I have. This is what I get.
> 
> $ imlibTest raptor.jpg 
> 
> Gdk-ERROR **: BadMatch (invalid parameter attributes)
>   serial 65 error_code 8 request_code 2 minor_code 0
> 
> aborting...
> Abort(coredump)
> $ 
> 
> I will attach the source as I compiled it.
> 
> Does anyone know why this doens't work?

The problem is that it tries to get the right visual 
and colormap by using:

> /* Get gdk to use imlib's visual and colormap */
>    gtk_widget_push_visual(gdk_imlib_get_visual());
>    gtk_widget_push_colormap(gdk_imlib_get_colormap());

Unfortunately it doesn't actually use GTK+ to create
its windows. (I need to beat Raster over the head
a bit and make him fix this.)
       
> /* Load the image specified as the first argument */
>     im=gdk_imlib_load_image(argv[1]);
> /* Suck[B the image's original width and height out of the Image structure */
>     w=im->rgb_width;h=im->rgb_height;
> /* Set up attributes for GDK to create a Window */
>     attr.window_type=GDK_WINDOW_TOPLEVEL;
>     attr.wclass=GDK_INPUT_OUTPUT;
>     attr.event_mask=GDK_STRUCTURE_MASK;
>
>     attr.width=w;
>     attr.height=h;

If you add lines

      attr.visual = gdk_imlib_get_visual();
      attr.colormap = gdk_imlib_get_colormap();

> /* Create a Window to display in */
>     win=gdk_window_new(NULL,&attr,0);

And make this:

  gdk_window_new (NULL, &attr, GDK_WA_VISUALK | GDK_WA_COLORMAP);

Things should work.

                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]