[gtk+] x11: Replace gdk_display_get_window_visual()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] x11: Replace gdk_display_get_window_visual()
- Date: Fri, 4 Nov 2016 01:28:31 +0000 (UTC)
commit 0192f936895ac1eab1bcca844c0ea737837cd86b
Author: Benjamin Otte <otte redhat com>
Date: Thu Nov 3 22:40:36 2016 +0100
x11: Replace gdk_display_get_window_visual()
... with functions that don't use GdkVisual.
A small step towards getting rid of GdkVisual.
gdk/x11/gdkdisplay-x11.c | 24 +++++++++++++++++++++---
gdk/x11/gdkglcontext-x11.c | 2 +-
gdk/x11/gdkprivate-x11.h | 4 +++-
gdk/x11/gdkwindow-x11.c | 12 +++++-------
4 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 3b2c305..c944a66 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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)
{
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 92e852f..5f16baf 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -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;
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index b2f7267..b96f1a0 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -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,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index f1b2c07..4c0eddb 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]