void RenderThemeGtk::platformInit() { m_themePartsHaveRGBAColormap = true; m_gtkWindow = 0; m_gtkContainer = 0; m_gtkButton = 0; m_gtkEntry = 0; m_gtkTreeView = 0; m_gtkVScale = 0; m_gtkHScale = 0; m_gtkRadioButton = 0; m_gtkCheckButton = 0; m_gtkProgressBar = 0; m_gtkComboBox = 0; m_gtkComboBoxButton = 0; m_gtkComboBoxArrow = 0; m_gtkComboBoxSeparator = 0; m_gtkVScrollbar = 0; m_gtkHScrollbar = 0; m_gtkSpinButton = 0; m_colormap = gdk_screen_get_rgba_colormap(gdk_screen_get_default()); if (!m_colormap) { m_themePartsHaveRGBAColormap = false; m_colormap = gdk_screen_get_default_colormap(gdk_screen_get_default()); } }
static void na_tray_manager_set_visual_property (NaTrayManager *manager) { #ifdef GDK_WINDOWING_X11 GdkWindow *window; GdkDisplay *display; Visual *xvisual; Atom visual_atom; gulong data[1]; if (!manager->invisible) return; window = gtk_widget_get_window (manager->invisible); if (!window) return; /* The visual property is a hint to the tray icons as to what visual they * should use for their windows. If the X server has RGBA colormaps, then * we tell the tray icons to use a RGBA colormap and we'll composite the * icon onto its parents with real transparency. Otherwise, we just tell * the icon to use our colormap, and we'll do some hacks with parent * relative backgrounds to simulate transparency. */ display = gtk_widget_get_display (manager->invisible); visual_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_SYSTEM_TRAY_VISUAL"); if (gdk_screen_get_rgba_visual (manager->screen) != NULL && gdk_display_supports_composite (display)) { xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (manager->screen)); } else { /* We actually want the visual of the tray where the icons will * be embedded. In almost all cases, this will be the same as the visual * of the screen. */ GdkColormap *colormap; colormap = gdk_screen_get_default_colormap (manager->screen); xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap)); } data[0] = XVisualIDFromVisual (xvisual); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XWINDOW (window), visual_atom, XA_VISUALID, 32, PropModeReplace, (guchar *) &data, 1); #endif }
Window meta_ui_create_frame_window (MetaUI *ui, Display *xdisplay, Visual *xvisual, gint x, gint y, gint width, gint height, gint screen_no) { GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay); GdkScreen *screen = gdk_display_get_screen (display, screen_no); GdkWindowAttr attrs; gint attributes_mask; GdkWindow *window; GdkVisual *visual; #if !GTK_CHECK_VERSION (3, 0, 0) GdkColormap *cmap = gdk_screen_get_default_colormap (screen); #endif /* Default depth/visual handles clients with weird visuals; they can * always be children of the root depth/visual obviously, but * e.g. DRI games can't be children of a parent that has the same * visual as the client. */ if (!xvisual) visual = gdk_screen_get_system_visual (screen); else { visual = gdk_x11_screen_lookup_visual (screen, XVisualIDFromVisual (xvisual)); #if !GTK_CHECK_VERSION (3, 0, 0) cmap = gdk_colormap_new (visual, FALSE); #endif } attrs.title = NULL; /* frame.c is going to replace the event mask immediately, but * we still have to set it here to let GDK know what it is. */ attrs.event_mask = GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK; attrs.x = x; attrs.y = y; attrs.wclass = GDK_INPUT_OUTPUT; attrs.visual = visual; #if !GTK_CHECK_VERSION (3, 0, 0) attrs.colormap = cmap; #endif attrs.window_type = GDK_WINDOW_CHILD; attrs.cursor = NULL; attrs.wmclass_name = NULL; attrs.wmclass_class = NULL; attrs.override_redirect = FALSE; attrs.width = width; attrs.height = height; #if GTK_CHECK_VERSION (3, 0, 0) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; #else attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; #endif window = gdk_window_new (gdk_screen_get_root_window(screen), &attrs, attributes_mask); gdk_window_resize (window, width, height); meta_frames_manage_window (ui->frames, GDK_WINDOW_XID (window), window); return GDK_WINDOW_XID (window); }
bool wxGLCanvas::Create( wxWindow *parent, const wxGLContext *shared, const wxGLCanvas *shared_context_of, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attribList, const wxPalette& palette) { m_sharedContext = (wxGLContext*)shared; // const_cast m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast m_glContext = (wxGLContext*) NULL; m_exposed = false; m_noExpose = true; m_nativeSizeEvent = true; m_fbc = NULL; m_vi = NULL; // to be sure the glx version is known wxGLCanvas::QueryGLXVersion(); if (wxGLCanvas::GetGLXVersion() >= 13) { // GLX >= 1.3 uses a GLXFBConfig GLXFBConfig * fbc = NULL; if (wxTheApp->m_glFBCInfo != NULL) { fbc = (GLXFBConfig *) wxTheApp->m_glFBCInfo; m_canFreeFBC = false; // owned by wxTheApp - don't free upon destruction } else { fbc = (GLXFBConfig *) wxGLCanvas::ChooseGLFBC(attribList); m_canFreeFBC = true; } m_fbc = fbc; // save for later use wxCHECK_MSG( m_fbc, false, _T("required FBConfig couldn't be found") ); } XVisualInfo *vi = NULL; if (wxTheApp->m_glVisualInfo != NULL) { vi = (XVisualInfo *)wxTheApp->m_glVisualInfo; m_canFreeVi = false; // owned by wxTheApp - don't free upon destruction } else { if (wxGLCanvas::GetGLXVersion() >= 13) // GLX >= 1.3 vi = glXGetVisualFromFBConfig(GDK_DISPLAY(), m_fbc[0]); else // GLX <= 1.2 vi = (XVisualInfo *) ChooseGLVisual(attribList); m_canFreeVi = true; } m_vi = vi; // save for later use wxCHECK_MSG( m_vi, false, _T("required visual couldn't be found") ); GdkVisual *visual; GdkColormap *colormap; // MR: This needs a fix for lower gtk+ versions too. Might need to rethink logic (FIXME) #if 0 if (!gtk_check_version(2,2,0)) { wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; GdkScreen *screen = gtk_widget_get_screen( m_glWidget ); colormap = gdk_screen_get_default_colormap(screen); visual = gdk_colormap_get_visual(colormap); if (GDK_VISUAL_XVISUAL(visual)->visualid != vi->visualid) { visual = gdk_x11_screen_lookup_visual( screen, vi->visualid ); colormap = gdk_colormap_new(visual, FALSE); } gtk_widget_set_colormap( m_glWidget, colormap ); } else #endif { visual = gdkx_visual_get( vi->visualid ); colormap = gdk_colormap_new( visual, TRUE ); gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); wxWindow::Create( parent, id, pos, size, style, name ); m_glWidget = m_wxwindow; } gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map", GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); gtk_widget_pop_visual(); gtk_widget_pop_colormap(); // if our parent window is already visible, we had been realized before we // connected to the "realize" signal and hence our m_glContext hasn't been // initialized yet and we have to do it now if (GTK_WIDGET_REALIZED(m_wxwindow)) gtk_glwindow_realized_callback( m_wxwindow, this ); if (GTK_WIDGET_MAPPED(m_wxwindow)) gtk_glwindow_map_callback( m_wxwindow, this ); return true; }