Manually specifying the Visual for a GTK+ app?
- From: jonathan claggett philips com
- To: gtk-app-devel-list gnome org
- Subject: Manually specifying the Visual for a GTK+ app?
- Date: Wed, 12 Jan 2005 15:17:17 -0500
Hello GTK developers,
I am developing a GTK+ application via the Perl bindings to be run
alongside a 'legacy' application. I use the term legacy because the
ancient thing requires that the default Visual be 8-bits and then proceeds
to XAlloc most of the available 256 color slots. The good news is that the
video card I'm using supports multiple visuals including GTK+'s favorite:
TrueColor. Thus my question: Is it possible to initialize a GTK+ app to
use the non-default 24-bit TrueColor visual that is available?
I'm aware of the GDK Visual functions like get_best() but I've no idea how
to use them to specify the visual for e.g., a MessageDialog in my program.
Ideally, I'd like to be able to specify up front what visual should be
used for all ensuing GTK+ widgets.
Thanks in advance for any and all suggestions,
Jonathan
Here is an excerpt from xdpyinfo's output on my machine:
...
screen #0:
dimensions: 1280x1024 pixels (361x288 millimeters)
resolution: 90x90 dots per inch
depths (3): 1, 24, 8
root window id: 0x35
depth of root window: 8 planes
number of colormaps: minimum 1, maximum 1
default colormap: 0x22
default number of colormap cells: 256
preallocated pixels: black 0, white 1
options: backing-store YES, save-unders YES
largest cursor: unlimited
current input event mask: 0x38003f
KeyPressMask KeyReleaseMask ButtonPressMask
ButtonReleaseMask EnterWindowMask LeaveWindowMask
SubstructureNotifyMask SubstructureRedirectMask FocusChangeMask
number of visuals: 7
default visual id: 0x24
visual:
visual id: 0x23 <---- This is the
one I want! -------<<
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x24 <---- This is the
one GTK+ sees! ----<<
class: PseudoColor
depth: 8 planes
available colormap entries: 256
red, green, blue masks: 0x0, 0x0, 0x0
significant bits in color specification: 8 bits
...
And, for simplicity's sake, assume my my perl-gtk application looks like
this:
#!/usr/local/bin/perl
use Gtk2 '-init'; # The '-init' means Gtk2->init gets called initially
Gtk2::MessageDialog
-> new($no_parent, 'modal', 'info', 'ok', 'This is only a test')
-> run();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]