x11: Replace gdk_display_get_window_visual()

... with functions that don't use GdkVisual.

A small step towards getting rid of GdkVisual.
This commit is contained in:
Benjamin Otte 2016-11-03 22:40:36 +01:00
parent 6c6359df4f
commit 0192f93689
4 changed files with 30 additions and 12 deletions

View File

@ -2919,12 +2919,12 @@ gdk_x11_display_get_primary_monitor (GdkDisplay *display)
return NULL;
}
GdkVisual *
gdk_x11_display_get_window_visual (GdkX11Display *display)
static GdkVisual *
gdk_x11_display_get_window_gdk_visual (GdkX11Display *display)
{
GdkScreen *screen;
GdkVisual *visual;
screen = gdk_display_get_default_screen (GDK_DISPLAY (display));
visual = gdk_screen_get_rgba_visual (screen);
@ -2934,6 +2934,24 @@ gdk_x11_display_get_window_visual (GdkX11Display *display)
return visual;
}
int
gdk_x11_display_get_window_depth (GdkX11Display *display)
{
return gdk_visual_get_depth (gdk_x11_display_get_window_gdk_visual (display));
}
Visual *
gdk_x11_display_get_window_visual (GdkX11Display *display)
{
return gdk_x11_visual_get_xvisual (gdk_x11_display_get_window_gdk_visual (display));
}
Colormap
gdk_x11_display_get_window_colormap (GdkX11Display *display)
{
return _gdk_visual_get_x11_colormap (gdk_x11_display_get_window_gdk_visual (display));
}
static void
gdk_x11_display_class_init (GdkX11DisplayClass * class)
{

View File

@ -924,7 +924,7 @@ find_fbconfig (GdkDisplay *display,
GLXFBConfig *configs;
int n_configs, i;
gboolean retval = FALSE;
VisualID xvisual_id = XVisualIDFromVisual (gdk_x11_visual_get_xvisual (gdk_x11_display_get_window_visual (GDK_X11_DISPLAY (display))));
VisualID xvisual_id = XVisualIDFromVisual (gdk_x11_display_get_window_visual (GDK_X11_DISPLAY (display)));
i = 0;
attrs[i++] = GLX_DRAWABLE_TYPE;

View File

@ -54,7 +54,9 @@ GdkVisual * _gdk_x11_screen_get_system_visual (GdkScreen *screen
GList * _gdk_x11_screen_list_visuals (GdkScreen *screen);
GdkVisual * gdk_x11_display_get_window_visual (GdkX11Display *display);
int gdk_x11_display_get_window_depth (GdkX11Display *display);
Visual * gdk_x11_display_get_window_visual (GdkX11Display *display);
Colormap gdk_x11_display_get_window_colormap (GdkX11Display *display);
void _gdk_x11_display_add_window (GdkDisplay *display,
XID *xid,

View File

@ -464,12 +464,12 @@ gdk_x11_create_cairo_surface (GdkWindowImplX11 *impl,
int width,
int height)
{
GdkVisual *visual;
Visual *visual;
visual = gdk_x11_display_get_window_visual (GDK_X11_DISPLAY (gdk_window_get_display (impl->wrapper)));
return cairo_xlib_surface_create (GDK_WINDOW_XDISPLAY (impl->wrapper),
GDK_WINDOW_IMPL_X11 (impl)->xid,
GDK_VISUAL_XVISUAL (visual),
visual,
width, height);
}
@ -905,7 +905,6 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
GdkWindowImplX11 *impl;
GdkX11Screen *x11_screen;
GdkX11Display *display_x11;
GdkVisual *visual;
Window xparent;
Visual *xvisual;
@ -932,8 +931,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
xattributes_mask = 0;
visual = gdk_x11_display_get_window_visual (display_x11);
xvisual = gdk_x11_visual_get_xvisual (visual);
xvisual = gdk_x11_display_get_window_visual (display_x11);
if (attributes_mask & GDK_WA_NOREDIR)
{
@ -970,7 +968,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
xattributes.bit_gravity = NorthWestGravity;
xattributes_mask |= CWBitGravity;
xattributes.colormap = _gdk_visual_get_x11_colormap (visual);
xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11);
xattributes_mask |= CWColormap;
if (window->window_type == GDK_WINDOW_TEMP)
@ -983,7 +981,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
impl->override_redirect = TRUE;
}
depth = visual->depth;
depth = gdk_x11_display_get_window_depth (display_x11);
}
else
{