[10464] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: Window creation

daemon@ATHENA.MIT.EDU (Gerald Kuehne)
Thu Nov 26 07:02:07 1998

Date: Thu, 26 Nov 1998 13:01:12 +0100 (MET)
From: Gerald Kuehne <kuehne@informatik.uni-mannheim.de>
To: "'gtk-list@redhat.com'" <gtk-list@redhat.com>
In-Reply-To: <B223068F892CD21196AD00A0C9AA97B253875A@pastas.jaksto.alna>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com



On Thu, 26 Nov 1998, Martynas Kunigelis wrote:

> I believe there is a function gtk_push_visual(). I never used it, but I 
> think the code would look this:
> 
> GdkVisual *visal = gdk_visual_get_best ();
> gtk_push_visual (visual);
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_pop_visual ();

Thanks for your hint! Here is the "solution":

  /* get truecolor visual */
  GdkVisual* visual = gdk_visual_get_best_with_both(24, GDK_VISUAL_TRUE_COLOR);
  /* create color map */
  GdkColormap* colormap = gdk_colormap_new (visual, 0);

  gtk_widget_push_visual (visual);
  gtk_widget_push_colormap (colormap);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

Still, some questions remain:
- I not sure about the "gdk_colormap_new"-line. Are there better ways to
  create a colormap?
- Do I have to set a colormap with gtk_widget_push_colormap? Well, if
  I leave this line out the program crashes...

Bye
Gerald


-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post