Re: [gtk-list] Re: Why is system visual == DefaultVisual?



> From: Federico Mena Quintero <federico@redhat.com>
> 
> >  The problem is that gdk_visual_get_system returns the result of the
> >  DefaultVisual Xlib call, which on my system at least just returns the
> >  visual of the root window. This means all gtk applications get an 8-bit
> >  visual, which is bad because there are not that many of them, and why
> >  use 8 bits, when there are better visuals?
> >  
> >  Does anyone know if there is a reason not to use a TrueColor or
> >  DirectColor 24-bit visual if there is one available as the default
> >  visual in gtk?=20
> 
> Because the fat visuals consume a lot more resources than 8-bit
> pseudocolor, and they are slower.
> 
> The idea of having multiple visuals is that most of your application's
> UI can run in a small and lean visual, like 8-bit pseudocolor, while
> areas that need high quality images can use fatter visuals.  And some
> hardware lets you pop up an 8-bit pseudocolor window over a 24-bit
> truecolor one, and when it goes away, no exposures will be sent to the
> 24-bit window, thus increasing performance.

[snip]
 
>   Federico

On a related note, can you tell me how to get a 24 bit visual for a
widget that is using 8-bit pseudocolor?

I've run into this on Suns when getting a drawing area widget and end
up with an 8 bit visual and want a 24 bit visual.

Is the following ok (as long as I do it before the widget is realized)?

GdkVisual *vis_24 = gdk_visual_get_best_with_depth(24);
if (vis_24) {
    gtk_widget_set_visual(GTK_WIDGET(widget_), vis_24);
}

Thanks,
Dave




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