Re: [gtk-list] RE: Window creation





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




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