[gtk+/wip/matthiasc/debug-cleanup] wip: Reorganize GDK env vars
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/debug-cleanup] wip: Reorganize GDK env vars
- Date: Thu, 11 Jan 2018 13:55:11 +0000 (UTC)
commit 90dbeb8e8a64b2aaed46e23b79612ecd2ad45565
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jan 11 08:53:57 2018 -0500
wip: Reorganize GDK env vars
Drop GDK_GL, GDK_VULKAN and GDK_RENDERING_MODE. Merge
the useful bits into GDK_DEBUG.
gdk/gdk-private.h | 9 +---
gdk/gdk.c | 76 +++++++++++-------------------------
gdk/gdkdisplay.c | 14 +++---
gdk/gdkdisplayprivate.h | 2 +-
gdk/gdkgl.c | 2 +-
gdk/gdkglcontext.c | 35 +---------------
gdk/gdkglobals.c | 3 -
gdk/gdkinternals.h | 65 +++++++++++++-----------------
gdk/gdkvulkancontext.c | 4 +-
gdk/gdkwindow.c | 38 +++++++-----------
gdk/wayland/gdkglcontext-wayland.c | 4 +-
gdk/x11/gdkglcontext-x11.c | 8 +--
gtk/inspector/visual.c | 53 ++++++++++++++-----------
13 files changed, 118 insertions(+), 195 deletions(-)
---
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index 0ebbc9d..5c1c575 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -17,17 +17,14 @@ void gdk_add_option_entries (GOptionGroup *group);
void gdk_pre_parse (void);
-GdkGLFlags gdk_gl_get_flags (void);
-void gdk_gl_set_flags (GdkGLFlags flags);
-
void gdk_window_freeze_toplevel_updates (GdkWindow *window);
void gdk_window_thaw_toplevel_updates (GdkWindow *window);
gboolean gdk_window_supports_edge_constraints (GdkWindow *window);
-GdkRenderingMode gdk_display_get_rendering_mode (GdkDisplay *display);
-void gdk_display_set_rendering_mode (GdkDisplay *display,
- GdkRenderingMode mode);
+GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
+void gdk_display_set_debug_flags (GdkDisplay *display,
+ GdkDebugFlags flags);
void gdk_window_move_to_rect (GdkWindow *window,
const GdkRectangle *rect,
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 4186ab9..8d0d1f9 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -135,35 +135,31 @@ static GMutex gdk_threads_mutex;
static GCallback gdk_threads_lock = NULL;
static GCallback gdk_threads_unlock = NULL;
-static const GDebugKey gdk_gl_keys[] = {
- { "disable", GDK_GL_DISABLE },
- { "always", GDK_GL_ALWAYS },
- { "software-draw", GDK_GL_SOFTWARE_DRAW } ,
- { "texture-rectangle", GDK_GL_TEXTURE_RECTANGLE },
- { "legacy", GDK_GL_LEGACY },
- { "gles", GDK_GL_GLES },
-};
-
-static const GDebugKey gdk_vulkan_keys[] = {
- { "disable", GDK_VULKAN_DISABLE },
- { "validate", GDK_VULKAN_VALIDATE },
-};
-
#ifdef G_ENABLE_DEBUG
static const GDebugKey gdk_debug_keys[] = {
- { "events", GDK_DEBUG_EVENTS },
- { "misc", GDK_DEBUG_MISC },
- { "dnd", GDK_DEBUG_DND },
- { "nograbs", GDK_DEBUG_NOGRABS },
- { "input", GDK_DEBUG_INPUT },
- { "cursor", GDK_DEBUG_CURSOR },
- { "eventloop", GDK_DEBUG_EVENTLOOP },
- { "frames", GDK_DEBUG_FRAMES },
- { "settings", GDK_DEBUG_SETTINGS },
- { "opengl", GDK_DEBUG_OPENGL },
- { "vulkan", GDK_DEBUG_VULKAN },
- { "selection", GDK_DEBUG_SELECTION },
- { "clipboard", GDK_DEBUG_CLIPBOARD }
+ { "events", GDK_DEBUG_EVENTS },
+ { "misc", GDK_DEBUG_MISC },
+ { "dnd", GDK_DEBUG_DND },
+ { "nograbs", GDK_DEBUG_NOGRABS },
+ { "input", GDK_DEBUG_INPUT },
+ { "cursor", GDK_DEBUG_CURSOR },
+ { "eventloop", GDK_DEBUG_EVENTLOOP },
+ { "frames", GDK_DEBUG_FRAMES },
+ { "settings", GDK_DEBUG_SETTINGS },
+ { "opengl", GDK_DEBUG_OPENGL },
+ { "vulkan", GDK_DEBUG_VULKAN },
+ { "selection", GDK_DEBUG_SELECTION },
+ { "clipboard", GDK_DEBUG_CLIPBOARD },
+ { "gl-disable", GDK_DEBUG_GL_DISABLE },
+ { "gl-always", GDK_DEBUG_GL_ALWAYS },
+ { "gl-software", GDK_DEBUG_GL_SOFTWARE },
+ { "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT },
+ { "gl-legacy", GDK_DEBUG_GL_LEGACY },
+ { "gl-gles", GDK_DEBUG_GL_GLES },
+ { "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE },
+ { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE },
+ { "cairo-image", GDK_DEBUG_CAIRO_IMAGE },
+ { "cairo-recording", GDK_DEBUG_CAIRO_RECORDING }
};
#endif
@@ -186,9 +182,6 @@ gdk_ensure_resources (void)
void
gdk_pre_parse (void)
{
- const char *rendering_mode;
- const gchar *gl_string, *vulkan_string;
-
gdk_initialized = TRUE;
gdk_ensure_resources ();
@@ -202,29 +195,6 @@ gdk_pre_parse (void)
G_N_ELEMENTS (gdk_debug_keys));
}
#endif /* G_ENABLE_DEBUG */
-
- gl_string = getenv("GDK_GL");
- if (gl_string != NULL)
- _gdk_gl_flags = g_parse_debug_string (gl_string,
- (GDebugKey *) gdk_gl_keys,
- G_N_ELEMENTS (gdk_gl_keys));
-
- vulkan_string = getenv("GDK_VULKAN");
- if (vulkan_string != NULL)
- _gdk_vulkan_flags = g_parse_debug_string (vulkan_string,
- (GDebugKey *) gdk_vulkan_keys,
- G_N_ELEMENTS (gdk_vulkan_keys));
-
- rendering_mode = g_getenv ("GDK_RENDERING");
- if (rendering_mode)
- {
- if (g_str_equal (rendering_mode, "similar"))
- _gdk_rendering_mode = GDK_RENDERING_MODE_SIMILAR;
- else if (g_str_equal (rendering_mode, "image"))
- _gdk_rendering_mode = GDK_RENDERING_MODE_IMAGE;
- else if (g_str_equal (rendering_mode, "recording"))
- _gdk_rendering_mode = GDK_RENDERING_MODE_RECORDING;
- }
}
/*< private >
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index d8b3c05..aff7577 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -379,7 +379,7 @@ gdk_display_init (GdkDisplay *display)
display->pointers_info = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) free_pointer_info);
- display->rendering_mode = _gdk_rendering_mode;
+ display->debug_flags = _gdk_debug_flags;
display->composited = TRUE;
display->rgba = TRUE;
@@ -1502,17 +1502,17 @@ gdk_display_make_gl_context_current (GdkDisplay *display,
return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
}
-GdkRenderingMode
-gdk_display_get_rendering_mode (GdkDisplay *display)
+GdkDebugFlags
+gdk_display_get_debug_flags (GdkDisplay *display)
{
- return display->rendering_mode;
+ return display->debug_flags;
}
void
-gdk_display_set_rendering_mode (GdkDisplay *display,
- GdkRenderingMode mode)
+gdk_display_set_debug_flags (GdkDisplay *display,
+ GdkDebugFlags flags)
{
- display->rendering_mode = mode;
+ display->debug_flags = flags;
}
/**
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 0214346..7eecaac 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -105,7 +105,7 @@ struct _GdkDisplay
guint rgba : 1;
guint composited : 1;
- GdkRenderingMode rendering_mode;
+ GdkDebugFlags debug_flags;
GList *seats;
};
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index ac8dda9..9b45b75 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -469,7 +469,7 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
guint target;
paint_context = gdk_gl_context_get_current ();
- if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW) == 0 &&
+ if (GDK_DEBUG_CHECK (GL_SOFTWARE) == 0 &&
paint_context &&
GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface &&
GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface (paint_context, surface, region))
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 8d1c99d..a24825e 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -571,7 +571,7 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
/* Enforce a minimum context version number of 3.2 */
version = (major * 100) + minor;
- if (priv->use_es > 0 || (_gdk_gl_flags & GDK_GL_GLES) != 0)
+ if (priv->use_es > 0 || GDK_DEBUG_CHECK (GL_GLES))
min_ver = 200;
else
min_ver = 302;
@@ -607,7 +607,7 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
- if (priv->use_es > 0 || (_gdk_gl_flags & GDK_GL_GLES) != 0)
+ if (priv->use_es > 0 || GDK_DEBUG_CHECK (GL_GLES))
{
default_major = 2;
default_minor = 0;
@@ -812,7 +812,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->is_legacy = TRUE;
}
- if (!priv->use_es && G_UNLIKELY (_gdk_gl_flags & GDK_GL_TEXTURE_RECTANGLE))
+ if (!priv->use_es && GDK_DEBUG_CHECK (GL_TEXTURE_RECT))
priv->use_texture_rectangle = TRUE;
else if (has_npot)
priv->use_texture_rectangle = FALSE;
@@ -1009,32 +1009,3 @@ gdk_gl_context_get_current (void)
return current;
}
-
-/**
- * gdk_gl_get_flags:
- *
- * Returns the currently active GL flags.
- *
- * Returns: the GL flags
- *
- * Since: 3.16
- */
-GdkGLFlags
-gdk_gl_get_flags (void)
-{
- return _gdk_gl_flags;
-}
-
-/**
- * gdk_gl_set_flags:
- * @flags: #GdkGLFlags to set
- *
- * Sets GL flags.
- *
- * Since: 3.16
- */
-void
-gdk_gl_set_flags (GdkGLFlags flags)
-{
- _gdk_gl_flags = flags;
-}
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index b97f664..644dcfa 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -31,6 +31,3 @@
guint _gdk_debug_flags = 0;
GList *_gdk_default_filters = NULL;
-guint _gdk_gl_flags = 0;
-guint _gdk_vulkan_flags = 0;
-GdkRenderingMode _gdk_rendering_mode = GDK_RENDERING_MODE_SIMILAR;
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 55e83ef..b3eeb4c 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -57,48 +57,36 @@ struct _GdkEventFilter {
};
typedef enum {
- GDK_DEBUG_MISC = 1 << 0,
- GDK_DEBUG_EVENTS = 1 << 1,
- GDK_DEBUG_DND = 1 << 2,
- GDK_DEBUG_NOGRABS = 1 << 3,
- GDK_DEBUG_INPUT = 1 << 4,
- GDK_DEBUG_CURSOR = 1 << 5,
- GDK_DEBUG_EVENTLOOP = 1 << 6,
- GDK_DEBUG_FRAMES = 1 << 7,
- GDK_DEBUG_SETTINGS = 1 << 8,
- GDK_DEBUG_OPENGL = 1 << 9,
- GDK_DEBUG_VULKAN = 1 << 10,
- GDK_DEBUG_SELECTION = 1 << 11,
- GDK_DEBUG_CLIPBOARD = 1 << 12
-} GdkDebugFlag;
-
-typedef enum {
- GDK_RENDERING_MODE_SIMILAR = 0,
- GDK_RENDERING_MODE_IMAGE,
- GDK_RENDERING_MODE_RECORDING
-} GdkRenderingMode;
-
-typedef enum {
- GDK_GL_DISABLE = 1 << 0,
- GDK_GL_ALWAYS = 1 << 1,
- GDK_GL_SOFTWARE_DRAW = 1 << 2,
- GDK_GL_TEXTURE_RECTANGLE = 1 << 3,
- GDK_GL_LEGACY = 1 << 4,
- GDK_GL_GLES = 1 << 5
-} GdkGLFlags;
-
-typedef enum {
- GDK_VULKAN_DISABLE = 1 << 0,
- GDK_VULKAN_VALIDATE = 1 << 1,
-} GdkVulkanFlags;
+ GDK_DEBUG_MISC = 1 << 0,
+ GDK_DEBUG_EVENTS = 1 << 1,
+ GDK_DEBUG_DND = 1 << 2,
+ GDK_DEBUG_NOGRABS = 1 << 3,
+ GDK_DEBUG_INPUT = 1 << 4,
+ GDK_DEBUG_CURSOR = 1 << 5,
+ GDK_DEBUG_EVENTLOOP = 1 << 6,
+ GDK_DEBUG_FRAMES = 1 << 7,
+ GDK_DEBUG_SETTINGS = 1 << 8,
+ GDK_DEBUG_OPENGL = 1 << 9,
+ GDK_DEBUG_VULKAN = 1 << 10,
+ GDK_DEBUG_SELECTION = 1 << 11,
+ GDK_DEBUG_CLIPBOARD = 1 << 12,
+ GDK_DEBUG_GL_DISABLE = 1 << 13,
+ GDK_DEBUG_GL_ALWAYS = 1 << 14,
+ GDK_DEBUG_GL_SOFTWARE = 1 << 15,
+ GDK_DEBUG_GL_TEXTURE_RECT = 1 << 16,
+ GDK_DEBUG_GL_LEGACY = 1 << 17,
+ GDK_DEBUG_GL_GLES = 1 << 18,
+ GDK_DEBUG_VULKAN_DISABLE = 1 << 19,
+ GDK_DEBUG_VULKAN_VALIDATE = 1 << 20,
+ GDK_DEBUG_CAIRO_IMAGE = 1 << 21,
+ GDK_DEBUG_CAIRO_RECORDING = 1 << 22
+} GdkDebugFlags;
extern GList *_gdk_default_filters;
extern GdkWindow *_gdk_parent_root;
extern guint _gdk_debug_flags;
-extern guint _gdk_gl_flags;
-extern guint _gdk_vulkan_flags;
-extern GdkRenderingMode _gdk_rendering_mode;
+
#ifdef G_ENABLE_DEBUG
@@ -108,10 +96,13 @@ extern GdkRenderingMode _gdk_rendering_mode;
if (GDK_DEBUG_CHECK (type)) \
{ action; }; } G_STMT_END
+#define GDK_DISPLAY_DEBUG_CHECK(display,type) G_UNLIKELY(gdk_display_get_debug_flags (display) &
GDK_DEBUG_##type)
+
#else /* !G_ENABLE_DEBUG */
#define GDK_DEBUG_CHECK(type) 0
#define GDK_NOTE(type,action)
+#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
#endif /* G_ENABLE_DEBUG */
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index 1c4e790..72657f2 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -941,7 +941,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
VK_VERSION_MINOR (layers[i].specVersion),
VK_VERSION_PATCH (layers[i].specVersion),
layers[i].description));
- if ((_gdk_vulkan_flags & GDK_VULKAN_VALIDATE) &&
+ if (GDK_DEBUG_CHECK (VULKAN_VALIDATE) &&
g_str_equal (layers[i].layerName, "VK_LAYER_LUNARG_standard_validation"))
{
g_ptr_array_add (used_layers, (gpointer) "VK_LAYER_LUNARG_standard_validation");
@@ -949,7 +949,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
}
}
- if ((_gdk_vulkan_flags & GDK_VULKAN_VALIDATE) && !validate)
+ if (GDK_DEBUG_CHECK (VULKAN_VALIDATE) && !validate)
{
g_warning ("Vulkan validation layers were requested, but not found. Running without.");
}
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c553a26..c67117f 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -998,7 +998,7 @@ gdk_window_new (GdkDisplay *display,
g_signal_connect (display, "seat-removed", G_CALLBACK (seat_removed_cb), window);
- if ((_gdk_gl_flags & (GDK_GL_ALWAYS | GDK_GL_DISABLE)) == GDK_GL_ALWAYS)
+ if (GDK_DEBUG_CHECK (GL_ALWAYS))
{
GError *error = NULL;
@@ -1871,7 +1871,7 @@ gdk_window_get_paint_gl_context (GdkWindow *window,
{
GError *internal_error = NULL;
- if (_gdk_gl_flags & GDK_GL_DISABLE)
+ if (GDK_DEBUG_CHECK (GL_DISABLE))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
@@ -1976,7 +1976,7 @@ gdk_window_create_vulkan_context (GdkWindow *window,
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- if (_gdk_vulkan_flags & GDK_VULKAN_DISABLE)
+ if (GDK_DEBUG_CHECK (VULKAN_DISABLE))
{
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
_("Vulkan support disabled via GDK_DEBUG"));
@@ -5772,8 +5772,6 @@ gdk_window_create_similar_surface (GdkWindow * window,
int width,
int height)
{
- GdkDisplay *display;
- GdkRenderingMode rendering_mode;
cairo_surface_t *window_surface, *surface;
double sx, sy;
@@ -5783,31 +5781,25 @@ gdk_window_create_similar_surface (GdkWindow * window,
sx = sy = 1;
cairo_surface_get_device_scale (window_surface, &sx, &sy);
- display = gdk_window_get_display (window);
- rendering_mode = gdk_display_get_rendering_mode (display);
-
- switch (rendering_mode)
- {
- case GDK_RENDERING_MODE_RECORDING:
- {
- cairo_rectangle_t rect = { 0, 0, width * sx, height *sy };
- surface = cairo_recording_surface_create (content, &rect);
- cairo_surface_set_device_scale (surface, sx, sy);
- }
- break;
- case GDK_RENDERING_MODE_IMAGE:
+ if (GDK_DEBUG_CHECK (CAIRO_RECORDING))
+ {
+ cairo_rectangle_t rect = { 0, 0, width * sx, height *sy };
+ surface = cairo_recording_surface_create (content, &rect);
+ cairo_surface_set_device_scale (surface, sx, sy);
+ }
+ else if (GDK_DEBUG_CHECK (CAIRO_IMAGE))
+ {
surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 :
CAIRO_FORMAT_ARGB32,
width * sx, height * sy);
cairo_surface_set_device_scale (surface, sx, sy);
- break;
- case GDK_RENDERING_MODE_SIMILAR:
- default:
+ }
+ else
+ {
surface = cairo_surface_create_similar (window_surface,
content,
width, height);
- break;
- }
+ }
cairo_surface_destroy (window_surface);
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 7f74a34..a2aecda 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -56,9 +56,9 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
gdk_gl_context_get_required_version (context, &major, &minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
forward_bit = gdk_gl_context_get_forward_compatible (context);
- legacy_bit = (_gdk_gl_flags & GDK_GL_LEGACY) != 0 ||
+ legacy_bit = GDK_DEBUG_CHECK (GL_LEGACY) ||
(share != NULL && gdk_gl_context_is_legacy (share));
- use_es = (_gdk_gl_flags & GDK_GL_GLES) != 0 ||
+ use_es = GDK_DEBUG_CHECK (GL_GLES) ||
(share != NULL && gdk_gl_context_get_use_es (share));
flags = 0;
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 74911dd..853274f 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -582,11 +582,9 @@ gdk_x11_gl_context_realize (GdkGLContext *context,
compat_bit = gdk_gl_context_get_forward_compatible (context);
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
- legacy_bit = !display_x11->has_glx_create_context ||
- (_gdk_gl_flags & GDK_GL_LEGACY) != 0;
+ legacy_bit = !display_x11->has_glx_create_context || GDK_DEBUG_CHECK (GL_LEGACY);
- es_bit = ((_gdk_gl_flags & GDK_GL_GLES) != 0 ||
- (share != NULL && gdk_gl_context_get_use_es (share))) &&
+ es_bit = (GDK_DEBUG_CHECK (GL_GLES) || (share != NULL && gdk_gl_context_get_use_es (share))) &&
(display_x11->has_glx_create_context && display_x11->has_glx_create_es2_context);
/* We cannot share legacy contexts with core profile ones, so the
@@ -793,7 +791,7 @@ gdk_x11_screen_init_gl (GdkX11Screen *screen)
if (display_x11->have_glx)
return TRUE;
- if (_gdk_gl_flags & GDK_GL_DISABLE)
+ if (GDK_DEBUG_CHECK (GL_DISABLE))
return FALSE;
dpy = gdk_x11_display_get_xdisplay (display);
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index fae2760..57f5718 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -758,26 +758,22 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual
static void
init_gl (GtkInspectorVisual *vis)
{
- GdkGLFlags flags;
+ GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
- flags = gdk_gl_get_flags ();
-
- if (flags & GDK_GL_ALWAYS)
+ if (flags & GDK_DEBUG_GL_ALWAYS)
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "always");
- else if (flags & GDK_GL_DISABLE)
+ else if (flags & GDK_DEBUG_GL_DISABLE)
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "disable");
else
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "maybe");
gtk_widget_set_sensitive (vis->priv->gl_combo, FALSE);
gtk_widget_set_tooltip_text (vis->priv->gl_combo,
- _("Not settable at runtime.\nUse GDK_GL=always or GDK_GL=disable instead"));
+ _("Not settable at runtime.\nUse GDK_DEBUG=gl-always or GDK_DEBUG=gl-disable
instead"));
- gtk_switch_set_active (GTK_SWITCH (vis->priv->software_gl_switch),
- flags & GDK_GL_SOFTWARE_DRAW);
- gtk_switch_set_active (GTK_SWITCH (vis->priv->texture_rectangle_switch),
- flags & GDK_GL_TEXTURE_RECTANGLE);
+ gtk_switch_set_active (GTK_SWITCH (vis->priv->software_gl_switch), flags & GDK_DEBUG_GL_SOFTWARE);
+ gtk_switch_set_active (GTK_SWITCH (vis->priv->texture_rectangle_switch), flags &
GDK_DEBUG_GL_TEXTURE_RECT);
- if (flags & GDK_GL_DISABLE)
+ if (flags & GDK_DEBUG_GL_DISABLE)
{
gtk_widget_set_sensitive (vis->priv->software_gl_switch, FALSE);
gtk_widget_set_sensitive (vis->priv->texture_rectangle_switch, FALSE);
@@ -789,9 +785,14 @@ init_gl (GtkInspectorVisual *vis)
static void
init_rendering_mode (GtkInspectorVisual *vis)
{
- GdkRenderingMode mode;
+ GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
+ int mode = 0;
+
+ if (flags & GDK_DEBUG_CAIRO_IMAGE)
+ mode = 1;
+ else if (flags & GDK_DEBUG_CAIRO_RECORDING)
+ mode = 2;
- mode = gdk_display_get_rendering_mode (gdk_display_get_default ());
gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->rendering_mode_combo), mode);
}
@@ -799,38 +800,44 @@ static void
rendering_mode_changed (GtkComboBox *c,
GtkInspectorVisual *vis)
{
- GdkRenderingMode mode;
+ GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
+ int mode;
mode = gtk_combo_box_get_active (c);
- gdk_display_set_rendering_mode (gdk_display_get_default (), mode);
+
+ flags = flags & ~(GDK_DEBUG_CAIRO_IMAGE | GDK_DEBUG_CAIRO_RECORDING);
+ if (mode == 1)
+ flags = flags | GDK_DEBUG_CAIRO_IMAGE;
+ else if (mode == 2)
+ flags = flags | GDK_DEBUG_CAIRO_RECORDING;
+
+ gdk_display_set_debug_flags (gdk_display_get_default (), flags);
}
static void
-update_gl_flag (GtkSwitch *sw,
- GdkGLFlags flag)
+update_gl_flag (GtkSwitch *sw,
+ GdkDebugFlags flag)
{
- GdkGLFlags flags;
-
- flags = gdk_gl_get_flags ();
+ GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
if (gtk_switch_get_active (sw))
flags |= flag;
else
flags &= ~flag;
- gdk_gl_set_flags (flags);
+ gdk_display_set_debug_flags (gdk_display_get_default (), flags);
}
static void
software_gl_activate (GtkSwitch *sw)
{
- update_gl_flag (sw, GDK_GL_SOFTWARE_DRAW);
+ update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE);
}
static void
texture_rectangle_activate (GtkSwitch *sw)
{
- update_gl_flag (sw, GDK_GL_TEXTURE_RECTANGLE);
+ update_gl_flag (sw, GDK_DEBUG_GL_TEXTURE_RECT);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]