Re: [gtk-list] getting the depth before realizing any windows?
- From: "José Miguel R. Barrientos" <jmiguel ceselsa es>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] getting the depth before realizing any windows?
- Date: Fri, 04 Jun 1999 07:28:42 +0000
Oliver Freyd wrote:
>
> Hello,
>
> I have a problem with pixmaps that I make from xbm-data,
> that is something like:
>
> #define updir_width 28
> #define updir_height 16
> static char updir_bits[] = {
> 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00,
> 0x20, 0x40, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x01, 0x10, 0x00, 0x00, 0x01,
> 0x10, 0x02, 0x00, 0x01, 0x10, 0x07, 0x00, 0x01, 0x90, 0x0f, 0x00, 0x01,
> 0x10, 0x02, 0x00, 0x01, 0x10, 0x02, 0x00, 0x01, 0x10, 0x02, 0x00, 0x01,
> 0x10, 0xfe, 0x07, 0x01, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x01,
> 0xf0, 0xff, 0xff, 0x01};
>
> I know I could also use xpm, but I have a large file with these bitmaps,
> so why not use it.
>
> To get this into a Gtk_Pixmap (I use gtk--), I first have to create
> a Gdk_Pixmap, and a Gdk_Bitmap for the mask.
>
> Gtk_Pixmap *pixmap;
> Gdk_Pixmap *gdkpix;
> Gdk_Bitmap *gdkbit;
> gdkpix=new Gdk_Pixmap;
> gdkbit=new Gdk_Bitmap;
> Gdk_Window win=toolbar.get_window();
> Gtk_Style * style= toolbar.Gtk_Widget::get_style();
> gdkpix->create_from_data(NULL,delete_bits,36,32,16,
> &style->gtkobj()->fg[GTK_STATE_NORMAL],
> &style->gtkobj()->bg[GTK_STATE_NORMAL]);
> gdkbit->create(win,delete_bits,36,32);
>
> pixmap = new Gtk_Pixmap(*gdkpix,*gdkbit);
>
> the problem is that create_from _data needs the window or the depth,
> and in the constructor of the app window the Gdk_Window is NULL, so I
> hardcoded the depth. But this only runs on a 16 bit xserver.
>
> So does anybody know how to get the depth of the root window or
> something, before realising anything?
>
> Any help is greatly appreciated...
>
> Oliver
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
Perhaps it is not the best way, but can serve (i think):
(Code in C)
GdkWindow *root_win = gdk_window_foreign_new(GDK_ROOT_WINDOW());
Then, you can use root_win to obtain defaults for your display...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]