From 183709c5228d538677adf92f0e05639697d32e3a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:45:43 -0400 Subject: [PATCH 01/30] Fix default-settings handling This is meant to be always available, but we were checking for debug in one place. --- gdk/x11/xsettings-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index ac4811faa8..f92649782d 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -487,7 +487,7 @@ check_manager_window (GdkX11Screen *x11_screen, gdk_x11_display_grab (display); - if (!GDK_DISPLAY_DEBUG_CHECK (display, DEFAULT_SETTINGS)) + if (!(gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)) x11_screen->xsettings_manager_window = XGetSelectionOwner (xdisplay, get_selection_atom (x11_screen)); if (x11_screen->xsettings_manager_window != 0) From 7785c18c56dff8193c01c8afba49ef5c09295d56 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:47:26 -0400 Subject: [PATCH 02/30] Fix high-depth handling We mark this flag as always available, but we were only checking it in debug builds. --- gdk/gdkdrawcontext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/gdkdrawcontext.c b/gdk/gdkdrawcontext.c index 5e64ec32f9..8c27e938c0 100644 --- a/gdk/gdkdrawcontext.c +++ b/gdk/gdkdrawcontext.c @@ -364,7 +364,7 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context, return; } - if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH)) + if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH) prefers_high_depth = TRUE; priv->frame_region = cairo_region_copy (region); From 1b96828667e14a48d4a7f421133de206a8b48e84 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:49:53 -0400 Subject: [PATCH 03/30] Make vulkan-validate always available There is no need to restrict this debug builds. --- gdk/gdk.c | 2 +- gdk/gdkvulkancontext.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 4d3e4eb5b6..8b7c52769c 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -128,7 +128,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" }, { "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" }, { "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" }, - { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" }, + { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE }, { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE }, { "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE }, }; diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 1f464cea95..b3549a9413 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -1072,7 +1072,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_DISPLAY_DEBUG_CHECK (display, VULKAN_VALIDATE) && + if ((gdk_display_get_debug_flags (display) & GDK_DEBUG_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"); @@ -1080,7 +1080,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display, } } - if (GDK_DISPLAY_DEBUG_CHECK (display, VULKAN_VALIDATE) && !validate) + if ((gdk_display_get_debug_flags (display) & GDK_DEBUG_VULKAN_VALIDATE) && !validate) { g_warning ("Vulkan validation layers were requested, but not found. Running without."); } From a337b21a4fdd934e66cb1cc976a62ac578b6e695 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:51:35 -0400 Subject: [PATCH 04/30] Make vulkan-disable always available There is no need to restrict this to debug builds. --- gdk/gdk.c | 2 +- gdk/gdksurface.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 8b7c52769c..73b5371c36 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -127,7 +127,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" }, { "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" }, { "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" }, - { "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" }, + { "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE }, { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE }, { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE }, { "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE }, diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 067267fb1a..239dbb33aa 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -1220,7 +1220,7 @@ gdk_surface_create_vulkan_context (GdkSurface *surface, g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); - if (GDK_DISPLAY_DEBUG_CHECK (surface->display, VULKAN_DISABLE)) + if (gdk_display_get_debug_flags (surface->display) & GDK_DEBUG_VULKAN_DISABLE) { g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE, _("Vulkan support disabled via GDK_DEBUG")); From a99b05525dcc687de924265ea30d9ce8d23db270 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:53:46 -0400 Subject: [PATCH 05/30] Make the nograbs flag always available No need to restrict this to debug builds. --- gdk/gdk.c | 2 +- gdk/x11/gdkdevice-xi2.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 73b5371c36..46abff469f 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -116,7 +116,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "vulkan", GDK_DEBUG_VULKAN, "Information about Vulkan" }, { "selection", GDK_DEBUG_SELECTION, "Information about selections" }, { "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" }, - { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" }, + { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "portals", GDK_DEBUG_PORTALS, "Force the use of portals" }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" }, { "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" }, diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c index a8a0461e20..a068b00929 100644 --- a/gdk/x11/gdkdevice-xi2.c +++ b/gdk/x11/gdkdevice-xi2.c @@ -333,11 +333,9 @@ gdk_x11_device_xi2_grab (GdkDevice *device, event_mask, &mask.mask_len); -#ifdef G_ENABLE_DEBUG - if (GDK_DISPLAY_DEBUG_CHECK (display, NOGRABS)) + if (gdk_display_get_debug_flags (display) & GDK_DEBUG_NOGRABS) status = GrabSuccess; else -#endif status = XIGrabDevice (GDK_DISPLAY_XDISPLAY (display), device_xi2->device_id, xwindow, From fa1c461c13da822da7015673c5f70b2a606b7d33 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:55:46 -0400 Subject: [PATCH 06/30] Make the portals debug flag always available No need to restrict this to debug builds. --- gdk/gdk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 46abff469f..90f3c9ecd5 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -117,7 +117,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "selection", GDK_DEBUG_SELECTION, "Information about selections" }, { "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" }, { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, - { "portals", GDK_DEBUG_PORTALS, "Force the use of portals" }, + { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" }, { "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" }, { "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" }, @@ -361,7 +361,7 @@ gdk_running_in_sandbox (void) gboolean gdk_should_use_portal (void) { - if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS)) + if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_PORTALS) return TRUE; if (gdk_running_in_sandbox ()) From fa0fc9acb864ebf68ff7096b163cd3add37f8860 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 20:57:22 -0400 Subject: [PATCH 07/30] Make the gl-disable flag always available No need to restrict this to debug builds. --- gdk/gdk.c | 2 +- gdk/gdkdisplay.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 90f3c9ecd5..46d02841cc 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -118,7 +118,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" }, { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, - { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" }, + { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, { "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" }, { "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" }, diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index be5e2f5ff1..1f4a6ab0ae 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -1233,7 +1233,7 @@ gdk_display_init_gl (GdkDisplay *self) before = GDK_PROFILER_CURRENT_TIME; - if (GDK_DISPLAY_DEBUG_CHECK (self, GL_DISABLE)) + if (gdk_display_get_debug_flags (self) & GDK_DEBUG_GL_DISABLE) { g_set_error_literal (&priv->gl_error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE, From 1987398ec577a8ff6729e7f7e37bdc1213fbd3bf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:03:40 -0400 Subject: [PATCH 08/30] Drop the software-gl debug flag This was not doing anything. --- gdk/gdk.c | 1 - gdk/gdkdebug.h | 1 - gtk/inspector/visual.c | 43 ----------------------------------------- gtk/inspector/visual.ui | 26 ------------------------- 4 files changed, 71 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 46d02841cc..ed401bdd95 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -119,7 +119,6 @@ static const GdkDebugKey gdk_debug_keys[] = { { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, - { "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" }, { "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" }, { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" }, diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h index 34499edc95..597c4bdfc6 100644 --- a/gdk/gdkdebug.h +++ b/gdk/gdkdebug.h @@ -40,7 +40,6 @@ typedef enum { GDK_DEBUG_NOGRABS = 1 << 11, GDK_DEBUG_PORTALS = 1 << 12, GDK_DEBUG_GL_DISABLE = 1 << 13, - GDK_DEBUG_GL_SOFTWARE = 1 << 14, GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15, GDK_DEBUG_GL_LEGACY = 1 << 16, GDK_DEBUG_GL_GLES = 1 << 17, diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c index 19ac88b4ef..4d1cc9c7cc 100644 --- a/gtk/inspector/visual.c +++ b/gtk/inspector/visual.c @@ -97,7 +97,6 @@ struct _GtkInspectorVisual GtkWidget *misc_box; GtkWidget *touchscreen_switch; - GtkWidget *software_gl_switch; GtkInspectorOverlay *fps_overlay; GtkInspectorOverlay *updates_overlay; @@ -1021,51 +1020,11 @@ row_activated (GtkListBox *box, GtkSwitch *sw = GTK_SWITCH (vis->touchscreen_switch); gtk_switch_set_active (sw, !gtk_switch_get_active (sw)); } - else if (gtk_widget_is_ancestor (vis->software_gl_switch, GTK_WIDGET (row))) - { - GtkSwitch *sw = GTK_SWITCH (vis->software_gl_switch); - gtk_switch_set_active (sw, !gtk_switch_get_active (sw)); - } } static void init_gl (GtkInspectorVisual *vis) { - GdkDebugFlags flags = gdk_display_get_debug_flags (vis->display); - - gtk_switch_set_active (GTK_SWITCH (vis->software_gl_switch), flags & GDK_DEBUG_GL_SOFTWARE); - - if (flags & GDK_DEBUG_GL_DISABLE) - { - GtkWidget *row; - - gtk_widget_set_sensitive (vis->software_gl_switch, FALSE); - row = gtk_widget_get_ancestor (vis->software_gl_switch, GTK_TYPE_LIST_BOX_ROW); - gtk_widget_set_tooltip_text (row, _("GL rendering is disabled")); - } -} - -static void -update_gl_flag (GtkSwitch *sw, - GdkDebugFlags flag, - GtkInspectorVisual *vis) -{ - GdkDebugFlags flags = gdk_display_get_debug_flags (vis->display); - - if (gtk_switch_get_active (sw)) - flags |= flag; - else - flags &= ~flag; - - gdk_display_set_debug_flags (vis->display, flags); -} - -static void -software_gl_activate (GtkSwitch *sw, - GParamSpec *pspec, - GtkInspectorVisual *vis) -{ - update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE, vis); } static void @@ -1170,7 +1129,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, debug_box); gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, font_button); gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, misc_box); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, software_gl_switch); gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, font_scale_entry); gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, font_scale_adjustment); gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, fps_switch); @@ -1187,7 +1145,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass) gtk_widget_class_bind_template_callback (widget_class, baselines_activate); gtk_widget_class_bind_template_callback (widget_class, layout_activate); gtk_widget_class_bind_template_callback (widget_class, focus_activate); - gtk_widget_class_bind_template_callback (widget_class, software_gl_activate); gtk_widget_class_bind_template_callback (widget_class, inspect_inspector); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui index 2915a3685d..e125449bab 100644 --- a/gtk/inspector/visual.ui +++ b/gtk/inspector/visual.ui @@ -668,31 +668,6 @@ - - - - - 40 - - - Software GL - start - baseline - 0.0 - - - - - end - center - 1 - - - - - - - @@ -747,7 +722,6 @@ - From e08a9ea9ada7f701f51d770f7445a65bf6be7b70 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:05:25 -0400 Subject: [PATCH 09/30] Drop the gl-texture-rect debug flag This was not doing anything. --- gdk/gdk.c | 1 - gdk/gdkdebug.h | 1 - 2 files changed, 2 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index ed401bdd95..f35f1ea8cf 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -119,7 +119,6 @@ static const GdkDebugKey gdk_debug_keys[] = { { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, - { "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" }, { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" }, { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" }, diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h index 597c4bdfc6..8b185bf3d3 100644 --- a/gdk/gdkdebug.h +++ b/gdk/gdkdebug.h @@ -40,7 +40,6 @@ typedef enum { GDK_DEBUG_NOGRABS = 1 << 11, GDK_DEBUG_PORTALS = 1 << 12, GDK_DEBUG_GL_DISABLE = 1 << 13, - GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15, GDK_DEBUG_GL_LEGACY = 1 << 16, GDK_DEBUG_GL_GLES = 1 << 17, GDK_DEBUG_GL_DEBUG = 1 << 18, From 8bd3ec2ba1c3d44d29c6c3a96871199756ba0ae9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:09:08 -0400 Subject: [PATCH 10/30] Make the gl-legacy debug flag always available No need to restrict this to debug builds. --- gdk/gdk.c | 2 +- gdk/gdkglcontext.c | 4 ++-- gdk/win32/gdkglcontext-win32-wgl.c | 6 +++--- gdk/x11/gdkglcontext-glx.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index f35f1ea8cf..637f76fb6a 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -119,7 +119,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, - { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" }, + { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE }, { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" }, { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" }, { "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" }, diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 3f22c00065..001addb622 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -395,8 +395,8 @@ gdk_gl_context_realize_egl (GdkGLContext *context, return 0; } - prefer_legacy = (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) || - (share != NULL && gdk_gl_context_is_legacy (share))); + prefer_legacy = (gdk_display_get_debug_flags(display) & GDK_DEBUG_GL_LEGACY) || + (share != NULL && gdk_gl_context_is_legacy (share)); if (preferred_api == GDK_GL_API_GL) { diff --git a/gdk/win32/gdkglcontext-win32-wgl.c b/gdk/win32/gdkglcontext-win32-wgl.c index d7ff4367f2..4fe04828ff 100644 --- a/gdk/win32/gdkglcontext-win32-wgl.c +++ b/gdk/win32/gdkglcontext-win32-wgl.c @@ -564,9 +564,9 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context, * A legacy context cannot be shared with core profile ones, so this means we * must stick to a legacy context if the shared context is a legacy context */ - legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ? - TRUE : - share != NULL && gdk_gl_context_is_legacy (share); + legacy_bit = (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_LEGACY) + ? TRUE + : share != NULL && gdk_gl_context_is_legacy (share); if (!set_wgl_pixformat_for_hdc (hdc, &pixel_format, diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c index d9e60bd747..2033e42902 100644 --- a/gdk/x11/gdkglcontext-glx.c +++ b/gdk/x11/gdkglcontext-glx.c @@ -609,7 +609,7 @@ gdk_x11_gl_context_glx_realize (GdkGLContext *context, /* If there is no glXCreateContextAttribsARB() then we default to legacy */ legacy = !GDK_X11_DISPLAY (display)->has_glx_create_context; - if (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY)) + if (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_LEGACY) legacy = TRUE; /* We cannot share legacy contexts with core profile ones, so the From 01054c9c79bc11eb10fdb1b14e47fb798ca3ce68 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:12:22 -0400 Subject: [PATCH 11/30] Make the gl-gles debug flag always available No need to restrict this to debug builds. --- gdk/gdk.c | 2 +- gdk/gdkglcontext.c | 2 +- gdk/win32/gdkdisplay-win32.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 637f76fb6a..cc2a81f1d4 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -120,7 +120,7 @@ static const GdkDebugKey gdk_debug_keys[] = { { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE }, - { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" }, + { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE }, { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" }, { "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" }, { "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" }, diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 001addb622..0452640244 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -1265,7 +1265,7 @@ gdk_gl_context_is_api_allowed (GdkGLContext *self, { GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self); - if (GDK_DISPLAY_DEBUG_CHECK (gdk_gl_context_get_display (self), GL_GLES)) + if (gdk_display_get_debug_flags (gdk_gl_context_get_display (self)) & GDK_DEBUG_GL_GLES) { if (!(api & GDK_GL_API_GLES)) { diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index fa4cfcd2d4..5c53f247c2 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1197,7 +1197,7 @@ gdk_win32_display_init_gl (GdkDisplay *display, * Disable defaulting to EGL as EGL is used more as a compatibility layer * on Windows rather than being a native citizen on Windows */ - if (GDK_DEBUG_CHECK (GL_EGL) || GDK_DEBUG_CHECK (GL_GLES)) + if (gdk_display_get_debug_flags (display) & (GDK_DEBUG_GL_EGL|GDK_DEBUG_GL_GLES)) { if (gdk_display_init_egl (display, EGL_PLATFORM_ANGLE_ANGLE, From f50b0a0bcbfd3bad3677561f18c28c6ff4ccdeaa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:17:16 -0400 Subject: [PATCH 12/30] Make the gl-debug debug flag always available No need to restrict this to debug builds. --- gdk/gdk.c | 2 +- gdk/gdkglcontext.c | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index cc2a81f1d4..d4045fea5c 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -119,9 +119,9 @@ static const GdkDebugKey gdk_debug_keys[] = { { "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE }, { "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE }, { "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE }, + { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE }, { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE }, - { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" }, { "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" }, { "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" }, { "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" }, diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 0452640244..ac0353a029 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -1485,9 +1485,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context) { GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); gboolean gl_debug = FALSE; -#ifdef G_ENABLE_DEBUG GdkDisplay *display; -#endif if (!gdk_gl_context_is_realized (context)) return; @@ -1500,16 +1498,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context) priv->has_debug_output = epoxy_has_gl_extension ("GL_ARB_debug_output") || epoxy_has_gl_extension ("GL_KHR_debug"); -#ifdef G_ENABLE_DEBUG display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)); - gl_debug = GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG); -#endif + gl_debug = (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_DEBUG) != 0; - if (priv->has_debug_output -#ifndef G_ENABLE_CONSISTENCY_CHECKS - && gl_debug -#endif - ) + if (priv->has_debug_output && gl_debug) { gdk_gl_context_make_current (context); glEnable (GL_DEBUG_OUTPUT); From 55ab99cb98f7ce305b6f575acf1d40a9b663270a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:28:47 -0400 Subject: [PATCH 13/30] Make GL flavor flags always available No need to restrict this to debug builds. --- gdk/gdk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index d4045fea5c..2550c0f294 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -122,9 +122,9 @@ static const GdkDebugKey gdk_debug_keys[] = { { "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE }, { "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE }, { "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE }, - { "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" }, - { "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" }, - { "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" }, + { "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows", TRUE }, + { "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11", TRUE }, + { "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows", TRUE }, { "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE }, { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE }, { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE }, @@ -296,11 +296,11 @@ gdk_pre_parse (void) G_N_ELEMENTS (gdk_debug_keys)); /* These are global */ - if (GDK_DEBUG_CHECK (GL_EGL)) + if (_gdk_debug_flags & GDK_DEBUG_GL_EGL) gdk_gl_backend_use (GDK_GL_EGL); - else if (GDK_DEBUG_CHECK (GL_GLX)) + else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX) gdk_gl_backend_use (GDK_GL_GLX); - else if (GDK_DEBUG_CHECK (GL_WGL)) + else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL) gdk_gl_backend_use (GDK_GL_WGL); #ifndef G_HAS_CONSTRUCTORS From ee1a634c255992190672d1f29c48d23d5cfda8d8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:47:06 -0400 Subject: [PATCH 14/30] Mark the invert-text-dir flag as always there This flag works in non-debug builds too. --- gtk/gtkmain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index ed161d29b7..ca351e0b96 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -95,10 +95,12 @@ typedef struct { #define N_DEBUG_DISPLAYS 4 DisplayDebugFlags debug_flags[N_DEBUG_DISPLAYS]; + /* This is a flag to speed up development builds. We set it to TRUE when * any of the debug displays has debug flags >0, but we never set it back * to FALSE. This way we don't need to call gtk_widget_get_display() in - * hot paths. */ + * hot paths. + */ gboolean any_display_debug_flags_set = FALSE; GtkDebugFlags @@ -203,7 +205,7 @@ static const GdkDebugKey gtk_debug_keys[] = { { "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" }, { "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" }, { "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" }, - { "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction" }, + { "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction", TRUE }, }; /* This checks to see if the process is running suid or sgid From c7a7e550dc4dfb5656ef9d5340eacd9a960a3d7c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:51:58 -0400 Subject: [PATCH 15/30] Only print supported debug flags It is a bit disorienting to print a lot of unavailable debug flags, with some working ones mixed in. Just show the ones that work. --- gdk/gdk.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index 2550c0f294..2c145a0898 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -256,16 +256,12 @@ gdk_parse_debug_var (const char *variable, fprintf (stderr, "Supported %s values:\n", variable); for (i = 0; i < nkeys; i++) { - fprintf (stderr, " %s%*s%s", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help); - if (!debug_enabled && !keys[i].always_enabled) - fprintf (stderr, " [unavailable]"); - fprintf (stderr, "\n"); + if (debug_enabled || keys[i].always_enabled) + fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help); } fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values"); fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help"); fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n"); - if (!debug_enabled) - fprintf (stderr, "Values marked as [unavailable] are only accessible if GTK is built with G_ENABLE_DEBUG.\n"); } if (invert) From 6c95547c3fa0ae66356c6a849041e863b09e8c40 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Sep 2022 21:59:33 -0400 Subject: [PATCH 16/30] docs: Some updates Make the section about environment variables match current code. Add a warning about env vars not being stable and only for debugging. --- docs/reference/gtk/running.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/docs/reference/gtk/running.md b/docs/reference/gtk/running.md index fd6f3d235d..01a53f5ce4 100644 --- a/docs/reference/gtk/running.md +++ b/docs/reference/gtk/running.md @@ -10,6 +10,10 @@ to determine paths to look for certain files. The [X11](#x11-envar), [Broadway](#broadway-envar) GDK backends use some additional environment variables. +Note that environment variables are generally used for debugging +purposes. They are not guaranteed to be API stable, and should not +be used for end-user configuration and customization. + ### `GTK_DEBUG` This variable can be set to a list of debug options, which cause GTK to @@ -75,6 +79,9 @@ A number of keys are influencing behavior instead of just logging: `snapshot` : Include debug render nodes in the generated snapshots +`invert-text-dir` +: Invert the text direction, compared to the locale + The special value `all` can be used to turn on all debug options. The special value `help` can be used to obtain a list of all supported debug options. @@ -205,24 +212,33 @@ A number of options affect behavior instead of logging: `gl-disable` : Disable OpenGL support -`gl-software` -: Force OpenGL software rendering - -`gl-texture-rect` -: Use the OpenGL texture rectangle extension, if available - `gl-legacy` : Use a legacy OpenGL context `gl-gles` : Use a GLES OpenGL context +`gl-egl` +: Use an EGL context on X11 or Windows + +`gl-glx` +: Use GLX on X11 + +`gl-wgl` +: Use WGL on Windows + `vulkan-disable` : Disable Vulkan support `vulkan-validate` : Load the Vulkan validation layer, if available +`default-settings` +: Force default values for xsettings + +`high-depth` +: Use high bit depth rendering if possible + The special value `all` can be used to turn on all debug options. The special value `help` can be used to obtain a list of all supported debug options. From 10255eee722634d5b85df757687d9fe7a4ca2b91 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 20:47:09 -0400 Subject: [PATCH 17/30] Introduce new debug macros Introduce GDK_DISPLAY_DEBUG() and GDK_DEBUG() and the helper function gdk_debug_message(). This is meant to clean up the mess of our current debug statements which wildly mix g_message, g_print and g_printerr. --- gdk/gdk.c | 1 + gdk/gdkdebug.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/gdk/gdk.c b/gdk/gdk.c index 2c145a0898..babb4298ac 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -34,6 +34,7 @@ #include "gdkglcontextprivate.h" #include "gdkintl.h" #include "gdk-private.h" +#include #include #include diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h index 8b185bf3d3..45519a1b4d 100644 --- a/gdk/gdkdebug.h +++ b/gdk/gdkdebug.h @@ -21,6 +21,7 @@ #include #include "gdktypes.h" +#include G_BEGIN_DECLS @@ -58,6 +59,8 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display); void gdk_display_set_debug_flags (GdkDisplay *display, GdkDebugFlags flags); +#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__) + #ifdef G_ENABLE_DEBUG #define GDK_DISPLAY_DEBUG_CHECK(display,type) \ @@ -66,14 +69,20 @@ void gdk_display_set_debug_flags (GdkDisplay *display, if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ { action; }; } G_STMT_END +#define GDK_DISPLAY_DEBUG(display,type,...) \ + if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ + gdk_debug_message (__VA_ARGS__); \ + #else /* !G_ENABLE_DEBUG */ #define GDK_DISPLAY_DEBUG_CHECK(display,type) 0 #define GDK_DISPLAY_NOTE(display,type,action) +#define GDK_DISPLAY_DEBUG(display,type,...) #endif /* G_ENABLE_DEBUG */ #define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type) #define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action) +#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__) #endif From 1d48f96fc5c7fc6e9380fb25b6dac993b110e9a6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 20:48:58 -0400 Subject: [PATCH 18/30] gdk: Use the new debug macros --- gdk/gdkdisplay.c | 35 +++++++++++++----------- gdk/gdkdisplaymanager.c | 2 +- gdk/gdkevents.c | 15 ++++++----- gdk/gdkglcontext.c | 50 +++++++++++++++++------------------ gdk/gdkvulkancontext.c | 6 ++--- gdk/gdkvulkancontextprivate.h | 4 +-- 6 files changed, 59 insertions(+), 53 deletions(-) diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 1f4a6ab0ae..4e25150bfa 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -1729,28 +1729,31 @@ gdk_display_init_egl (GdkDisplay *self, if (priv->egl_config_high_depth == NULL) priv->egl_config_high_depth = priv->egl_config; - GDK_DISPLAY_NOTE (self, OPENGL, { +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL)) + { char *ext = describe_extensions (priv->egl_display); char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config); char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth); - g_message ("EGL API version %d.%d found\n" - " - Vendor: %s\n" - " - Version: %s\n" - " - Client APIs: %s\n" - " - Extensions:\n" - "\t%s\n" - " - Selected fbconfig: %s\n" - " high depth: %s", - major, minor, - eglQueryString (priv->egl_display, EGL_VENDOR), - eglQueryString (priv->egl_display, EGL_VERSION), - eglQueryString (priv->egl_display, EGL_CLIENT_APIS), - ext, std_cfg, - priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg); + gdk_debug_message ("EGL API version %d.%d found\n" + " - Vendor: %s\n" + " - Version: %s\n" + " - Client APIs: %s\n" + " - Extensions:\n" + "\t%s\n" + " - Selected fbconfig: %s\n" + " high depth: %s", + major, minor, + eglQueryString (priv->egl_display, EGL_VENDOR), + eglQueryString (priv->egl_display, EGL_VERSION), + eglQueryString (priv->egl_display, EGL_CLIENT_APIS), + ext, std_cfg, + priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg); g_free (hd_cfg); g_free (std_cfg); g_free (ext); - }); + } +#endif gdk_profiler_end_mark (start_time, "init EGL", NULL); diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c index 040e6b3124..cac1e9dca4 100644 --- a/gdk/gdkdisplaymanager.c +++ b/gdk/gdkdisplaymanager.c @@ -420,7 +420,7 @@ gdk_display_manager_open_display (GdkDisplayManager *manager, (any && strstr (allowed_backends, gdk_backends[j].name)) || g_str_equal (backend, gdk_backends[j].name)) { - GDK_NOTE (MISC, g_message ("Trying %s backend", gdk_backends[j].name)); + GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name); display = gdk_backends[j].open_display (name); if (display) break; diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 0daf475c3f..747a187f9c 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -402,12 +402,15 @@ gdk_event_alloc (GdkEventType event_type, GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]); - GDK_NOTE (EVENTS, { - char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type); - g_message ("Allocating a new %s for event type %s", - g_type_name (gdk_event_types[event_type]), str); - g_free (str); - }); +#ifdef G_ENABLE_DEBUG + if (GDK_DEBUG_CHECK (EVENTS)) + { + char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type); + gdk_debug_message ("Allocating a new %s for event type %s", + g_type_name (gdk_event_types[event_type]), str); + g_free (str); + } +#endif event->event_type = event_type; event->surface = surface != NULL ? g_object_ref (surface) : NULL; diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index ac0353a029..e587a67b2e 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -193,7 +193,7 @@ gdk_gl_context_dispose (GObject *gobject) if (eglGetCurrentContext () == priv->egl_context) eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying EGL context")); + GDK_DISPLAY_DEBUG (display, OPENGL, "Destroying EGL context"); eglDestroyContext (egl_display, priv->egl_context); priv->egl_context = NULL; @@ -339,13 +339,13 @@ gdk_gl_context_create_egl_context (GdkGLContext *context, context_attribs[i++] = EGL_NONE; g_assert (i < N_EGL_ATTRS); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)", - major, minor, - debug_bit ? "yes" : "no", - forward_bit ? "yes" : "no", - legacy ? "yes" : "no", - api == GDK_GL_API_GLES ? "yes" : "no")); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)", + major, minor, + debug_bit ? "yes" : "no", + forward_bit ? "yes" : "no", + legacy ? "yes" : "no", + api == GDK_GL_API_GLES ? "yes" : "no"); ctx = eglCreateContext (egl_display, egl_config, @@ -355,7 +355,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context, if (ctx == NULL) return 0; - GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Created EGL context[%p]", ctx); priv->egl_context = ctx; gdk_gl_context_set_is_legacy (context, legacy); @@ -1533,20 +1533,20 @@ gdk_gl_context_check_extensions (GdkGLContext *context) priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) || epoxy_has_gl_extension ("OES_vertex_half_float"); - GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL, - g_message ("%s version: %d.%d (%s)\n" - "* GLSL version: %s\n" - "* Extensions checked:\n" - " - GL_KHR_debug: %s\n" - " - GL_EXT_unpack_subimage: %s\n" - " - OES_vertex_half_float: %s", - gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL", - priv->gl_version / 10, priv->gl_version % 10, - priv->is_legacy ? "legacy" : "core", - glGetString (GL_SHADING_LANGUAGE_VERSION), - priv->has_khr_debug ? "yes" : "no", - priv->has_unpack_subimage ? "yes" : "no", - priv->has_half_float ? "yes" : "no")); + GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL, + "%s version: %d.%d (%s)\n" + "* GLSL version: %s\n" + "* Extensions checked:\n" + " - GL_KHR_debug: %s\n" + " - GL_EXT_unpack_subimage: %s\n" + " - OES_vertex_half_float: %s", + gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL", + priv->gl_version / 10, priv->gl_version % 10, + priv->is_legacy ? "legacy" : "core", + glGetString (GL_SHADING_LANGUAGE_VERSION), + priv->has_khr_debug ? "yes" : "no", + priv->has_unpack_subimage ? "yes" : "no", + priv->has_half_float ? "yes" : "no"); priv->extensions_checked = TRUE; } @@ -1836,8 +1836,8 @@ gdk_gl_backend_use (GdkGLBackend backend_type) the_gl_backend_type = backend_type; /* This is important!!!11eleven * (But really: How do I print a message in 2 categories?) */ - GDK_NOTE (OPENGL, g_print ("Using OpenGL backend %s\n", gl_backend_names[the_gl_backend_type])); - GDK_NOTE (MISC, g_message ("Using Opengl backend %s", gl_backend_names[the_gl_backend_type])); + GDK_DEBUG (OPENGL, "Using OpenGL backend %s", gl_backend_names[the_gl_backend_type]); + GDK_DEBUG (MISC, "Using OpenGL backend %s", gl_backend_names[the_gl_backend_type]); } g_assert (the_gl_backend_type == backend_type); diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index b3549a9413..c5756dc198 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -309,8 +309,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context, } else { - GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), - VULKAN, g_warning ("Vulkan swapchain doesn't do transparency. Using opaque swapchain instead.")); + GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), VULKAN, + "Vulkan swapchain doesn't do transparency. Using opaque swapchain instead."); composite_alpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; } @@ -950,7 +950,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display, if (has_incremental_present) g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME); - GDK_DISPLAY_NOTE (display, VULKAN, g_print ("Using Vulkan device %u, queue %u\n", i, j)); + GDK_DISPLAY_DEBUG (display, VULKAN, "Using Vulkan device %u, queue %u", i, j); if (GDK_VK_CHECK (vkCreateDevice, devices[i], &(VkDeviceCreateInfo) { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, diff --git a/gdk/gdkvulkancontextprivate.h b/gdk/gdkvulkancontextprivate.h index 4a863d43f7..f18acf84f6 100644 --- a/gdk/gdkvulkancontextprivate.h +++ b/gdk/gdkvulkancontextprivate.h @@ -62,7 +62,7 @@ gdk_vulkan_handle_result (VkResult res, { if (res != VK_SUCCESS) { - GDK_NOTE (VULKAN, g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res)); + GDK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res); } return res; @@ -81,7 +81,7 @@ static inline gboolean gdk_display_ref_vulkan (GdkDisplay *display, GError **error) { - GDK_DISPLAY_NOTE (display, VULKAN, g_message ("Support for Vulkan disabled at compile-time")); + GDK_DISPLAY_DEBUG (display, VULKAN, "Support for Vulkan disabled at compile-time"); g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED, "Vulkan support was not enabled at compile time."); From 90c2b548e588d1c92f7f4984a6b3d6e5b95f3af3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 20:49:16 -0400 Subject: [PATCH 19/30] broadway: Use the new debug macros --- gdk/broadway/gdkdisplay-broadway.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index fcf7db820b..1f82ef46d7 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -213,7 +213,7 @@ _gdk_broadway_display_open (const char *display_name) broadway_display->server = _gdk_broadway_server_new (display, display_name, &error); if (broadway_display->server == NULL) { - GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message)); + GDK_DEBUG (MISC, "Unable to init Broadway server: %s", error->message); g_error_free (error); return NULL; } From 71fedee85d47cfeed63e3223f44dd5da7c26b35b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 20:50:05 -0400 Subject: [PATCH 20/30] wayland: Use the new debug macros --- gdk/wayland/gdkclipboard-wayland.c | 51 ++-- gdk/wayland/gdkdevice-wayland.c | 359 +++++++++++++++-------------- gdk/wayland/gdkdisplay-wayland.c | 96 ++++---- gdk/wayland/gdkdrag-wayland.c | 36 +-- gdk/wayland/gdkdrop-wayland.c | 11 +- gdk/wayland/gdkkeys-wayland.c | 36 +-- gdk/wayland/gdkprimary-wayland.c | 52 +++-- gdk/wayland/gdksurface-wayland.c | 35 ++- 8 files changed, 362 insertions(+), 314 deletions(-) diff --git a/gdk/wayland/gdkclipboard-wayland.c b/gdk/wayland/gdkclipboard-wayland.c index 46d90d9ea4..2cca02e499 100644 --- a/gdk/wayland/gdkclipboard-wayland.c +++ b/gdk/wayland/gdkclipboard-wayland.c @@ -77,7 +77,8 @@ gdk_wayland_clipboard_data_source_target (void *data, struct wl_data_source *source, const char *mime_type) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: Huh? data_source.target() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.target() events?", data); } static void @@ -89,7 +90,8 @@ gdk_wayland_clipboard_write_done (GObject *clipboard, if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error)) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, g_message ("%p: failed to write stream: %s", clipboard, error->message)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, + "%p: failed to write stream: %s", clipboard, error->message); g_error_free (error); } } @@ -103,8 +105,9 @@ gdk_wayland_clipboard_data_source_send (void *data, GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (data); GOutputStream *stream; - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: data source send request for %s on fd %d", - source, mime_type, fd)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: data source send request for %s on fd %d", + source, mime_type, fd); mime_type = gdk_intern_mime_type (mime_type); stream = g_unix_output_stream_new (fd, TRUE); @@ -125,7 +128,8 @@ gdk_wayland_clipboard_data_source_cancelled (void *data, { GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (data); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: data source cancelled", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: data source cancelled", data); if (cb->source == source) { @@ -138,16 +142,16 @@ static void gdk_wayland_clipboard_data_source_dnd_drop_performed (void *data, struct wl_data_source *source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), - CLIPBOARD, g_message ("%p: Huh? data_source.dnd_drop_performed() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.dnd_drop_performed() events?", data); } static void gdk_wayland_clipboard_data_source_dnd_finished (void *data, struct wl_data_source *source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), - CLIPBOARD, g_message ("%p: Huh? data_source.dnd_finished() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.dnd_finished() events?", data); } static void @@ -155,8 +159,8 @@ gdk_wayland_clipboard_data_source_action (void *data, struct wl_data_source *source, uint32_t action) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), - CLIPBOARD, g_message ("%p: Huh? data_source.action() events?", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: Huh? data_source.action() events?", data); } static const struct wl_data_source_listener data_source_listener = { @@ -221,9 +225,14 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard, g_task_set_priority (task, io_priority); g_task_set_source_tag (task, gdk_wayland_clipboard_read_async); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: read for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: read for %s", cb, s); + g_free (s); + } +#endif mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats); if (mime_type == NULL) { @@ -305,16 +314,22 @@ gdk_wayland_clipboard_claim_remote (GdkWaylandClipboard *cb, if (cb->source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_message ("%p: Ignoring clipboard offer for self", cb)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, + "%p: Ignoring clipboard offer for self", cb); gdk_content_formats_unref (formats); return; } gdk_wayland_clipboard_discard_offer (cb); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: remote clipboard claim for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: remote clipboard claim for %s", cb, s); + g_free (s); + } +#endif cb->offer_formats = formats; cb->offer = offer; diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 1cea5ab1ea..1e7bf8531f 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -83,7 +83,7 @@ #define BTN_STYLUS3 0x149 /* Linux 4.15 */ #endif -#define GDK_SEAT_NOTE(seat,type,action) GDK_DISPLAY_NOTE(gdk_seat_get_display (GDK_SEAT (seat)),type,action) +#define GDK_SEAT_DEBUG(seat,type,...) GDK_DISPLAY_DEBUG(gdk_seat_get_display (GDK_SEAT (seat)),type,__VA_ARGS__) typedef struct _GdkWaylandDevicePad GdkWaylandDevicePad; typedef struct _GdkWaylandDevicePadClass GdkWaylandDevicePadClass; @@ -1104,9 +1104,9 @@ data_offer_offer (void *data, if (seat->pending_offer != offer) { - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("%p: offer for unknown offer %p of %s", - seat, offer, type)); + GDK_SEAT_DEBUG (seat, EVENTS, + "%p: offer for unknown offer %p of %s", + seat, offer, type); return; } @@ -1180,9 +1180,9 @@ data_device_data_offer (void *data, { GdkWaylandSeat *seat = data; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device data offer, data device %p, offer %p", - data_device, offer)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device data offer, data device %p, offer %p", + data_device, offer); gdk_wayland_seat_discard_pending_offer (seat); @@ -1218,15 +1218,15 @@ data_device_enter (void *data, if (offer != seat->pending_offer) { - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("%p: enter event for unknown offer %p, expected %p", - seat, offer, seat->pending_offer)); + GDK_SEAT_DEBUG (seat, EVENTS, + "%p: enter event for unknown offer %p, expected %p", + seat, offer, seat->pending_offer); return; } - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device enter, data device %p serial %u, surface %p, x %f y %f, offer %p", - data_device, serial, surface, wl_fixed_to_double (x), wl_fixed_to_double (y), offer)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device enter, data device %p serial %u, surface %p, x %f y %f, offer %p", + data_device, serial, surface, wl_fixed_to_double (x), wl_fixed_to_double (y), offer); /* Update pointer state, so device state queries work during DnD */ seat->pointer_info.focus = g_object_ref (dest_surface); @@ -1270,8 +1270,8 @@ data_device_leave (void *data, { GdkWaylandSeat *seat = data; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device leave, data device %p", data_device)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device leave, data device %p", data_device); if (seat->drop == NULL) return; @@ -1296,9 +1296,9 @@ data_device_motion (void *data, GdkWaylandSeat *seat = data; int origin_x, origin_y; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f", - data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y))); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device motion, data_device = %p, time = %d, x = %f, y = %f", + data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y)); if (seat->drop == NULL) return; @@ -1323,8 +1323,8 @@ data_device_drop (void *data, GdkWaylandSeat *seat = data; int origin_x, origin_y; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("data device drop, data device %p", data_device)); + GDK_SEAT_DEBUG (seat, EVENTS, + "data device drop, data device %p", data_device); gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y); @@ -1561,9 +1561,9 @@ pointer_handle_enter (void *data, gdk_wayland_device_update_surface_cursor (seat->logical_pointer); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("enter, seat %p surface %p", - seat, seat->pointer_info.focus)); + GDK_SEAT_DEBUG (seat, EVENTS, + "enter, seat %p surface %p", + seat, seat->pointer_info.focus); if (display_wayland->seat_version < WL_POINTER_HAS_FRAME) gdk_wayland_seat_flush_frame_event (seat); @@ -1612,9 +1612,9 @@ pointer_handle_leave (void *data, gdk_wayland_device_update_surface_cursor (seat->logical_pointer); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("leave, seat %p surface %p", - seat, seat->pointer_info.focus)); + GDK_SEAT_DEBUG (seat, EVENTS, + "leave, seat %p surface %p", + seat, seat->pointer_info.focus); g_object_unref (seat->pointer_info.focus); seat->pointer_info.focus = NULL; @@ -1722,12 +1722,12 @@ pointer_handle_button (void *data, else seat->pointer_info.button_modifiers &= ~modifier; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("button %d %s, seat %p state %d", - gdk_button_event_get_button (event), - state ? "press" : "release", - seat, - gdk_event_get_modifier_state (event))); + GDK_SEAT_DEBUG (seat, EVENTS, + "button %d %s, seat %p state %d", + gdk_button_event_get_button (event), + state ? "press" : "release", + seat, + gdk_event_get_modifier_state (event)); if (display->seat_version < WL_POINTER_HAS_FRAME) gdk_wayland_seat_flush_frame_event (seat); @@ -1780,10 +1780,10 @@ pointer_handle_axis (void *data, seat->pointer_info.time = time; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("scroll, axis %s, value %f, seat %p", - get_axis_name (axis), wl_fixed_to_double (value), - seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "scroll, axis %s, value %f, seat %p", + get_axis_name (axis), wl_fixed_to_double (value), + seat); if (display->seat_version < WL_POINTER_HAS_FRAME) gdk_wayland_seat_flush_frame_event (seat); @@ -1795,8 +1795,7 @@ pointer_handle_frame (void *data, { GdkWaylandSeat *seat = data; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("frame, seat %p", seat)); + GDK_SEAT_DEBUG (seat, EVENTS, "frame, seat %p", seat); gdk_wayland_seat_flush_frame_event (seat); } @@ -1836,8 +1835,8 @@ pointer_handle_axis_source (void *data, pointer_frame->source = source; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("axis source %s, seat %p", get_axis_source_name (source), seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "axis source %s, seat %p", get_axis_source_name (source), seat); } static void @@ -1868,8 +1867,8 @@ pointer_handle_axis_stop (void *data, pointer_frame->is_scroll_stop = TRUE; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("axis %s stop, seat %p", get_axis_name (axis), seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "axis %s stop, seat %p", get_axis_name (axis), seat); } static void @@ -1896,9 +1895,9 @@ pointer_handle_axis_discrete (void *data, g_return_if_reached (); } - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("discrete scroll, axis %s, value %d, seat %p", - get_axis_name (axis), value, seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "discrete scroll, axis %s, value %d, seat %p", + get_axis_name (axis), value, seat); } static void @@ -1925,9 +1924,9 @@ pointer_handle_axis_value120 (void *data, g_return_if_reached (); } - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("value120 scroll, axis %s, value %d, seat %p", - get_axis_name (axis), value, seat)); + GDK_SEAT_DEBUG (seat, EVENTS, + "value120 scroll, axis %s, value %d, seat %p", + get_axis_name (axis), value, seat); } static int @@ -1984,7 +1983,8 @@ keyboard_handle_keymap (void *data, _gdk_wayland_keymap_update_from_fd (seat->keymap, format, fd, size); - GDK_DISPLAY_NOTE(seat->keymap->display, INPUT, +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (seat->keymap->display, INPUT)) { GString *s = g_string_new (""); struct xkb_keymap *xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (seat->keymap); @@ -1997,9 +1997,10 @@ keyboard_handle_keymap (void *data, g_string_append (s, "*"); g_string_append (s, xkb_keymap_layout_get_name (xkb_keymap, i)); } - g_print ("layouts: %s\n", s->str); + gdk_debug_message ("layouts: %s", s->str); g_string_free (s, TRUE); - }); + } +#endif g_signal_emit_by_name (seat->keymap, "keys-changed"); g_signal_emit_by_name (seat->keymap, "state-changed"); @@ -2044,9 +2045,9 @@ keyboard_handle_enter (void *data, seat->logical_keyboard, TRUE); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("focus in, seat %p surface %p", - seat, seat->keyboard_focus)); + GDK_SEAT_DEBUG (seat, EVENTS, + "focus in, seat %p surface %p", + seat, seat->keyboard_focus); _gdk_wayland_display_deliver_event (seat->display, event); } @@ -2080,9 +2081,9 @@ keyboard_handle_leave (void *data, seat->repeat_key = 0; seat->key_modifiers = 0; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("focus out, seat %p surface %p", - seat, gdk_event_get_surface (event))); + GDK_SEAT_DEBUG (seat, EVENTS, + "focus out, seat %p surface %p", + seat, gdk_event_get_surface (event)); _gdk_wayland_display_deliver_event (seat->display, event); } @@ -2208,18 +2209,18 @@ deliver_key_event (GdkWaylandSeat *seat, _gdk_wayland_display_deliver_event (seat->display, event); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("keyboard %s event%s, surface %p, code %d, sym %d, " - "mods 0x%x, consumed 0x%x, layout %d level %d", - (state ? "press" : "release"), - (from_key_repeat ? " (repeat)" : ""), - gdk_event_get_surface (event), - gdk_key_event_get_keycode (event), - gdk_key_event_get_keyval (event), - gdk_event_get_modifier_state (event), - gdk_key_event_get_consumed_modifiers (event), - gdk_key_event_get_layout (event), - gdk_key_event_get_level (event))); + GDK_SEAT_DEBUG (seat, EVENTS, + "keyboard %s event%s, surface %p, code %d, sym %d, " + "mods 0x%x, consumed 0x%x, layout %d level %d", + (state ? "press" : "release"), + (from_key_repeat ? " (repeat)" : ""), + gdk_event_get_surface (event), + gdk_key_event_get_keycode (event), + gdk_key_event_get_keyval (event), + gdk_event_get_modifier_state (event), + gdk_key_event_get_consumed_modifiers (event), + gdk_key_event_get_layout (event), + gdk_key_event_get_level (event)); if (!xkb_keymap_key_repeats (xkb_keymap, key)) return; @@ -2373,7 +2374,7 @@ keyboard_handle_modifiers (void *data, g_signal_emit_by_name (keymap, "state-changed"); if (layout != get_active_layout (keymap)) { - GDK_DISPLAY_NOTE(keymap->display, INPUT, g_print ("active layout now: %s\n", get_active_layout_name (keymap))); + GDK_DISPLAY_DEBUG (keymap->display, INPUT, "active layout now: %s", get_active_layout_name (keymap)); g_signal_emit_by_name (keymap, "keys-changed"); } @@ -2663,7 +2664,7 @@ touch_handle_cancel (void *data, g_hash_table_iter_remove (&iter); } - GDK_SEAT_NOTE (seat, EVENTS, g_message ("touch cancel")); + GDK_SEAT_DEBUG (seat, EVENTS, "touch cancel"); } static void @@ -3179,11 +3180,11 @@ seat_handle_capabilities (void *data, GdkWaylandSeat *seat = data; GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display); - GDK_SEAT_NOTE (seat, MISC, - g_message ("seat %p with %s%s%s", wl_seat, - (caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "", - (caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "", - (caps & WL_SEAT_CAPABILITY_TOUCH) ? " touch" : "")); + GDK_SEAT_DEBUG (seat, MISC, + "seat %p with %s%s%s", wl_seat, + (caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "", + (caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "", + (caps & WL_SEAT_CAPABILITY_TOUCH) ? " touch" : ""); if ((caps & WL_SEAT_CAPABILITY_POINTER) && !seat->wl_pointer) { @@ -3401,8 +3402,8 @@ seat_handle_name (void *data, const char *name) { /* We don't care about the name. */ - GDK_SEAT_NOTE (GDK_WAYLAND_SEAT (data), MISC, - g_message ("seat %p name %s", seat, name)); + GDK_SEAT_DEBUG (GDK_WAYLAND_SEAT (data), MISC, + "seat %p name %s", seat, name); } static const struct wl_seat_listener seat_listener = { @@ -3683,10 +3684,10 @@ tablet_tool_handle_proximity_in (void *data, gdk_wayland_surface_get_wl_output (surface)); pointer_surface_update_scale (tablet->logical_device); - GDK_SEAT_NOTE (tablet->seat, EVENTS, - g_message ("proximity in, seat %p surface %p tool %d", - tablet->seat, tablet->pointer_info.focus, - gdk_device_tool_get_tool_type (tool->tool))); + GDK_SEAT_DEBUG (tablet->seat, EVENTS, + "proximity in, seat %p surface %p tool %d", + tablet->seat, tablet->pointer_info.focus, + gdk_device_tool_get_tool_type (tool->tool)); } static void @@ -3700,9 +3701,9 @@ tablet_tool_handle_proximity_out (void *data, if (!tablet) return; - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("proximity out, seat %p, tool %d", tool->seat, - gdk_device_tool_get_tool_type (tool->tool))); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "proximity out, seat %p, tool %d", tool->seat, + gdk_device_tool_get_tool_type (tool->tool)); event = gdk_proximity_event_new (GDK_PROXIMITY_OUT, tablet->pointer_info.focus, @@ -3802,10 +3803,10 @@ tablet_tool_handle_motion (void *data, tablet->pointer_info.surface_x = wl_fixed_to_double (sx); tablet->pointer_info.surface_y = wl_fixed_to_double (sy); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet motion %f %f", - tablet->pointer_info.surface_x, - tablet->pointer_info.surface_y)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet motion %f %f", + tablet->pointer_info.surface_x, + tablet->pointer_info.surface_y); event = gdk_motion_event_new (tablet->pointer_info.focus, tablet->logical_device, @@ -3836,9 +3837,9 @@ tablet_tool_handle_pressure (void *data, _gdk_device_translate_axis (tablet->stylus_device, axis_index, pressure, &tablet->axes[GDK_AXIS_PRESSURE]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d pressure %d", - gdk_device_tool_get_tool_type (tool->tool), pressure)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d pressure %d", + gdk_device_tool_get_tool_type (tool->tool), pressure); } static void @@ -3858,9 +3859,9 @@ tablet_tool_handle_distance (void *data, _gdk_device_translate_axis (tablet->stylus_device, axis_index, distance, &tablet->axes[GDK_AXIS_DISTANCE]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d distance %d", - gdk_device_tool_get_tool_type (tool->tool), distance)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d distance %d", + gdk_device_tool_get_tool_type (tool->tool), distance); } static void @@ -3887,10 +3888,10 @@ tablet_tool_handle_tilt (void *data, wl_fixed_to_double (ytilt), &tablet->axes[GDK_AXIS_YTILT]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d tilt %f/%f", - gdk_device_tool_get_tool_type (tool->tool), - wl_fixed_to_double (xtilt), wl_fixed_to_double (ytilt))); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d tilt %f/%f", + gdk_device_tool_get_tool_type (tool->tool), + wl_fixed_to_double (xtilt), wl_fixed_to_double (ytilt)); } static void @@ -3947,10 +3948,10 @@ tablet_tool_handle_rotation (void *data, wl_fixed_to_double (degrees), &tablet->axes[GDK_AXIS_ROTATION]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d rotation %f", - gdk_device_tool_get_tool_type (tool->tool), - wl_fixed_to_double (degrees))); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d rotation %f", + gdk_device_tool_get_tool_type (tool->tool), + wl_fixed_to_double (degrees)); } static void @@ -3970,9 +3971,9 @@ tablet_tool_handle_slider (void *data, _gdk_device_translate_axis (tablet->stylus_device, axis_index, position, &tablet->axes[GDK_AXIS_SLIDER]); - GDK_SEAT_NOTE (tool->seat, EVENTS, - g_message ("tablet tool %d slider %d", - gdk_device_tool_get_tool_type (tool->tool), position)); + GDK_SEAT_DEBUG (tool->seat, EVENTS, + "tablet tool %d slider %d", + gdk_device_tool_get_tool_type (tool->tool), position); } static void @@ -3991,9 +3992,9 @@ tablet_tool_handle_wheel (void *data, seat = GDK_WAYLAND_SEAT (tablet->seat); - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet tool %d wheel %d/%d", - gdk_device_tool_get_tool_type (tool->tool), degrees, clicks)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet tool %d wheel %d/%d", + gdk_device_tool_get_tool_type (tool->tool), degrees, clicks); if (clicks == 0) return; @@ -4023,8 +4024,8 @@ tablet_tool_handle_frame (void *data, if (!tablet) return; - GDK_SEAT_NOTE (tablet->seat, EVENTS, - g_message ("tablet frame, time %d", time)); + GDK_SEAT_DEBUG (tablet->seat, EVENTS, + "tablet frame, time %d", time); frame_event = tablet->pointer_info.frame.event; @@ -4067,9 +4068,9 @@ tablet_pad_ring_handle_source (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad ring handle source, ring = %p source = %d", - wp_tablet_pad_ring, source)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad ring handle source, ring = %p source = %d", + wp_tablet_pad_ring, source); group->axis_tmp_info.source = source; } @@ -4081,9 +4082,9 @@ tablet_pad_ring_handle_angle (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad ring handle angle, ring = %p angle = %f", - wp_tablet_pad_ring, wl_fixed_to_double (angle))); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad ring handle angle, ring = %p angle = %f", + wp_tablet_pad_ring, wl_fixed_to_double (angle)); group->axis_tmp_info.value = wl_fixed_to_double (angle); } @@ -4094,8 +4095,8 @@ tablet_pad_ring_handle_stop (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad ring handle stop, ring = %p", wp_tablet_pad_ring)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad ring handle stop, ring = %p", wp_tablet_pad_ring); group->axis_tmp_info.is_stop = TRUE; } @@ -4110,8 +4111,8 @@ tablet_pad_ring_handle_frame (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat); GdkEvent *event; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring); event = gdk_pad_event_new_ring (seat->keyboard_focus, pad->device, @@ -4139,9 +4140,9 @@ tablet_pad_strip_handle_source (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad strip handle source, strip = %p source = %d", - wp_tablet_pad_strip, source)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad strip handle source, strip = %p source = %d", + wp_tablet_pad_strip, source); group->axis_tmp_info.source = source; } @@ -4153,9 +4154,9 @@ tablet_pad_strip_handle_position (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad strip handle position, strip = %p position = %d", - wp_tablet_pad_strip, position)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad strip handle position, strip = %p position = %d", + wp_tablet_pad_strip, position); group->axis_tmp_info.value = (double) position / 65535; } @@ -4166,9 +4167,9 @@ tablet_pad_strip_handle_stop (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad strip handle stop, strip = %p", - wp_tablet_pad_strip)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad strip handle stop, strip = %p", + wp_tablet_pad_strip); group->axis_tmp_info.is_stop = TRUE; } @@ -4183,9 +4184,9 @@ tablet_pad_strip_handle_frame (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat); GdkEvent *event; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet pad strip handle frame, strip = %p", - wp_tablet_pad_strip)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet pad strip handle frame, strip = %p", + wp_tablet_pad_strip); event = gdk_pad_event_new_strip (seat->keyboard_focus, pad->device, @@ -4214,9 +4215,9 @@ tablet_pad_group_handle_buttons (void *data, GdkWaylandTabletPadGroupData *group = data; uint32_t *p; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle buttons, pad group = %p, n_buttons = %" G_GSIZE_FORMAT, - wp_tablet_pad_group, buttons->size)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle buttons, pad group = %p, n_buttons = %" G_GSIZE_FORMAT, + wp_tablet_pad_group, buttons->size); wl_array_for_each (p, buttons) { @@ -4233,9 +4234,9 @@ tablet_pad_group_handle_ring (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle ring, pad group = %p, ring = %p", - wp_tablet_pad_group, wp_tablet_pad_ring)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle ring, pad group = %p, ring = %p", + wp_tablet_pad_group, wp_tablet_pad_ring); zwp_tablet_pad_ring_v2_add_listener (wp_tablet_pad_ring, &tablet_pad_ring_listener, group); @@ -4252,9 +4253,9 @@ tablet_pad_group_handle_strip (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle strip, pad group = %p, strip = %p", - wp_tablet_pad_group, wp_tablet_pad_strip)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle strip, pad group = %p, strip = %p", + wp_tablet_pad_group, wp_tablet_pad_strip); zwp_tablet_pad_strip_v2_add_listener (wp_tablet_pad_strip, &tablet_pad_strip_listener, group); @@ -4271,9 +4272,9 @@ tablet_pad_group_handle_modes (void *data, { GdkWaylandTabletPadGroupData *group = data; - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle modes, pad group = %p, n_modes = %d", - wp_tablet_pad_group, modes)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle modes, pad group = %p, n_modes = %d", + wp_tablet_pad_group, modes); group->n_modes = modes; } @@ -4286,9 +4287,9 @@ tablet_pad_group_handle_done (void *data, GdkWaylandTabletPadGroupData *group = data; #endif - GDK_SEAT_NOTE (group->pad->seat, EVENTS, - g_message ("tablet pad group handle done, pad group = %p", - wp_tablet_pad_group)); + GDK_SEAT_DEBUG (group->pad->seat, EVENTS, + "tablet pad group handle done, pad group = %p", + wp_tablet_pad_group); } static void @@ -4304,9 +4305,9 @@ tablet_pad_group_handle_mode (void *data, GdkEvent *event; guint n_group; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("tablet pad group handle mode, pad group = %p, mode = %d", - wp_tablet_pad_group, mode)); + GDK_SEAT_DEBUG (seat, EVENTS, + "tablet pad group handle mode, pad group = %p, mode = %d", + wp_tablet_pad_group, mode); group->mode_switch_serial = serial; group->current_mode = mode; @@ -4339,9 +4340,9 @@ tablet_pad_handle_group (void *data, GdkWaylandTabletPadData *pad = data; GdkWaylandTabletPadGroupData *group; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle group, pad group = %p, group = %p", - wp_tablet_pad_group, wp_tablet_pad_group)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle group, pad group = %p, group = %p", + wp_tablet_pad_group, wp_tablet_pad_group); group = g_new0 (GdkWaylandTabletPadGroupData, 1); group->wp_tablet_pad_group = wp_tablet_pad_group; @@ -4360,9 +4361,9 @@ tablet_pad_handle_path (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle path, pad = %p, path = %s", - wp_tablet_pad, path)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle path, pad = %p, path = %s", + wp_tablet_pad, path); pad->path = g_strdup (path); } @@ -4374,9 +4375,9 @@ tablet_pad_handle_buttons (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle buttons, pad = %p, n_buttons = %d", - wp_tablet_pad, buttons)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle buttons, pad = %p, n_buttons = %d", + wp_tablet_pad, buttons); pad->n_buttons = buttons; } @@ -4387,8 +4388,8 @@ tablet_pad_handle_done (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle done, pad = %p", wp_tablet_pad)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle done, pad = %p", wp_tablet_pad); pad->device = g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD, @@ -4414,9 +4415,9 @@ tablet_pad_handle_button (void *data, GdkEvent *event; int n_group; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle button, pad = %p, button = %d, state = %d", - wp_tablet_pad, button, state)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle button, pad = %p, button = %d, state = %d", + wp_tablet_pad, button, state); group = tablet_pad_lookup_button_group (pad, button); @@ -4452,9 +4453,9 @@ tablet_pad_handle_enter (void *data, GdkWaylandTabletPadData *pad = data; GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet); - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle enter, pad = %p, tablet = %p surface = %p", - wp_tablet_pad, wp_tablet, surface)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle enter, pad = %p, tablet = %p surface = %p", + wp_tablet_pad, wp_tablet, surface); /* Relate pad and tablet */ tablet->pads = g_list_prepend (tablet->pads, pad); @@ -4469,9 +4470,9 @@ tablet_pad_handle_leave (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle leave, pad = %p, surface = %p", - wp_tablet_pad, surface)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle leave, pad = %p, surface = %p", + wp_tablet_pad, surface); if (pad->current_tablet) { @@ -4486,8 +4487,8 @@ tablet_pad_handle_removed (void *data, { GdkWaylandTabletPadData *pad = data; - GDK_SEAT_NOTE (pad->seat, EVENTS, - g_message ("tablet pad handle removed, pad = %p", wp_tablet_pad)); + GDK_SEAT_DEBUG (pad->seat, EVENTS, + "tablet pad handle removed, pad = %p", wp_tablet_pad); /* Remove from the current tablet */ if (pad->current_tablet) @@ -4659,9 +4660,9 @@ pointer_surface_enter (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); GdkWaylandTabletData *tablet; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("pointer surface of seat %p entered output %p", - seat, output)); + GDK_SEAT_DEBUG (seat, EVENTS, + "pointer surface of seat %p entered output %p", + seat, output); tablet = gdk_wayland_seat_find_tablet (seat, device); @@ -4688,9 +4689,9 @@ pointer_surface_leave (void *data, GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device)); GdkWaylandTabletData *tablet; - GDK_SEAT_NOTE (seat, EVENTS, - g_message ("pointer surface of seat %p left output %p", - seat, output)); + GDK_SEAT_DEBUG (seat, EVENTS, + "pointer surface of seat %p left output %p", + seat, output); tablet = gdk_wayland_seat_find_tablet (seat, device); diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 89982d76a5..ab185ad49a 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -130,8 +130,7 @@ xdg_wm_base_ping (void *data, struct xdg_wm_base *xdg_wm_base, uint32_t serial) { - GDK_NOTE (EVENTS, - g_message ("ping, shell %p, serial %u\n", xdg_wm_base, serial)); + GDK_DEBUG (EVENTS, "ping, shell %p, serial %u", xdg_wm_base, serial); xdg_wm_base_pong (xdg_wm_base, serial); } @@ -145,8 +144,8 @@ zxdg_shell_v6_ping (void *data, struct zxdg_shell_v6 *xdg_shell, uint32_t serial) { - GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS, - g_message ("ping, shell %p, serial %u\n", xdg_shell, serial)); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), EVENTS, + "ping, shell %p, serial %u", xdg_shell, serial); zxdg_shell_v6_pong (xdg_shell, serial); } @@ -286,10 +285,12 @@ wl_shm_format (void *data, struct wl_shm *wl_shm, uint32_t format) { - GDK_NOTE (MISC, - char buf[10]; - g_message ("supported pixel format %s (0x%X)", get_format_name (format, buf), (guint) format); - ); +#ifdef G_ENABLE_DEBUG + char buf[10]; +#endif + + GDK_DEBUG (MISC, "supported pixel format %s (0x%X)", + get_format_name (format, buf), (guint) format); } static const struct wl_shm_listener wl_shm_listener = { @@ -302,13 +303,15 @@ server_decoration_manager_default_mode (void uint32_t mode) { g_assert (mode <= ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER); +#ifdef G_ENABLE_DEBUG const char *modes[] = { [ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE] = "none", [ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT] = "client", [ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER] = "server", }; +#endif GdkWaylandDisplay *display_wayland = data; - g_debug ("Compositor prefers decoration mode '%s'", modes[mode]); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), MISC, "Compositor prefers decoration mode '%s'", modes[mode]); display_wayland->server_decoration_mode = mode; } @@ -356,8 +359,7 @@ gdk_registry_handle_global (void *data, GdkWaylandDisplay *display_wayland = data; struct wl_output *output; - GDK_NOTE (MISC, - g_message ("add global %u, interface %s, version %u", id, interface, version)); + GDK_DEBUG (MISC, "add global %u, interface %s, version %u", id, interface, version); if (strcmp (interface, "wl_compositor") == 0) { @@ -511,7 +513,8 @@ gdk_registry_handle_global_remove (void *data, { GdkWaylandDisplay *display_wayland = data; - GDK_NOTE (MISC, g_message ("remove global %u", id)); + GDK_DEBUG (MISC, "remove global %u", id); + _gdk_wayland_display_remove_seat (display_wayland, id); gdk_wayland_display_remove_output (display_wayland, id); @@ -563,7 +566,7 @@ _gdk_wayland_display_open (const char *display_name) GdkDisplay *display; GdkWaylandDisplay *display_wayland; - GDK_NOTE (MISC, g_message ("opening display %s", display_name ? display_name : "")); + GDK_DEBUG (MISC, "opening display %s", display_name ? display_name : ""); /* If this variable is unset then wayland initialisation will surely * fail, logging a fatal error in the process. Save ourselves from @@ -2251,9 +2254,8 @@ gdk_wayland_display_init_xdg_output (GdkWaylandDisplay *self) { guint i, n; - GDK_NOTE (MISC, - g_message ("init xdg-output support, %d monitor(s) already present", - g_list_model_get_n_items (G_LIST_MODEL (self->monitors)))); + GDK_DEBUG (MISC, "init xdg-output support, %d monitor(s) already present", + g_list_model_get_n_items (G_LIST_MODEL (self->monitors))); n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors)); for (i = 0; i < n; i++) @@ -2296,11 +2298,10 @@ should_expect_xdg_output_done (GdkWaylandMonitor *monitor) static void apply_monitor_change (GdkWaylandMonitor *monitor) { - GDK_NOTE (MISC, - g_message ("monitor %d changed position %d %d, size %d %d", - monitor->id, - monitor->x, monitor->y, - monitor->width, monitor->height)); + GDK_DEBUG (MISC, "monitor %d changed position %d %d, size %d %d", + monitor->id, + monitor->x, monitor->y, + monitor->width, monitor->height); gdk_monitor_set_geometry (GDK_MONITOR (monitor), &(GdkRectangle) { @@ -2321,9 +2322,9 @@ xdg_output_handle_logical_position (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle logical position xdg-output %d, position %d %d", - monitor->id, x, y)); + GDK_DEBUG (MISC, "handle logical position xdg-output %d, position %d %d", + monitor->id, x, y); + monitor->x = x; monitor->y = y; } @@ -2336,9 +2337,9 @@ xdg_output_handle_logical_size (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle logical size xdg-output %d, size %d %d", - monitor->id, width, height)); + GDK_DEBUG (MISC, "handle logical size xdg-output %d, size %d %d", + monitor->id, width, height); + monitor->width = width; monitor->height = height; } @@ -2349,8 +2350,7 @@ xdg_output_handle_done (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle done xdg-output %d", monitor->id)); + GDK_DEBUG (MISC, "handle done xdg-output %d", monitor->id); monitor->xdg_output_done = TRUE; if (monitor->wl_output_done && should_expect_xdg_output_done (monitor)) @@ -2364,8 +2364,7 @@ xdg_output_handle_name (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_NOTE (MISC, - g_message ("handle name xdg-output %d", monitor->id)); + GDK_DEBUG (MISC, "handle name xdg-output %d", monitor->id); monitor->name = g_strdup (name); } @@ -2375,11 +2374,8 @@ xdg_output_handle_description (void *data, struct zxdg_output_v1 *xdg_output, const char *description) { - GDK_NOTE (MISC, - { - GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - g_message ("handle description xdg-output %d", monitor->id); - }); + GDK_DEBUG (MISC, "handle description xdg-output %d", + ((GdkWaylandMonitor *)data)->id); } static const struct zxdg_output_v1_listener xdg_output_listener = { @@ -2396,8 +2392,7 @@ gdk_wayland_display_get_xdg_output (GdkWaylandMonitor *monitor) GdkDisplay *display = GDK_MONITOR (monitor)->display; GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); - GDK_NOTE (MISC, - g_message ("get xdg-output for monitor %d", monitor->id)); + GDK_DEBUG (MISC, "get xdg-output for monitor %d", monitor->id); monitor->xdg_output = zxdg_output_manager_v1_get_xdg_output (display_wayland->xdg_output_manager, @@ -2422,9 +2417,12 @@ output_handle_geometry (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; - GDK_NOTE (MISC, - g_message ("handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s", - monitor->id, x, y, physical_width, physical_height, subpixel_to_string (subpixel), make, model, transform_to_string (transform))); + GDK_DEBUG (MISC, "handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s", + monitor->id, x, y, + physical_width, physical_height, + subpixel_to_string (subpixel), + make, model, + transform_to_string (transform)); monitor->x = x; monitor->y = y; @@ -2457,8 +2455,7 @@ output_handle_done (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; - GDK_NOTE (MISC, - g_message ("handle done output %d", monitor->id)); + GDK_DEBUG (MISC, "handle done output %d", monitor->id); monitor->wl_output_done = TRUE; @@ -2477,8 +2474,7 @@ output_handle_scale (void *data, int width; int height; - GDK_NOTE (MISC, - g_message ("handle scale output %d, scale %d", monitor->id, scale)); + GDK_DEBUG (MISC, "handle scale output %d, scale %d", monitor->id, scale); gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry); previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor)); @@ -2510,9 +2506,8 @@ output_handle_mode (void *data, GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data; int scale; - GDK_NOTE (MISC, - g_message ("handle mode output %d, size %d %d, rate %d", - monitor->id, width, height, refresh)); + GDK_DEBUG (MISC, "handle mode output %d, size %d %d, rate %d", + monitor->id, width, height, refresh); if ((flags & WL_OUTPUT_MODE_CURRENT) == 0) return; @@ -2552,9 +2547,8 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland, wl_output_add_listener (output, &output_listener, monitor); - GDK_NOTE (MISC, - g_message ("xdg_output_manager %p", - display_wayland->xdg_output_manager)); + GDK_DEBUG (MISC, "xdg_output_manager %p", + display_wayland->xdg_output_manager); if (display_has_xdg_output_support (display_wayland)) gdk_wayland_display_get_xdg_output (monitor); diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c index b8566572d0..b00769e907 100644 --- a/gdk/wayland/gdkdrag-wayland.c +++ b/gdk/wayland/gdkdrag-wayland.c @@ -217,9 +217,8 @@ data_source_target (void *data, struct wl_data_source *source, const char *mime_type) { - GDK_NOTE (EVENTS, - g_message ("data source target, source = %p, mime_type = %s", - source, mime_type)); + GDK_DEBUG (EVENTS, "data source target, source = %p, mime_type = %s", + source, mime_type); } static void @@ -231,7 +230,9 @@ gdk_wayland_drag_write_done (GObject *drag, if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error)) { - GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_message ("%p: failed to write stream: %s", drag, error->message)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (GDK_DRAG (drag)), DND, + "%p: failed to write stream: %s", drag, error->message); + g_error_free (error); } } @@ -245,8 +246,9 @@ data_source_send (void *data, GdkDrag *drag = data; GOutputStream *stream; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, g_message ("%p: data source send request for %s on fd %d\n", - source, mime_type, fd)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), DND, + "%p: data source send request for %s on fd %d\n", + source, mime_type, fd); //mime_type = gdk_intern_mime_type (mime_type); mime_type = g_intern_string (mime_type); @@ -268,8 +270,8 @@ data_source_cancelled (void *data, { GdkDrag *drag = data; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS, - g_message ("data source cancelled, source = %p", source)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), EVENTS, + "data source cancelled, source = %p", source); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR); } @@ -302,9 +304,9 @@ data_source_action (void *data, { GdkDrag *drag = data; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS, - g_message ("data source action, source = %p action=%x", - source, action)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), EVENTS, + "data source action, source = %p action=%x", + source, action); gdk_drag_set_selected_action (drag, _wl_to_gdk_actions (action)); } @@ -338,10 +340,14 @@ gdk_wayland_drag_create_data_source (GdkDrag *drag) mimetypes = gdk_content_formats_get_mime_types (formats, &n_mimetypes); - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS, - {char *s = g_strjoinv (" ", (char **)mimetypes); - g_message ("create data source, mime types=%s", s); - g_free (s);}); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_drag_get_display (drag), EVENTS)) + { + char *s = g_strjoinv (" ", (char **)mimetypes); + gdk_debug_message ("create data source, mime types=%s", s); + g_free (s); + } +#endif wl_data_source_offer (drag_wayland->data_source, GDK_WAYLAND_LOCAL_DND_MIME_TYPE); for (i = 0; i < n_mimetypes; i++) diff --git a/gdk/wayland/gdkdrop-wayland.c b/gdk/wayland/gdkdrop-wayland.c index 8234096adb..c1391ba080 100644 --- a/gdk/wayland/gdkdrop-wayland.c +++ b/gdk/wayland/gdkdrop-wayland.c @@ -192,9 +192,14 @@ gdk_wayland_drop_read_async (GdkDrop *drop, g_task_set_priority (task, io_priority); g_task_set_source_tag (task, gdk_wayland_drop_read_async); - GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: read for %s", drop, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_drop_get_display (drop), DND)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: read for %s", drop, s); + g_free (s); + } +#endif mime_type = gdk_content_formats_match_mime_type (formats, gdk_drop_get_formats (drop)); if (mime_type == NULL) diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c index 35ac9e8262..7107fbe192 100644 --- a/gdk/wayland/gdkkeys-wayland.c +++ b/gdk/wayland/gdkkeys-wayland.c @@ -489,25 +489,32 @@ _gdk_wayland_keymap_new (GdkDisplay *display) return GDK_KEYMAP (keymap); } -#ifdef G_ENABLE_DEBUG static void -print_modifiers (struct xkb_keymap *keymap) +print_modifiers (GdkDisplay *display, + struct xkb_keymap *keymap) { +#ifdef G_ENABLE_DEBUG int i, j; uint32_t real; struct xkb_state *state; + GString *str; - g_print ("modifiers:\n"); + if (!GDK_DISPLAY_DEBUG_CHECK (display, INPUT)) + return; + + str = g_string_new (""); + + g_string_append (str, "modifiers:\n"); for (i = 0; i < xkb_keymap_num_mods (keymap); i++) - g_print ("%s ", xkb_keymap_mod_get_name (keymap, i)); - g_print ("\n\n"); + g_string_append_printf (str, "%s ", xkb_keymap_mod_get_name (keymap, i)); + g_string_append (str, "\n\n"); - g_print ("modifier mapping\n"); + g_string_append (str, "modifier mapping\n"); state = xkb_state_new (keymap); for (i = 0; i < 8; i++) { gboolean need_arrow = TRUE; - g_print ("%s ", xkb_keymap_mod_get_name (keymap, i)); + g_string_append_printf (str, "%s ", xkb_keymap_mod_get_name (keymap, i)); for (j = 8; j < xkb_keymap_num_mods (keymap); j++) { xkb_state_update_mask (state, 1 << j, 0, 0, 0, 0, 0); @@ -516,18 +523,21 @@ print_modifiers (struct xkb_keymap *keymap) { if (need_arrow) { - g_print ("-> "); + g_string_append (str, "-> "); need_arrow = FALSE; } - g_print ("%s ", xkb_keymap_mod_get_name (keymap, j)); + g_string_append_printf (str, "%s ", xkb_keymap_mod_get_name (keymap, j)); } } - g_print ("\n"); } + gdk_debug_message ("%s", str->str); + + g_string_free (str, TRUE); + xkb_state_unref (state); -} #endif +} void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, @@ -549,7 +559,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, return; } - GDK_DISPLAY_NOTE (keymap->display, INPUT, g_message ("keymap:\n%s", map_str)); + GDK_DISPLAY_DEBUG (keymap->display, INPUT, "keymap:\n%s", map_str); xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0); munmap (map_str, size); @@ -562,7 +572,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap, return; } - GDK_DISPLAY_NOTE (keymap->display, INPUT, print_modifiers (xkb_keymap)); + print_modifiers (keymap->display, xkb_keymap); xkb_keymap_unref (keymap_wayland->xkb_keymap); keymap_wayland->xkb_keymap = xkb_keymap; diff --git a/gdk/wayland/gdkprimary-wayland.c b/gdk/wayland/gdkprimary-wayland.c index 7aa702bef8..f21dd2cc0e 100644 --- a/gdk/wayland/gdkprimary-wayland.c +++ b/gdk/wayland/gdkprimary-wayland.c @@ -99,7 +99,7 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, if (cb->source) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_message ("%p: Ignoring clipboard offer for self", cb)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, "%p: Ignoring clipboard offer for self", cb); gdk_content_formats_unref (formats); g_clear_pointer (&offer, zwp_primary_selection_offer_v1_destroy); return; @@ -107,9 +107,15 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb, gdk_wayland_primary_discard_offer (cb); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: remote clipboard claim for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: remote clipboard claim for %s", cb, s); + g_free (s); + } +#endif + cb->offer_formats = formats; cb->offer = offer; @@ -126,8 +132,9 @@ primary_offer_offer (void *data, if (cb->pending != offer) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_message ("%p: offer for unknown selection %p of %s", - cb, offer, type)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, + "%p: offer for unknown selection %p of %s", + cb, offer, type); return; } @@ -145,8 +152,9 @@ primary_selection_data_offer (void *data, { GdkWaylandPrimary *cb = data; - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_message ("%p: new primary offer %p", - cb, offer)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, + "%p: new primary offer %p", + cb, offer); gdk_wayland_primary_discard_pending (cb); @@ -174,8 +182,9 @@ primary_selection_selection (void *data, if (cb->pending != offer) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_message ("%p: ignoring unknown data offer %p", - cb, offer)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, + "%p: ignoring unknown data offer %p", + cb, offer); return; } @@ -200,7 +209,9 @@ gdk_wayland_primary_write_done (GObject *clipboard, if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error)) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), SELECTION, g_message ("%p: failed to write stream: %s", clipboard, error->message)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), SELECTION, + "%p: failed to write stream: %s", + clipboard, error->message); g_error_free (error); } } @@ -214,8 +225,9 @@ gdk_wayland_primary_data_source_send (void *da GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (data); GOutputStream *stream; - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), SELECTION, g_message ("%p: data source send request for %s on fd %d", - source, mime_type, fd)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), SELECTION, + "%p: data source send request for %s on fd %d", + source, mime_type, fd); mime_type = gdk_intern_mime_type (mime_type); stream = g_unix_output_stream_new (fd, TRUE); @@ -236,7 +248,8 @@ gdk_wayland_primary_data_source_cancelled (void { GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (data); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_message ("%p: data source cancelled", data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, + "%p: data source cancelled", data); if (cb->source == source) { @@ -307,9 +320,14 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard, g_task_set_priority (task, io_priority); g_task_set_source_tag (task, gdk_wayland_primary_read_async); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (clipboard), CLIPBOARD, char *s = gdk_content_formats_to_string (formats); - g_message ("%p: read for %s", cb, s); - g_free (s); ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (clipboard), CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%p: read for %s", cb, s); + g_free (s); + } +#endif mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats); if (mime_type == NULL) { diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index d35ffb2299..86392923e5 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -553,7 +553,7 @@ frame_callback (void *data, GdkFrameTimings *timings; gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event"); - GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", surface)); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface); wl_callback_destroy (callback); @@ -1345,8 +1345,8 @@ surface_enter (void *data, GdkDisplay *display = gdk_surface_get_display (surface); GdkMonitor *monitor; - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("surface enter, surface %p output %p", surface, output)); + GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS, + "surface enter, surface %p output %p", surface, output); impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output); @@ -1366,8 +1366,8 @@ surface_leave (void *data, GdkDisplay *display = gdk_surface_get_display (surface); GdkMonitor *monitor; - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("surface leave, surface %p output %p", surface, output)); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "surface leave, surface %p output %p", surface, output); impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output); @@ -1594,13 +1594,13 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface) impl->next_layout.surface_geometry_dirty = TRUE; gdk_surface_request_layout (surface); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("configure, surface %p %dx%d,%s%s%s%s", - surface, width, height, - (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) ? " fullscreen" : "", - (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) ? " maximized" : "", - (new_state & GDK_TOPLEVEL_STATE_FOCUSED) ? " focused" : "", - (new_state & GDK_TOPLEVEL_STATE_TILED) ? " tiled" : "")); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "configure, surface %p %dx%d,%s%s%s%s", + surface, width, height, + (new_state & GDK_TOPLEVEL_STATE_FULLSCREEN) ? " fullscreen" : "", + (new_state & GDK_TOPLEVEL_STATE_MAXIMIZED) ? " maximized" : "", + (new_state & GDK_TOPLEVEL_STATE_FOCUSED) ? " focused" : "", + (new_state & GDK_TOPLEVEL_STATE_TILED) ? " tiled" : ""); gdk_surface_queue_state_change (surface, ~0 & ~new_state, new_state); @@ -1753,7 +1753,7 @@ gdk_wayland_surface_handle_close (GdkSurface *surface) display = gdk_surface_get_display (surface); - GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface)); + GDK_DISPLAY_DEBUG (display, EVENTS, "close %p", surface); event = gdk_delete_event_new (surface); @@ -2116,7 +2116,7 @@ xdg_popup_done (void *data, { GdkSurface *surface = GDK_SURFACE (data); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, g_message ("done %p", surface)); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, "done %p", surface); gdk_surface_hide (surface); } @@ -2129,8 +2129,8 @@ xdg_popup_repositioned (void *data, GdkSurface *surface = GDK_SURFACE (data); GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("repositioned %p", surface)); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "repositioned %p", surface); if (impl->popup_state != POPUP_STATE_WAITING_FOR_REPOSITIONED) { @@ -2167,8 +2167,7 @@ zxdg_popup_v6_done (void *data, { GdkSurface *surface = GDK_SURFACE (data); - GDK_NOTE (EVENTS, - g_message ("done %p", surface)); + GDK_DEBUG (EVENTS, "done %p", surface); gdk_surface_hide (surface); } From ce4c2154f4c4ab5a4fa8b45896354ed18a580bb2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 21:34:04 -0400 Subject: [PATCH 21/30] x11: Use the new debug macros --- gdk/x11/gdkclipboard-x11.c | 138 ++++++++++++---------- gdk/x11/gdkdevicemanager-x11.c | 5 +- gdk/x11/gdkdevicemanager-xi2.c | 155 +++++++++++++------------ gdk/x11/gdkdisplay-x11.c | 138 +++++++++++----------- gdk/x11/gdkdrag-x11.c | 69 +++++------ gdk/x11/gdkdrop-x11.c | 47 ++++---- gdk/x11/gdkglcontext-glx.c | 63 +++++----- gdk/x11/gdkselectioninputstream-x11.c | 70 ++++++----- gdk/x11/gdkselectionoutputstream-x11.c | 131 ++++++++++++--------- gdk/x11/xsettings-client.c | 16 +-- 10 files changed, 438 insertions(+), 394 deletions(-) diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c index f634536b3f..b81755481c 100644 --- a/gdk/x11/gdkclipboard-x11.c +++ b/gdk/x11/gdkclipboard-x11.c @@ -65,15 +65,24 @@ print_atoms (GdkX11Clipboard *cb, const Atom *atoms, gsize n_atoms) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, { - gsize i; - GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); +#ifdef G_ENABLE_DEBUG + GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); - g_printerr ("%s: %s [ ", cb->selection, prefix); + if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD)) + { + gsize i; + GString *str; + + str = g_string_new (""); + g_string_append_printf (str, "%s: %s [ ", cb->selection, prefix); for (i = 0; i < n_atoms; i++) - g_printerr ("%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); - g_printerr (" ]\n"); - }); + g_string_append_printf (str, "%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); + g_string_append (str, " ]"); + + gdk_debug_message ("%s", str->str); + g_string_free (str, TRUE); + } +#endif } static void @@ -85,9 +94,7 @@ gdk_x11_clipboard_default_output_closed (GObject *stream, if (!g_output_stream_close_finish (G_OUTPUT_STREAM (stream), result, &error)) { - GDK_NOTE (CLIPBOARD, - g_printerr ("-------: failed to close stream: %s\n", - error->message)); + GDK_DEBUG (CLIPBOARD, "-------: failed to close stream: %s", error->message); g_error_free (error); } @@ -104,9 +111,9 @@ gdk_x11_clipboard_default_output_done (GObject *clipboard, if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error)) { - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, - g_printerr ("%s: failed to write stream: %s\n", - GDK_X11_CLIPBOARD (clipboard)->selection, error->message)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, + "%s: failed to write stream: %s", + GDK_X11_CLIPBOARD (clipboard)->selection, error->message); g_error_free (error); } @@ -289,8 +296,8 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, bytes = g_input_stream_read_bytes_finish (stream, res, &error); if (bytes == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: error reading TARGETS: %s\n", cb->selection, error->message)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: error reading TARGETS: %s\n", cb->selection, error->message); g_error_free (error); g_object_unref (stream); g_object_unref (cb); @@ -321,7 +328,14 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, formats = gdk_x11_clipboard_formats_from_atoms (display, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes) / sizeof (Atom)); - GDK_DISPLAY_NOTE (display, CLIPBOARD, char *s = gdk_content_formats_to_string (formats); g_printerr ("%s: got formats: %s\n", cb->selection, s); g_free (s)); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD)) + { + char *s = gdk_content_formats_to_string (formats); + gdk_debug_message ("%s: got formats: %s", cb->selection, s); + g_free (s); + } +#endif /* union with previously loaded formats */ formats = gdk_content_formats_union (formats, gdk_clipboard_get_formats (GDK_CLIPBOARD (cb))); @@ -353,15 +367,15 @@ gdk_x11_clipboard_request_targets_got_stream (GObject *source, stream = gdk_x11_selection_input_stream_new_finish (result, &type, &format, &error); if (stream == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: can't request TARGETS: %s\n", cb->selection, error->message)); + GDK_DISPLAY_DEBUG(display, CLIPBOARD, "%s: can't request TARGETS: %s", cb->selection, error->message); g_object_unref (cb); g_error_free (error); return; } else if (g_strcmp0 (type, "ATOM") != 0 || format != 32) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32\n", - cb->selection, type ? type : "NULL", format)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 32", + cb->selection, type ? type : "NULL", format); g_input_stream_close (stream, NULL, NULL); g_object_unref (stream); g_object_unref (cb); @@ -423,13 +437,13 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, if (xevent->xselectionclear.time < cb->timestamp) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: ignoring SelectionClear with too old timestamp (%lu vs %lu)\n", - cb->selection, xevent->xselectionclear.time, cb->timestamp)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: ignoring SelectionClear with too old timestamp (%lu vs %lu)", + cb->selection, xevent->xselectionclear.time, cb->timestamp); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: got SelectionClear\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: got SelectionClear", cb->selection); gdk_x11_clipboard_claim_remote (cb, xevent->xselectionclear.time); return TRUE; @@ -446,13 +460,13 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, /* We already received a selectionNotify before */ if (cb->store_task == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionNotify for nonexisting task?!\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionNotify for nonexisting task?!", cb->selection); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionNotify for store task\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionNotify for store task", cb->selection); if (xevent->xselection.property != None) g_task_return_boolean (cb->store_task, TRUE); @@ -482,21 +496,21 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, if (!gdk_clipboard_is_local (GDK_CLIPBOARD (cb))) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionRequest for %s @ %s even though we don't own the selection, huh?\n", - cb->selection, target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionRequest for %s @ %s even though we don't own the selection, huh?", + cb->selection, target, property); return TRUE; } if (xevent->xselectionrequest.requestor == None) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionRequest for %s @ %s with NULL window, ignoring\n", - cb->selection, target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionRequest for %s @ %s with NULL window, ignoring", + cb->selection, target, property); return TRUE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: got SelectionRequest for %s @ %s\n", cb->selection, target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: got SelectionRequest for %s @ %s", cb->selection, target, property); gdk_x11_selection_output_streams_create (display, gdk_clipboard_get_formats (GDK_CLIPBOARD (cb)), @@ -522,21 +536,21 @@ gdk_x11_clipboard_xevent (GdkDisplay *display, if (sn->selection_timestamp < cb->timestamp) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)\n", - cb->selection, sn->selection_timestamp, cb->timestamp)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)", + cb->selection, sn->selection_timestamp, cb->timestamp); return FALSE; } if (sn->owner == GDK_X11_DISPLAY (display)->leader_window) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: Ignoring XFixesSelectionNotify for ourselves\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: Ignoring XFixesSelectionNotify for ourselves", cb->selection); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: Received XFixesSelectionNotify, claiming selection\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: Received XFixesSelectionNotify, claiming selection", cb->selection); gdk_x11_clipboard_claim_remote (cb, sn->selection_timestamp); } @@ -580,7 +594,7 @@ gdk_x11_clipboard_claim (GdkClipboard *clipboard, if (XGetSelectionOwner (xdisplay, cb->xselection) != xwindow) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: failed XSetSelectionOwner()\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: failed XSetSelectionOwner()", cb->selection); return FALSE; } } @@ -590,7 +604,7 @@ gdk_x11_clipboard_claim (GdkClipboard *clipboard, } cb->timestamp = time; - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: claimed via XSetSelectionOwner()\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: claimed via XSetSelectionOwner()", cb->selection); } return GDK_CLIPBOARD_CLASS (gdk_x11_clipboard_parent_class)->claim (clipboard, formats, local, content); @@ -616,7 +630,7 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, /* clipboard managers don't work on anything but the clipbpoard selection */ if (!g_str_equal (cb->selection, "CLIPBOARD")) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: can only store on CLIPBOARD\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: can only store on CLIPBOARD", cb->selection); GDK_CLIPBOARD_CLASS (gdk_x11_clipboard_parent_class)->store_async (clipboard, io_priority, cancellable, @@ -634,9 +648,9 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, if (XGetSelectionOwner (xdisplay, clipboard_manager) == None) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: XGetSelectionOwner (CLIPBOARD_MANAGER) returned None, aborting.\n", - cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: XGetSelectionOwner (CLIPBOARD_MANAGER) returned None, aborting.", + cb->selection); g_task_return_new_error (cb->store_task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("Cannot store clipboard. No clipboard manager is active.")); g_clear_object (&cb->store_task); @@ -646,7 +660,7 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, content = gdk_clipboard_get_content (clipboard); if (content == NULL) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: storing empty clipboard: SUCCESS!\n", cb->selection)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "%s: storing empty clipboard: SUCCESS!", cb->selection); g_task_return_boolean (cb->store_task, TRUE); g_clear_object (&cb->store_task); return; @@ -678,8 +692,8 @@ gdk_x11_clipboard_store_async (GdkClipboard *clipboard, error = gdk_x11_display_error_trap_pop (display); if (error != Success) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - g_printerr ("%s: X error during ConvertSelection() while storing selection: %d\n", cb->selection, error)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "%s: X error during ConvertSelection() while storing selection: %d", cb->selection, error); } g_free (atoms); @@ -718,9 +732,9 @@ gdk_x11_clipboard_read_got_stream (GObject *source, { GdkX11Clipboard *cb = GDK_X11_CLIPBOARD (g_task_get_source_object (task)); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD(cb)), CLIPBOARD, - g_printerr ("%s: reading %s failed, trying %s next\n", - cb->selection, (char *) targets->data, (char *) next->data)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD(cb)), CLIPBOARD, + "%s: reading %s failed, trying %s next\n", + cb->selection, (char *) targets->data, (char *) next->data); targets->next = NULL; g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free); gdk_x11_selection_input_stream_new_async (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), @@ -749,9 +763,9 @@ gdk_x11_clipboard_read_got_stream (GObject *source, { g_assert (special_targets[i].mime_type != NULL); - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, - g_printerr ("%s: reading with converter from %s to %s\n", - cb->selection, mime_type, special_targets[i].mime_type)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, + "%s: reading with converter from %s to %s", + cb->selection, mime_type, special_targets[i].mime_type); mime_type = g_intern_string (special_targets[i].mime_type); g_task_set_task_data (task, g_slist_prepend (NULL, (gpointer) mime_type), (GDestroyNotify) g_slist_free); stream = special_targets[i].convert (cb, stream, type, format); @@ -759,8 +773,8 @@ gdk_x11_clipboard_read_got_stream (GObject *source, } } - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, - g_printerr ("%s: reading clipboard as %s now\n", cb->selection, mime_type)); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, + "%s: reading clipboard as %s now", cb->selection, mime_type); g_task_return_pointer (task, stream, g_object_unref); } @@ -792,9 +806,9 @@ gdk_x11_clipboard_read_async (GdkClipboard *clipboard, return; } - GDK_DISPLAY_NOTE (gdk_clipboard_get_display (clipboard), CLIPBOARD, - g_printerr ("%s: new read for %s (%u other options)\n", - cb->selection, (char *) targets->data, g_slist_length (targets->next))); + GDK_DISPLAY_DEBUG (gdk_clipboard_get_display (clipboard), CLIPBOARD, + "%s: new read for %s (%u other options)", + cb->selection, (char *) targets->data, g_slist_length (targets->next)); gdk_x11_selection_input_stream_new_async (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), cb->selection, targets->data, diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c index 27a7d2007b..d67ac13d6e 100644 --- a/gdk/x11/gdkdevicemanager-x11.c +++ b/gdk/x11/gdkdevicemanager-x11.c @@ -47,9 +47,8 @@ _gdk_x11_device_manager_new (GdkDisplay *display) { GdkX11DeviceManagerXI2 *device_manager_xi2; - GDK_DISPLAY_NOTE (display, INPUT, - g_message ("Creating XI2 (version %d.%d) device manager", - major, minor)); + GDK_DISPLAY_DEBUG (display, INPUT, "Creating XI2 (version %d.%d) device manager", + major, minor); device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2, "display", display, diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 87482bff6a..c8b8452507 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -226,7 +226,8 @@ translate_valuator_class (GdkDisplay *display, } _gdk_device_add_axis (device, use, min, max, resolution); - GDK_DISPLAY_NOTE (display, INPUT, +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT)) { const char *label; @@ -235,8 +236,9 @@ translate_valuator_class (GdkDisplay *display, else label = NULL; - g_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"); - }); + gdk_debug_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"); + } +#endif } static void @@ -281,13 +283,12 @@ translate_device_classes (GdkDisplay *display, else direction = GDK_SCROLL_RIGHT; - GDK_DISPLAY_NOTE (display, INPUT, - g_message ("\n\tscroll valuator %d: %s, increment %f", - scroll_info->number, - scroll_info->scroll_type == XIScrollTypeVertical - ? "vertical" - : "horizontal", - scroll_info->increment)); + GDK_DISPLAY_DEBUG (display, INPUT, "\n\tscroll valuator %d: %s, increment %f", + scroll_info->number, + scroll_info->scroll_type == XIScrollTypeVertical + ? "vertical" + : "horizontal", + scroll_info->increment); _gdk_x11_device_xi2_add_scroll_valuator (GDK_X11_DEVICE_XI2 (device), scroll_info->number, @@ -520,17 +521,19 @@ create_device (GdkX11DeviceManagerXI2 *device_manager, break; } - GDK_DISPLAY_NOTE (display, INPUT, - ({ - const char *type_names[] = { "logical", "physical", "floating" }; - const char *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" }; - g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d", +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT)) + { + const char *type_names[] = { "logical", "physical", "floating" }; + const char *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" }; + gdk_debug_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d", dev->name, type_names[type], source_names[input_source], dev->use == XIMasterPointer, num_touches); - })); + } +#endif if (dev->use != XIMasterKeyboard && dev->use != XIMasterPointer) @@ -1372,11 +1375,11 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface, g_return_if_fail (GDK_IS_DEVICE (device)); g_return_if_fail (source_device == NULL || GDK_IS_DEVICE (source_device)); - GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS, - g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s", - GDK_SURFACE_XID (surface), - notify_details[detail], - notify_modes[mode])); + GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS, + "focus out:\t\twindow: %ld, detail: %s, mode: %s", + GDK_SURFACE_XID (surface), + notify_details[detail], + notify_modes[mode]); toplevel = _gdk_x11_surface_get_toplevel (surface); @@ -1525,16 +1528,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, GdkTranslatedKey translated; GdkTranslatedKey no_lock; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("key %s:\twindow %ld\n" - "\tdevice:%u\n" - "\tsource device:%u\n" - "\tkey number: %u\n", - (ev->evtype == XI_KeyPress) ? "press" : "release", - xev->event, - xev->deviceid, - xev->sourceid, - xev->detail)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "key %s:\twindow %ld\n" + "\tdevice:%u\n" + "\tsource device:%u\n" + "\tkey number: %u\n", + (ev->evtype == XI_KeyPress) ? "press" : "release", + xev->event, + xev->deviceid, + xev->sourceid, + xev->detail); state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); @@ -1608,18 +1611,18 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, { XIDeviceEvent *xev = (XIDeviceEvent *) ev; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("button %s:\twindow %ld\n" - "\tdevice:%u\n" - "\tsource device:%u\n" - "\tbutton number: %u\n" - "\tx,y: %.2f %.2f", - (ev->evtype == XI_ButtonPress) ? "press" : "release", - xev->event, - xev->deviceid, - xev->sourceid, - xev->detail, - xev->event_x, xev->event_y)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "button %s:\twindow %ld\n" + "\tdevice:%u\n" + "\tsource device:%u\n" + "\tbutton number: %u\n" + "\tx,y: %.2f %.2f", + (ev->evtype == XI_ButtonPress) ? "press" : "release", + xev->event, + xev->deviceid, + xev->sourceid, + xev->detail, + xev->event_x, xev->event_y); #ifdef XINPUT_2_2 if (xev->flags & XIPointerEmulated) @@ -1732,10 +1735,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, GdkModifierType state; GdkScrollDirection direction; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f", + GDK_DISPLAY_DEBUG (display, EVENTS, + "smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f", xev->deviceid, xev->sourceid, - xev->event, delta_x, delta_y)); + xev->event, delta_x, delta_y); state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group); @@ -1815,12 +1818,12 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, double x, y; double *axes; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("touch %s:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", - ev->evtype == XI_TouchBegin ? "begin" : "end", - xev->event, - xev->detail, - xev->flags & XITouchEmulatingPointer ? "true" : "false")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "touch %s:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", + ev->evtype == XI_TouchBegin ? "begin" : "end", + xev->event, + xev->detail, + xev->flags & XITouchEmulatingPointer ? "true" : "false"); device = g_hash_table_lookup (device_manager->id_table, GUINT_TO_POINTER (xev->deviceid)); @@ -1866,11 +1869,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, double x, y; double *axes; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("touch update:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", - xev->event, - xev->detail, - xev->flags & XITouchEmulatingPointer ? "true" : "false")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "touch update:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s", + xev->event, + xev->detail, + xev->flags & XITouchEmulatingPointer ? "true" : "false"); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -1931,12 +1934,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, } #endif - GDK_NOTE (EVENTS, - g_message ("pinch gesture %s:\twindow %ld\n\tfinger_count: %u%s", - event_name, - xev->event, - xev->detail, - xev->flags & XIGesturePinchEventCancelled ? "\n\tcancelled" : "")); + GDK_DEBUG (EVENTS, "pinch gesture %s:\twindow %ld\n\tfinger_count: %u%s", + event_name, + xev->event, + xev->detail, + xev->flags & XIGesturePinchEventCancelled ? "\n\tcancelled" : ""); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -1992,12 +1994,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, } #endif - GDK_NOTE (EVENTS, - g_message ("swipe gesture %s:\twindow %ld\n\tfinger_count: %u%s", - event_name, - xev->event, - xev->detail, - xev->flags & XIGestureSwipeEventCancelled ? "\n\tcancelled" : "")); + GDK_DEBUG (EVENTS, "swipe gesture %s:\twindow %ld\n\tfinger_count: %u%s", + event_name, + xev->event, + xev->detail, + xev->flags & XIGestureSwipeEventCancelled ? "\n\tcancelled" : ""); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); @@ -2031,14 +2032,14 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, XIEnterEvent *xev = (XIEnterEvent *) ev; GdkModifierType state; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("%s notify:\twindow %ld\n\tsubwindow:%ld\n" - "\tdevice: %u\n\tsource device: %u\n" - "\tnotify type: %u\n\tcrossing mode: %u", - (ev->evtype == XI_Enter) ? "enter" : "leave", - xev->event, xev->child, - xev->deviceid, xev->sourceid, - xev->detail, xev->mode)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "%s notify:\twindow %ld\n\tsubwindow:%ld\n" + "\tdevice: %u\n\tsource device: %u\n" + "\tnotify type: %u\n\tcrossing mode: %u", + (ev->evtype == XI_Enter) ? "enter" : "leave", + xev->event, xev->child, + xev->deviceid, xev->sourceid, + xev->detail, xev->mode); device = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (xev->deviceid)); diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 84a45dc814..cfa0e3474e 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -680,17 +680,17 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, switch (xevent->type) { case KeymapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, g_message ("keymap notify")); + GDK_DISPLAY_DEBUG (display, EVENTS, "keymap notify"); /* Not currently handled */ break; case Expose: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d", - xevent->xexpose.window, xevent->xexpose.count, - xevent->xexpose.x, xevent->xexpose.y, - xevent->xexpose.width, xevent->xexpose.height)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d", + xevent->xexpose.window, xevent->xexpose.count, + xevent->xexpose.x, xevent->xexpose.y, + xevent->xexpose.width, xevent->xexpose.height); if (surface == NULL) break; @@ -718,9 +718,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, GdkRectangle expose_rect; int x2, y2; - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("graphics expose:\tdrawable: %ld", - xevent->xgraphicsexpose.drawable)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "graphics expose:\tdrawable: %ld", + xevent->xgraphicsexpose.drawable); if (surface == NULL) break; @@ -763,23 +763,23 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case CreateNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("create notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d parent: %ld ovr: %d", - xevent->xcreatewindow.window, - xevent->xcreatewindow.x, - xevent->xcreatewindow.y, - xevent->xcreatewindow.width, - xevent->xcreatewindow.height, - xevent->xcreatewindow.border_width, - xevent->xcreatewindow.parent, - xevent->xcreatewindow.override_redirect)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "create notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d parent: %ld ovr: %d", + xevent->xcreatewindow.window, + xevent->xcreatewindow.x, + xevent->xcreatewindow.y, + xevent->xcreatewindow.width, + xevent->xcreatewindow.height, + xevent->xcreatewindow.border_width, + xevent->xcreatewindow.parent, + xevent->xcreatewindow.override_redirect); /* not really handled */ break; case DestroyNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("destroy notify:\twindow: %ld", - xevent->xdestroywindow.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "destroy notify:\twindow: %ld", + xevent->xdestroywindow.window); if (surface) event = gdk_delete_event_new (surface); @@ -790,9 +790,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case UnmapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("unmap notify:\t\twindow: %ld", - xevent->xmap.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "unmap notify:\t\twindow: %ld", + xevent->xmap.window); if (surface) { @@ -833,9 +833,9 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case MapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("map notify:\t\twindow: %ld", - xevent->xmap.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "map notify:\t\twindow: %ld", + xevent->xmap.window); if (surface) { @@ -858,29 +858,29 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case ReparentNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("reparent notify:\twindow: %ld x,y: %d %d parent: %ld ovr: %d", - xevent->xreparent.window, - xevent->xreparent.x, - xevent->xreparent.y, - xevent->xreparent.parent, - xevent->xreparent.override_redirect)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "reparent notify:\twindow: %ld x,y: %d %d parent: %ld ovr: %d", + xevent->xreparent.window, + xevent->xreparent.x, + xevent->xreparent.y, + xevent->xreparent.parent, + xevent->xreparent.override_redirect); /* Not currently handled */ break; case ConfigureNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d%s", - xevent->xconfigure.window, - xevent->xconfigure.x, - xevent->xconfigure.y, - xevent->xconfigure.width, - xevent->xconfigure.height, - xevent->xconfigure.border_width, - xevent->xconfigure.above, - xevent->xconfigure.override_redirect, - !surface ? " (discarding)" : "")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d%s", + xevent->xconfigure.window, + xevent->xconfigure.x, + xevent->xconfigure.y, + xevent->xconfigure.width, + xevent->xconfigure.height, + xevent->xconfigure.border_width, + xevent->xconfigure.above, + xevent->xconfigure.override_redirect, + !surface ? " (discarding)" : ""); if (_gdk_x11_display_is_root_window (display, xevent->xconfigure.window)) { _gdk_x11_screen_size_changed (x11_screen, xevent); @@ -980,13 +980,13 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case PropertyNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s", - xevent->xproperty.window, - xevent->xproperty.atom, - "\"", - gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom), - "\"")); + GDK_DISPLAY_DEBUG (display, EVENTS, + "property notify:\twindow: %ld, atom(%ld): %s%s%s", + xevent->xproperty.window, + xevent->xproperty.atom, + "\"", + gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom), + "\""); if (surface == NULL) break; @@ -1009,24 +1009,23 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, break; case ColormapNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("colormap notify:\twindow: %ld", - xevent->xcolormap.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "colormap notify:\twindow: %ld", + xevent->xcolormap.window); /* Not currently handled */ break; case ClientMessage: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("client message:\twindow: %ld", - xevent->xclient.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "client message:\twindow: %ld", + xevent->xclient.window); /* Not currently handled */ break; case MappingNotify: - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("mapping notify")); + GDK_DISPLAY_DEBUG (display, EVENTS, "mapping notify"); /* Let XLib know that there is a new keyboard mapping. */ @@ -1244,9 +1243,9 @@ _gdk_wm_protocols_filter (const XEvent *xevent, * the event is passed along to the program, * which should then destroy the window. */ - GDK_DISPLAY_NOTE (display, EVENTS, - g_message ("delete window:\t\twindow: %ld", - xevent->xclient.window)); + GDK_DISPLAY_DEBUG (display, EVENTS, + "delete window:\t\twindow: %ld", + xevent->xclient.window); *event = gdk_delete_event_new (win); @@ -1592,11 +1591,12 @@ gdk_x11_display_open (const char *display_name) True, &detectable_autorepeat_supported); - GDK_NOTE (MISC, g_message ("Detectable autorepeat %s.", - detectable_autorepeat_supported ? - "supported" : "not supported")); - - display_x11->have_xkb_autorepeat = detectable_autorepeat_supported; + GDK_DEBUG (MISC, "Detectable autorepeat %s.", + detectable_autorepeat_supported + ? "supported" + : "not supported"); + + display_x11->have_xkb_autorepeat = detectable_autorepeat_supported; } } } diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 7e7904904b..2e1a2870ee 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -844,9 +844,9 @@ gdk_x11_drag_handle_status (GdkDisplay *display, drag = gdk_x11_drag_find (display, xevent->xclient.window, dest_surface); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndStatus: dest_surface: %#x action: %ld", - dest_surface, action)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndStatus: dest_surface: %#x action: %ld", + dest_surface, action); if (drag) { @@ -856,8 +856,8 @@ gdk_x11_drag_handle_status (GdkDisplay *display, if (!(action != 0) != !(flags & 1)) { - GDK_DISPLAY_NOTE (display, DND, - g_warning ("Received status event with flags not corresponding to action!")); + GDK_DISPLAY_DEBUG (display, DND, + "Received status event with flags not corresponding to action!"); action = 0; } @@ -876,8 +876,8 @@ gdk_x11_drag_handle_finished (GdkDisplay *display, drag = gdk_x11_drag_find (display, xevent->xclient.window, dest_surface); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndFinished: dest_surface: %#x", dest_surface)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndFinished: dest_surface: %#x", dest_surface); if (drag) { @@ -977,9 +977,9 @@ send_client_message_async_cb (Window window, GdkX11Drag *drag_x11 = data; GdkDrag *drag = data; - GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, - g_message ("Got async callback for #%lx, success = %d", - window, success)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (drag), DND, + "Got async callback for #%lx, success = %d", + window, success); /* On failure, we immediately continue with the protocol * so we don't end up blocking for a timeout @@ -1061,9 +1061,9 @@ xdnd_send_enter (GdkX11Drag *drag_x11) xev.xclient.data.l[3] = 0; xev.xclient.data.l[4] = 0; - GDK_DISPLAY_NOTE (display, DND, - g_message ("Sending enter source window %#lx XDND protocol version %d\n", - GDK_SURFACE_XID (drag_x11->ipc_surface), drag_x11->version)); + GDK_DISPLAY_DEBUG (display, DND, + "Sending enter source window %#lx XDND protocol version %d\n", + GDK_SURFACE_XID (drag_x11->ipc_surface), drag_x11->version); formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); formats = gdk_content_formats_union_serialize_mime_types (formats); @@ -1195,8 +1195,8 @@ xdnd_check_dest (GdkDisplay *display, } else { - GDK_DISPLAY_NOTE (display, DND, - g_warning ("Invalid XdndProxy property on window %ld", win)); + GDK_DISPLAY_DEBUG (display, DND, + "Invalid XdndProxy property on window %ld", win); } XFree (proxy_data); @@ -1220,8 +1220,8 @@ xdnd_check_dest (GdkDisplay *display, } else { - GDK_DISPLAY_NOTE (display, DND, - g_warning ("Invalid XdndAware property on window %ld", win)); + GDK_DISPLAY_DEBUG (display, DND, + "Invalid XdndAware property on window %ld", win); } XFree (version); @@ -1286,20 +1286,20 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display, { *protocol = GDK_DRAG_PROTO_XDND; *version = 5; - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering local Xdnd window %#x\n", (guint) xid)); + GDK_DISPLAY_DEBUG (display, DND, "Entering local Xdnd window %#x", (guint) xid); return xid; } else if (_gdk_x11_display_is_root_window (display, xid)) { *protocol = GDK_DRAG_PROTO_ROOTWIN; - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering root window\n")); + GDK_DISPLAY_DEBUG (display, DND, "Entering root window"); return xid; } } else if ((retval = xdnd_check_dest (display, xid, version))) { *protocol = GDK_DRAG_PROTO_XDND; - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering Xdnd window %#x\n", (guint) xid)); + GDK_DISPLAY_DEBUG (display, DND, "Entering Xdnd window %#x", (guint) xid); return retval; } else @@ -1312,7 +1312,7 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display, if (rootwin) { - GDK_DISPLAY_NOTE (display, DND, g_message ("Entering root window\n")); + GDK_DISPLAY_DEBUG (display, DND, "Entering root window"); *protocol = GDK_DRAG_PROTO_ROOTWIN; return xid; } @@ -1621,9 +1621,7 @@ gdk_x11_drag_default_output_closed (GObject *stream, if (!g_output_stream_close_finish (G_OUTPUT_STREAM (stream), result, &error)) { - GDK_NOTE (DND, - g_printerr ("failed to close stream: %s\n", - error->message)); + GDK_DEBUG (DND, "failed to close stream: %s", error->message); g_error_free (error); } @@ -1640,7 +1638,7 @@ gdk_x11_drag_default_output_done (GObject *drag, if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error)) { - GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_printerr ("failed to write stream: %s\n", error->message)); + GDK_DISPLAY_DEBUG (gdk_drag_get_display (GDK_DRAG (drag)), DND, "failed to write stream: %s", error->message); g_error_free (error); } @@ -1689,12 +1687,13 @@ gdk_x11_drag_xevent (GdkDisplay *display, if (xevent->xselectionclear.time < x11_drag->timestamp) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("ignoring SelectionClear with too old timestamp (%lu vs %lu)\n", - xevent->xselectionclear.time, x11_drag->timestamp)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "ignoring SelectionClear with too old timestamp (%lu vs %lu)", + xevent->xselectionclear.time, x11_drag->timestamp); return FALSE; } - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionClear, aborting DND\n")); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, "got SelectionClear, aborting DND"); gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR); return TRUE; @@ -1718,13 +1717,15 @@ gdk_x11_drag_xevent (GdkDisplay *display, if (xevent->xselectionrequest.requestor == None) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s with NULL window, ignoring\n", - target, property)); + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "got SelectionRequest for %s @ %s with NULL window, ignoring", + target, property); return TRUE; } - - GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s\n", - target, property)); + + GDK_DISPLAY_DEBUG (display, CLIPBOARD, + "got SelectionRequest for %s @ %s", + target, property); formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); formats = gdk_content_formats_union_serialize_mime_types (formats); @@ -2080,7 +2081,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface, x11_drag->timestamp); if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_SURFACE_XID (x11_drag->ipc_surface)) { - GDK_DISPLAY_NOTE (display, DND, g_printerr ("failed XSetSelectionOwner() on \"XdndSelection\", aborting DND\n")); + GDK_DISPLAY_DEBUG (display, DND, "failed XSetSelectionOwner() on \"XdndSelection\", aborting DND"); g_object_unref (drag); return NULL; } diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c index 05b07ca990..33a2afb83c 100644 --- a/gdk/x11/gdkdrop-x11.c +++ b/gdk/x11/gdkdrop-x11.c @@ -165,8 +165,9 @@ gdk_x11_drop_read_got_stream (GObject *source, { GdkDrop *drop = GDK_DROP (g_task_get_source_object (task)); - GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, g_printerr ("reading %s failed, trying %s next\n", - (char *) targets->data, (char *) next->data)); + GDK_DISPLAY_DEBUG (gdk_drop_get_display (drop), DND, + "reading %s failed, trying %s next", + (char *) targets->data, (char *) next->data); targets->next = NULL; g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free); gdk_x11_selection_input_stream_new_async (gdk_drop_get_display (drop), @@ -202,8 +203,9 @@ gdk_x11_drop_read_got_stream (GObject *source, } } - GDK_NOTE (DND, g_printerr ("reading DND as %s now\n", - (const char *)((GSList *) g_task_get_task_data (task))->data)); + GDK_DISPLAY_DEBUG (gdk_drop_get_display (drop), DND, + "reading DND as %s now", + (const char *)((GSList *) g_task_get_task_data (task))->data); g_task_return_pointer (task, stream, g_object_unref); } @@ -234,8 +236,9 @@ gdk_x11_drop_read_async (GdkDrop *drop, return; } - GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, g_printerr ("new read for %s (%u other options)\n", - (char *) targets->data, g_slist_length (targets->next))); + GDK_DISPLAY_DEBUG (gdk_drop_get_display (drop), DND, + "new read for %s (%u other options)", + (char *) targets->data, g_slist_length (targets->next)); gdk_x11_selection_input_stream_new_async (gdk_drop_get_display (drop), "XdndSelection", targets->data, @@ -495,14 +498,14 @@ xdnd_enter_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndEnter: source_window: %#lx, version: %#x", - source_window, version)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndEnter: source_window: %#lx, version: %#x", + source_window, version); if (version < 3) { /* Old source ignore */ - GDK_DISPLAY_NOTE (display, DND, g_message ("Ignored old XdndEnter message")); + GDK_DISPLAY_DEBUG (display, DND, "Ignored old XdndEnter message"); return TRUE; } @@ -607,9 +610,9 @@ xdnd_leave_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndLeave: source_window: %#lx", - source_window)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndLeave: source_window: %#lx", + source_window); if ((display_x11->current_drop != NULL) && (GDK_X11_DROP (display_x11->current_drop)->source_window == source_window)) @@ -641,9 +644,9 @@ xdnd_position_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndPosition: source_window: %#lx position: (%d, %d) time: %d action: %ld", - source_window, x_root, y_root, time, action)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndPosition: source_window: %#lx position: (%d, %d) time: %d action: %ld", + source_window, x_root, y_root, time, action); drop = display_x11->current_drop; drop_x11 = GDK_X11_DROP (drop); @@ -688,9 +691,9 @@ xdnd_drop_filter (GdkSurface *surface, display = gdk_surface_get_display (surface); display_x11 = GDK_X11_DISPLAY (display); - GDK_DISPLAY_NOTE (display, DND, - g_message ("XdndDrop: source_window: %#lx time: %d", - source_window, time)); + GDK_DISPLAY_DEBUG (display, DND, + "XdndDrop: source_window: %#lx time: %d", + source_window, time); drop = display_x11->current_drop; drop_x11 = GDK_X11_DROP (drop); @@ -745,14 +748,10 @@ gdk_x11_drop_do_nothing (Window window, gboolean success, gpointer data) { -#ifdef G_ENABLE_DEBUG - GdkDisplay *display = data; - if (!success) { - GDK_DISPLAY_NOTE (display, DND, g_message ("Send event to %lx failed", window)); + GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), DND, "Send event to %lx failed", window); } -#endif } static void diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c index 2033e42902..717426cf68 100644 --- a/gdk/x11/gdkglcontext-glx.c +++ b/gdk/x11/gdkglcontext-glx.c @@ -137,11 +137,11 @@ gdk_x11_gl_context_glx_end_frame (GdkDrawContext *draw_context, drawable = gdk_x11_surface_get_glx_drawable (surface); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Flushing GLX buffers for drawable %lu (window: %lu), frame sync: %s", - (unsigned long) drawable, - (unsigned long) gdk_x11_surface_get_xid (surface), - self->do_frame_sync ? "yes" : "no")); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Flushing GLX buffers for drawable %lu (window: %lu), frame sync: %s", + (unsigned long) drawable, + (unsigned long) gdk_x11_surface_get_xid (surface), + self->do_frame_sync ? "yes" : "no"); gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "x11", "swap buffers"); @@ -228,9 +228,9 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context, surface = GDK_X11_DISPLAY (display)->leader_gdk_surface; drawable = gdk_x11_surface_get_glx_drawable (surface); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Making GLX context %p current to drawable %lu", - context, (unsigned long) drawable)); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Making GLX context %p current to drawable %lu", + context, (unsigned long) drawable); if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context)) return FALSE; @@ -506,13 +506,13 @@ gdk_x11_context_create_glx_context (GdkGLContext *context, context_attribs[i++] = None; g_assert (i < N_GLX_ATTRS); - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)", - major, minor, - debug_bit ? "yes" : "no", - compat_bit ? "yes" : "no", - legacy ? "yes" : "no", - api == GDK_GL_API_GLES ? "yes" : "no")); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)", + major, minor, + debug_bit ? "yes" : "no", + compat_bit ? "yes" : "no", + legacy ? "yes" : "no", + api == GDK_GL_API_GLES ? "yes" : "no"); if (share != NULL) share_glx = GDK_X11_GL_CONTEXT_GLX (share); @@ -539,13 +539,12 @@ gdk_x11_context_create_glx_context (GdkGLContext *context, if (gdk_x11_display_error_trap_pop (display) || ctx == NULL) return 0; - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("Realized GLX context[%p], %s, version: %d.%d", - context_glx->glx_context, - glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect", - display_x11->glx_version / 10, - - display_x11->glx_version % 10)); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Realized GLX context[%p], %s, version: %d.%d", + context_glx->glx_context, + glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect", + display_x11->glx_version / 10, + display_x11->glx_version % 10); context_glx->glx_context = ctx; gdk_gl_context_set_is_legacy (context, legacy); @@ -660,7 +659,7 @@ gdk_x11_gl_context_glx_dispose (GObject *gobject) if (glXGetCurrentContext () == context_glx->glx_context) glXMakeContextCurrent (dpy, None, None, NULL); - GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying GLX context")); + GDK_DISPLAY_DEBUG (display, OPENGL, "Destroying GLX context"); glXDestroyContext (dpy, context_glx->glx_context); context_glx->glx_context = NULL; } @@ -771,7 +770,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, { if (best_features < WITH_MULTISAMPLING) { - GDK_NOTE (OPENGL, g_message ("Best GLX config is %u for visual 0x%lX with multisampling", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Best GLX config is %u for visual 0x%lX with multisampling", i, visinfo->visualid); best_features = WITH_MULTISAMPLING; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -786,7 +785,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, { if (best_features < WITH_STENCIL_AND_DEPTH_BUFFER) { - GDK_NOTE (OPENGL, g_message ("Best GLX config is %u for visual 0x%lX with a stencil or depth buffer", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Best GLX config is %u for visual 0x%lX with a stencil or depth buffer", i, visinfo->visualid); best_features = WITH_STENCIL_AND_DEPTH_BUFFER; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -800,7 +799,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, { if (best_features < NO_ALPHA_VISUAL) { - GDK_NOTE (OPENGL, g_message ("Best GLX config is %u for visual 0x%lX with no RGBA Visual", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "Best GLX config is %u for visual 0x%lX with no RGBA Visual", i, visinfo->visualid); best_features = NO_ALPHA_VISUAL; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -810,7 +809,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self, continue; } - GDK_NOTE (OPENGL, g_message ("GLX config %u for visual 0x%lX is the perfect choice", i, visinfo->visualid)); + GDK_DISPLAY_DEBUG (display, OPENGL, "GLX config %u for visual 0x%lX is the perfect choice", i, visinfo->visualid); best_features = PERFECT; *out_visual = visinfo->visual; *out_depth = visinfo->depth; @@ -966,8 +965,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11, if (!gdk_x11_display_create_glx_config (display_x11, out_visual, out_depth, error)) return FALSE; - GDK_DISPLAY_NOTE (display, OPENGL, - g_message ("GLX version %d.%d found\n" + GDK_DISPLAY_DEBUG (display, OPENGL, + "GLX version %d.%d found\n" " - Vendor: %s\n" " - Checked extensions:\n" "\t* GLX_ARB_create_context_profile: %s\n" @@ -976,8 +975,8 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11, "\t* GLX_EXT_texture_from_pixmap: %s\n" "\t* GLX_SGI_video_sync: %s\n" "\t* GLX_EXT_buffer_age: %s\n" - "\t* GLX_OML_sync_control: %s" - "\t* GLX_ARB_multisample: %s" + "\t* GLX_OML_sync_control: %s\n" + "\t* GLX_ARB_multisample: %s\n" "\t* GLX_EXT_visual_rating: %s", display_x11->glx_version / 10, display_x11->glx_version % 10, @@ -990,7 +989,7 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11, display_x11->has_glx_buffer_age ? "yes" : "no", display_x11->has_glx_sync_control ? "yes" : "no", display_x11->has_glx_multisample ? "yes" : "no", - display_x11->has_glx_visual_rating ? "yes" : "no")); + display_x11->has_glx_visual_rating ? "yes" : "no"); return TRUE; } diff --git a/gdk/x11/gdkselectioninputstream-x11.c b/gdk/x11/gdkselectioninputstream-x11.c index 6e10867abd..2f2ed7d6e8 100644 --- a/gdk/x11/gdkselectioninputstream-x11.c +++ b/gdk/x11/gdkselectioninputstream-x11.c @@ -135,9 +135,10 @@ gdk_x11_selection_input_stream_flush (GdkX11SelectionInputStream *stream) return; written = gdk_x11_selection_input_stream_fill_buffer (stream, priv->pending_data, priv->pending_size); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: finishing read of %zd/%zu bytes\n", - priv->selection, priv->target, - written, priv->pending_size)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: finishing read of %zd/%zu bytes", + priv->selection, priv->target, + written, priv->pending_size); g_task_return_int (priv->pending_task, written); g_clear_object (&priv->pending_task); @@ -153,8 +154,9 @@ gdk_x11_selection_input_stream_complete (GdkX11SelectionInputStream *stream) if (priv->complete) return; - GDK_NOTE (SELECTION, g_printerr ("%s:%s: transfer complete\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: transfer complete", + priv->selection, priv->target); priv->complete = TRUE; g_async_queue_push (priv->chunks, g_bytes_new (NULL, 0)); @@ -181,13 +183,13 @@ gdk_x11_selection_input_stream_read (GInputStream *input_stream, #endif gssize written; - GDK_NOTE (SELECTION, g_printerr ("%s:%s: starting sync read of %zu bytes\n", - priv->selection, priv->target, - count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: starting sync read of %zu bytes", + priv->selection, priv->target, count); written = gdk_x11_selection_input_stream_fill_buffer (stream, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: finishing sync read of %zd/%zu bytes\n", - priv->selection, priv->target, - written, count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: finishing sync read of %zd/%zu bytes", + priv->selection, priv->target, written, count); return written; } @@ -221,9 +223,9 @@ gdk_x11_selection_input_stream_read_async (GInputStream *input_stream, gssize size; size = gdk_x11_selection_input_stream_fill_buffer (stream, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: async read of %zd/%zu bytes\n", - priv->selection, priv->target, - size, count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: async read of %zd/%zu bytes", + priv->selection, priv->target, size, count); g_task_return_int (task, size); g_object_unref (task); } @@ -232,9 +234,9 @@ gdk_x11_selection_input_stream_read_async (GInputStream *input_stream, priv->pending_data = buffer; priv->pending_size = count; priv->pending_task = task; - GDK_NOTE (SELECTION, g_printerr ("%s:%s: async read of %zu bytes pending\n", - priv->selection, priv->target, - count)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: async read of %zu bytes pending", + priv->selection, priv->target, count); } } @@ -410,23 +412,26 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, bytes = get_selection_property (xdisplay, xwindow, xevent->xproperty.atom, &type, &format); if (bytes == NULL) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify erroring out of INCR\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify erroring out of INCR", + priv->selection, priv->target); /* error, should we signal one? */ gdk_x11_selection_input_stream_complete (stream); } else if (g_bytes_get_size (bytes) == 0 || type == None) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify ending INCR\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify ending INCR", + priv->selection, priv->target); g_bytes_unref (bytes); gdk_x11_selection_input_stream_complete (stream); } else { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify during INCR with %zu bytes\n", - priv->selection, priv->target, - g_bytes_get_size (bytes))); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify during INCR with %zu bytes", + priv->selection, priv->target, + g_bytes_get_size (bytes)); g_async_queue_push (priv->chunks, bytes); gdk_x11_selection_input_stream_flush (stream); } @@ -449,7 +454,9 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, g_task_get_source_tag (priv->pending_task) != gdk_x11_selection_input_stream_new_async) return FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got SelectionNotify\n", priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got SelectionNotify", + priv->selection, priv->target); task = priv->pending_task; priv->pending_task = NULL; @@ -470,7 +477,7 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, g_task_return_pointer (task, g_object_ref (stream), g_object_unref); if (bytes == NULL) - { + { gdk_x11_selection_input_stream_complete (stream); } else @@ -479,15 +486,18 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay *display, { /* The remainder of the selection will come through PropertyNotify events on xwindow */ - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n", priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: initiating INCR transfer", + priv->selection, priv->target); priv->incr = TRUE; gdk_x11_selection_input_stream_flush (stream); } else { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: reading %zu bytes\n", - priv->selection, priv->target, - g_bytes_get_size (bytes))); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: reading %zu bytes", + priv->selection, priv->target, + g_bytes_get_size (bytes)); g_async_queue_push (priv->chunks, bytes); gdk_x11_selection_input_stream_complete (stream); diff --git a/gdk/x11/gdkselectionoutputstream-x11.c b/gdk/x11/gdkselectionoutputstream-x11.c index da77d5db82..d81d995fc9 100644 --- a/gdk/x11/gdkselectionoutputstream-x11.c +++ b/gdk/x11/gdkselectionoutputstream-x11.c @@ -118,17 +118,19 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify, notify->n_pending--; if (notify->n_pending) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: not sending SelectionNotify yet, %zu streams still pending\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), - notify->n_pending)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: not sending SelectionNotify yet, %zu streams still pending", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), + notify->n_pending); return; } - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: sending SelectionNotify reporting %s\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), - success ? "success" : "failure")); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: sending SelectionNotify reporting %s", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), + success ? "success" : "failure"); if (!success) notify->xevent.property = None; @@ -138,19 +140,21 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify, if (XSendEvent (xdisplay, notify->xevent.requestor, False, NoEventMask, (XEvent*) ¬ify->xevent) == 0) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: failed to XSendEvent()\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target))); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: failed to XSendEvent()", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target)); } XSync (xdisplay, False); error = gdk_x11_display_error_trap_pop (display); if (error != Success) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: X error during write: %d\n", - gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), - gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), - error)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: X error during write: %d", + gdk_x11_get_xatom_name_for_display (display, notify->xevent.selection), + gdk_x11_get_xatom_name_for_display (display, notify->xevent.target), + error); } gdk_x11_pending_selection_notify_free (notify); @@ -254,8 +258,9 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre XWindowAttributes attrs; priv->incr = TRUE; - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: initiating INCR transfer", + priv->selection, priv->target); XGetWindowAttributes (xdisplay, priv->xwindow, @@ -284,8 +289,9 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre PropModeReplace, priv->data->data, n_elements); - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: wrote %zu/%u bytes\n", - priv->selection, priv->target, n_elements * element_size, priv->data->len)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: wrote %zu/%u bytes", + priv->selection, priv->target, n_elements * element_size, priv->data->len); g_byte_array_remove_range (priv->data, 0, n_elements * element_size); if (priv->data->len < element_size) priv->flush_requested = FALSE; @@ -308,8 +314,9 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre error = gdk_x11_display_error_trap_pop (priv->display); if (error != Success) { - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: X error during write: %d\n", - priv->selection, priv->target, error)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: X error during write: %d", + priv->selection, priv->target, error); } if (priv->pending_task) @@ -344,8 +351,9 @@ gdk_x11_selection_output_stream_write (GOutputStream *output_stream, g_mutex_lock (&priv->mutex); g_byte_array_append (priv->data, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: wrote %zu bytes, %u total now\n", - priv->selection, priv->target, count, priv->data->len)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: wrote %zu bytes, %u total now", + priv->selection, priv->target, count, priv->data->len); g_mutex_unlock (&priv->mutex); g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_flush, stream); @@ -377,8 +385,9 @@ gdk_x11_selection_output_stream_write_async (GOutputStream *output_stream g_mutex_lock (&priv->mutex); g_byte_array_append (priv->data, buffer, count); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: async wrote %zu bytes, %u total now\n", - priv->selection, priv->target, count, priv->data->len)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: async wrote %zu bytes, %u total now", + priv->selection, priv->target, count, priv->data->len); g_mutex_unlock (&priv->mutex); if (!gdk_x11_selection_output_stream_needs_flush (stream)) @@ -428,8 +437,9 @@ gdk_x11_selection_output_request_flush (GdkX11SelectionOutputStream *stream) needs_flush = gdk_x11_selection_output_stream_needs_flush_unlocked (stream); g_mutex_unlock (&priv->mutex); - GDK_NOTE (SELECTION, g_printerr ("%s:%s: requested flush%s\n", - priv->selection, priv->target, needs_flush ?"" : ", but not needed")); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: requested flush%s", + priv->selection, priv->target, needs_flush ?"" : ", but not needed"); return needs_flush; } @@ -511,8 +521,9 @@ gdk_x11_selection_output_stream_finalize (GObject *object) /* not sending a notify is terrible */ g_assert (priv->notify == NULL); - GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: finalizing\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (priv->display, SELECTION, + "%s:%s: finalizing", + priv->selection, priv->target); GDK_X11_DISPLAY (priv->display)->streams = g_slist_remove (GDK_X11_DISPLAY (priv->display)->streams, stream); g_signal_handlers_disconnect_by_func (priv->display, gdk_x11_selection_output_stream_xevent, @@ -580,8 +591,9 @@ gdk_x11_selection_output_stream_xevent (GdkDisplay *display, xevent->xproperty.state != PropertyDelete) return FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify Delete during INCR\n", - priv->selection, priv->target)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s:%s: got PropertyNotify Delete during INCR", + priv->selection, priv->target); priv->delete_pending = FALSE; if (gdk_x11_selection_output_stream_needs_flush (stream) && gdk_x11_selection_output_stream_can_flush (stream)) @@ -641,16 +653,20 @@ print_atoms (GdkDisplay *display, const Atom *atoms, gsize n_atoms) { - GDK_DISPLAY_NOTE (display, CLIPBOARD, - gsize i; - - g_printerr ("%s: %s [ ", selection, prefix); - for (i = 0; i < n_atoms; i++) - { - g_printerr ("%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); - } - g_printerr (" ]\n"); - ); +#ifdef G_ENABLE_DEBUG + if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD)) + { + GString *str; + + str = g_string_new (""); + g_string_append_printf (str, "%s: %s [ ", selection, prefix); + for (gsize i = 0; i < n_atoms; i++) + g_string_append_printf (str, "%s%s", i > 0 ? ", " : "", gdk_x11_get_xatom_name_for_display (display , atoms[i])); + g_string_append (str, " ]"); + gdk_debug_message ("%s", str->str); + g_string_free (str, TRUE); + } +#endif } static void @@ -663,8 +679,8 @@ handle_targets_done (GObject *stream, if (!g_output_stream_write_all_finish (G_OUTPUT_STREAM (stream), result, &bytes_written, &error)) { - GDK_NOTE (CLIPBOARD, g_printerr ("---: failed to send targets after %zu bytes: %s\n", - bytes_written, error->message)); + GDK_DEBUG (CLIPBOARD, "---: failed to send targets after %zu bytes: %s", + bytes_written, error->message); g_error_free (error); } @@ -710,8 +726,8 @@ handle_timestamp_done (GObject *stream, if (!g_output_stream_write_all_finish (G_OUTPUT_STREAM (stream), result, &bytes_written, &error)) { - GDK_NOTE (CLIPBOARD, g_printerr ("---: failed to send timestamp after %zu bytes: %s\n", - bytes_written, error->message)); + GDK_DEBUG (CLIPBOARD, "---: failed to send timestamp after %zu bytes: %s", + bytes_written, error->message); g_error_free (error); } @@ -873,14 +889,16 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, &n_atoms, &nbytes, (guchar **) &atoms); if (error != Success) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: XGetProperty() during MULTIPLE failed with %d\n", - selection, error)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: XGetProperty() during MULTIPLE failed with %d", + selection, error); } else if (prop_format != 32 || prop_type != gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR")) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: XGetProperty() type/format should be ATOM_PAIR/32 but is %s/%d\n", - selection, gdk_x11_get_xatom_name_for_display (display, prop_type), prop_format)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: XGetProperty() type/format should be ATOM_PAIR/32 but is %s/%d", + selection, gdk_x11_get_xatom_name_for_display (display, prop_type), prop_format); } else if (n_atoms < 2) { @@ -893,8 +911,9 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, print_atoms (display, selection, "MULTIPLE request", atoms, n_atoms); if (n_atoms % 2) { - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: Number of atoms is uneven at %lu, ignoring last element\n", - selection, n_atoms)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: Number of atoms is uneven at %lu, ignoring last element", + selection, n_atoms); n_atoms &= ~1; } @@ -907,15 +926,17 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, if (atoms[2 * i] == None || atoms[2 * i + 1] == None) { success = FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: None not allowed as atom in MULTIPLE request\n", - selection)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: None not allowed as atom in MULTIPLE request", + selection); gdk_x11_pending_selection_notify_send (notify, display, FALSE); } else if (atoms[2 * i] == gdk_x11_get_xatom_by_name_for_display (display, "MULTIPLE")) { success = FALSE; - GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: MULTIPLE as target in MULTIPLE request would cause recursion\n", - selection)); + GDK_DISPLAY_DEBUG (display, SELECTION, + "%s: MULTIPLE as target in MULTIPLE request would cause recursion", + selection); gdk_x11_pending_selection_notify_send (notify, display, FALSE); } else diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index f92649782d..2e8bd45c74 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -271,8 +271,8 @@ parse_settings (unsigned char *data, !fetch_card32 (&buffer, &n_entries)) goto out; - GDK_NOTE (SETTINGS, g_message ("reading %lu settings (serial %lu byte order %u)", - (unsigned long)n_entries, (unsigned long)serial, buffer.byte_order)); + GDK_DEBUG (SETTINGS, "reading %lu settings (serial %lu byte order %u)", + (unsigned long)n_entries, (unsigned long)serial, buffer.byte_order); for (i = 0; i < n_entries; i++) { @@ -303,7 +303,7 @@ parse_settings (unsigned char *data, g_value_init (value, G_TYPE_INT); g_value_set_int (value, (gint32) v_int); - GDK_NOTE (SETTINGS, g_message (" %s = %d", x_name, (gint32) v_int)); + GDK_DEBUG (SETTINGS, " %s = %d", x_name, (gint32) v_int); break; case XSETTINGS_TYPE_STRING: { @@ -317,7 +317,7 @@ parse_settings (unsigned char *data, g_value_init (value, G_TYPE_STRING); g_value_take_string (value, s); - GDK_NOTE (SETTINGS, g_message (" %s = \"%s\"", x_name, s)); + GDK_DEBUG (SETTINGS, " %s = \"%s\"", x_name, s); } break; case XSETTINGS_TYPE_COLOR: @@ -340,12 +340,12 @@ parse_settings (unsigned char *data, g_value_init (value, GDK_TYPE_RGBA); g_value_set_boxed (value, &rgba); - GDK_NOTE (SETTINGS, g_message (" %s = #%02X%02X%02X%02X", x_name, alpha,red, green, blue)); + GDK_DEBUG (SETTINGS, " %s = #%02X%02X%02X%02X", x_name, alpha,red, green, blue); } break; default: /* Quietly ignore unknown types */ - GDK_NOTE (SETTINGS, g_message (" %s = ignored (unknown type %u)", x_name, type)); + GDK_DEBUG (SETTINGS, " %s = ignored (unknown type %u)", x_name, type); break; } @@ -355,12 +355,12 @@ parse_settings (unsigned char *data, if (gdk_name == NULL) { - GDK_NOTE (SETTINGS, g_message (" ==> unknown to GTK")); + GDK_DEBUG (SETTINGS, " ==> unknown to GTK"); free_value (value); } else { - GDK_NOTE (SETTINGS, g_message (" ==> storing as '%s'", gdk_name)); + GDK_DEBUG (SETTINGS, " ==> storing as '%s'", gdk_name); if (settings == NULL) settings = g_hash_table_new_full (g_str_hash, g_str_equal, From 1f166ae07118efe0ff93d716338811193eda7f8f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 21:32:54 -0400 Subject: [PATCH 22/30] macos: Use the new debug macros --- gdk/macos/GdkMacosBaseView.c | 132 ++++++++++++++-------------- gdk/macos/gdkdisplaylinksource.c | 9 +- gdk/macos/gdkmacosdisplay.c | 7 +- gdk/macos/gdkmacoseventsource.c | 26 +++--- gdk/macos/gdkmacosglcontext.c | 16 ++-- gdk/macos/gdkmacossurface.c | 7 +- gdk/macos/gdkmacostoplevelsurface.c | 22 +++-- gtk/gtkimcontextquartz.c | 1 + 8 files changed, 107 insertions(+), 113 deletions(-) diff --git a/gdk/macos/GdkMacosBaseView.c b/gdk/macos/GdkMacosBaseView.c index a86d9712b2..676138bb4d 100644 --- a/gdk/macos/GdkMacosBaseView.c +++ b/gdk/macos/GdkMacosBaseView.c @@ -90,19 +90,19 @@ -(BOOL)acceptsFirstResponder { - GDK_NOTE (EVENTS, g_message ("acceptsFirstResponder")); + GDK_DEBUG (EVENTS, "acceptsFirstResponder"); return YES; } -(BOOL)becomeFirstResponder { - GDK_NOTE (EVENTS, g_message ("becomeFirstResponder")); + GDK_DEBUG (EVENTS, "becomeFirstResponder"); return YES; } -(BOOL)resignFirstResponder { - GDK_NOTE (EVENTS, g_message ("resignFirstResponder")); + GDK_DEBUG (EVENTS, "resignFirstResponder"); return YES; } @@ -141,7 +141,7 @@ GIC_FILTER_KEY, GUINT_TO_POINTER (GIC_FILTER_FILTERED)); - GDK_NOTE (EVENTS, g_message ("keyDown")); + GDK_DEBUG (EVENTS, "keyDown"); [self interpretKeyEvents: [NSArray arrayWithObject: theEvent]]; } @@ -151,7 +151,7 @@ -(NSUInteger)characterIndexForPoint:(NSPoint)aPoint { - GDK_NOTE (EVENTS, g_message ("characterIndexForPoint")); + GDK_DEBUG (EVENTS, "characterIndexForPoint"); return 0; } @@ -159,7 +159,7 @@ { GdkRectangle *rect; - GDK_NOTE (EVENTS, g_message ("firstRectForCharacterRange")); + GDK_DEBUG (EVENTS, "firstRectForCharacterRange"); if ((rect = g_object_get_data (G_OBJECT ([self gdkSurface]), GIC_CURSOR_RECT))) { @@ -178,37 +178,37 @@ -(NSArray *)validAttributesForMarkedText { - GDK_NOTE (EVENTS, g_message ("validAttributesForMarkedText")); + GDK_DEBUG (EVENTS, "validAttributesForMarkedText"); return [NSArray arrayWithObjects: NSUnderlineStyleAttributeName, nil]; } -(NSAttributedString *)attributedSubstringForProposedRange: (NSRange)aRange actualRange: (NSRangePointer)actualRange { - GDK_NOTE (EVENTS, g_message ("attributedSubstringForProposedRange")); + GDK_DEBUG (EVENTS, "attributedSubstringForProposedRange"); return nil; } -(BOOL)hasMarkedText { - GDK_NOTE (EVENTS, g_message ("hasMarkedText")); + GDK_DEBUG (EVENTS, "hasMarkedText"); return markedRange.location != NSNotFound && markedRange.length != 0; } -(NSRange)markedRange { - GDK_NOTE (EVENTS, g_message ("markedRange")); + GDK_DEBUG (EVENTS, "markedRange"); return markedRange; } -(NSRange)selectedRange { - GDK_NOTE (EVENTS, g_message ("selectedRange")); + GDK_DEBUG (EVENTS, "selectedRange"); return selectedRange; } -(void)unmarkText { - GDK_NOTE (EVENTS, g_message ("unmarkText")); + GDK_DEBUG (EVENTS, "unmarkText"); selectedRange = NSMakeRange (0, 0); markedRange = NSMakeRange (NSNotFound, 0); @@ -220,7 +220,7 @@ { const char *str; - GDK_NOTE (EVENTS, g_message ("setMarkedText")); + GDK_DEBUG (EVENTS, "setMarkedText"); if (replacementRange.location == NSNotFound) { @@ -246,9 +246,9 @@ TIC_SELECTED_LEN, GUINT_TO_POINTER (selectedRange.length)); - GDK_NOTE (EVENTS, g_message ("setMarkedText: set %s (%p, nsview %p): %s", - TIC_MARKED_TEXT, [self gdkSurface], self, - str ? str : "(empty)")); + GDK_DEBUG (EVENTS, "setMarkedText: set %s (%p, nsview %p): %s", + TIC_MARKED_TEXT, [self gdkSurface], self, + str ? str : "(empty)"); /* handle text input changes by mouse events */ if (!GPOINTER_TO_UINT (g_object_get_data (G_OBJECT ([self gdkSurface]), TIC_IN_KEY_DOWN))) @@ -257,7 +257,7 @@ -(void)doCommandBySelector:(SEL)aSelector { - GDK_NOTE (EVENTS, g_message ("doCommandBySelector")); + GDK_DEBUG (EVENTS, "doCommandBySelector"); if ([self respondsToSelector: aSelector]) [self performSelector: aSelector]; @@ -268,7 +268,7 @@ const char *str; NSString *string; - GDK_NOTE (EVENTS, g_message ("insertText")); + GDK_DEBUG (EVENTS, "insertText"); if ([self hasMarkedText]) [self unmarkText]; @@ -294,9 +294,9 @@ } g_object_set_data_full (G_OBJECT ([self gdkSurface]), TIC_INSERT_TEXT, g_strdup (str), g_free); - GDK_NOTE (EVENTS, g_message ("insertText: set %s (%p, nsview %p): %s", - TIC_INSERT_TEXT, [self gdkSurface], self, - str ? str : "(empty)")); + GDK_DEBUG (EVENTS, "insertText: set %s (%p, nsview %p): %s", + TIC_INSERT_TEXT, [self gdkSurface], self, + str ? str : "(empty)"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -309,7 +309,7 @@ -(void)deleteBackward:(id)sender { - GDK_NOTE (EVENTS, g_message ("deleteBackward")); + GDK_DEBUG (EVENTS, "deleteBackward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -318,7 +318,7 @@ -(void)deleteForward:(id)sender { - GDK_NOTE (EVENTS, g_message ("deleteForward")); + GDK_DEBUG (EVENTS, "deleteForward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -327,7 +327,7 @@ -(void)deleteToBeginningOfLine:(id)sender { - GDK_NOTE (EVENTS, g_message ("deleteToBeginningOfLine")); + GDK_DEBUG (EVENTS, "deleteToBeginningOfLine"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -336,7 +336,7 @@ -(void)deleteToEndOfLine:(id)sender { - GDK_NOTE (EVENTS, g_message ("deleteToEndOfLine")); + GDK_DEBUG (EVENTS, "deleteToEndOfLine"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -345,7 +345,7 @@ -(void)deleteWordBackward:(id)sender { - GDK_NOTE (EVENTS, g_message ("deleteWordBackward")); + GDK_DEBUG (EVENTS, "deleteWordBackward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -354,7 +354,7 @@ -(void)deleteWordForward:(id)sender { - GDK_NOTE (EVENTS, g_message ("deleteWordForward")); + GDK_DEBUG (EVENTS, "deleteWordForward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -363,7 +363,7 @@ -(void)insertBacktab:(id)sender { - GDK_NOTE (EVENTS, g_message ("insertBacktab")); + GDK_DEBUG (EVENTS, "insertBacktab"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -372,7 +372,7 @@ -(void)insertNewline:(id)sender { - GDK_NOTE (EVENTS, g_message ("insertNewline")); + GDK_DEBUG (EVENTS, "insertNewline"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -381,7 +381,7 @@ -(void)insertTab:(id)sender { - GDK_NOTE (EVENTS, g_message ("insertTab")); + GDK_DEBUG (EVENTS, "insertTab"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -390,7 +390,7 @@ -(void)moveBackward:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveBackward")); + GDK_DEBUG (EVENTS, "moveBackward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -399,7 +399,7 @@ -(void)moveBackwardAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveBackwardAndModifySelection")); + GDK_DEBUG (EVENTS, "moveBackwardAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -408,7 +408,7 @@ -(void)moveDown:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveDown")); + GDK_DEBUG (EVENTS, "moveDown"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -417,7 +417,7 @@ -(void)moveDownAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveDownAndModifySelection")); + GDK_DEBUG (EVENTS, "moveDownAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -426,7 +426,7 @@ -(void)moveForward:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveForward")); + GDK_DEBUG (EVENTS, "moveForward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -435,7 +435,7 @@ -(void)moveForwardAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveForwardAndModifySelection")); + GDK_DEBUG (EVENTS, "moveForwardAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -444,7 +444,7 @@ -(void)moveLeft:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveLeft")); + GDK_DEBUG (EVENTS, "moveLeft"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -453,7 +453,7 @@ -(void)moveLeftAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveLeftAndModifySelection")); + GDK_DEBUG (EVENTS, "moveLeftAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -462,7 +462,7 @@ -(void)moveRight:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveRight")); + GDK_DEBUG (EVENTS, "moveRight"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -471,7 +471,7 @@ -(void)moveRightAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveRightAndModifySelection")); + GDK_DEBUG (EVENTS, "moveRightAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -480,7 +480,7 @@ -(void)moveToBeginningOfDocument:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToBeginningOfDocument")); + GDK_DEBUG (EVENTS, "moveToBeginningOfDocument"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -489,7 +489,7 @@ -(void)moveToBeginningOfDocumentAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToBeginningOfDocumentAndModifySelection")); + GDK_DEBUG (EVENTS, "moveToBeginningOfDocumentAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -498,7 +498,7 @@ -(void)moveToBeginningOfLine:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToBeginningOfLine")); + GDK_DEBUG (EVENTS, "moveToBeginningOfLine"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -507,7 +507,7 @@ -(void)moveToBeginningOfLineAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToBeginningOfLineAndModifySelection")); + GDK_DEBUG (EVENTS, "moveToBeginningOfLineAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -516,7 +516,7 @@ -(void)moveToEndOfDocument:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToEndOfDocument")); + GDK_DEBUG (EVENTS, "moveToEndOfDocument"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -525,7 +525,7 @@ -(void)moveToEndOfDocumentAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToEndOfDocumentAndModifySelection")); + GDK_DEBUG (EVENTS, "moveToEndOfDocumentAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -534,7 +534,7 @@ -(void)moveToEndOfLine:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToEndOfLine")); + GDK_DEBUG (EVENTS, "moveToEndOfLine"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -543,7 +543,7 @@ -(void)moveToEndOfLineAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveToEndOfLineAndModifySelection")); + GDK_DEBUG (EVENTS, "moveToEndOfLineAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -552,7 +552,7 @@ -(void)moveUp:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveUp")); + GDK_DEBUG (EVENTS, "moveUp"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -561,7 +561,7 @@ -(void)moveUpAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveUpAndModifySelection")); + GDK_DEBUG (EVENTS, "moveUpAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -570,7 +570,7 @@ -(void)moveWordBackward:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordBackward")); + GDK_DEBUG (EVENTS, "moveWordBackward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -579,7 +579,7 @@ -(void)moveWordBackwardAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordBackwardAndModifySelection")); + GDK_DEBUG (EVENTS, "moveWordBackwardAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -588,7 +588,7 @@ -(void)moveWordForward:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordForward")); + GDK_DEBUG (EVENTS, "moveWordForward"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -597,7 +597,7 @@ -(void)moveWordForwardAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordForwardAndModifySelection")); + GDK_DEBUG (EVENTS, "moveWordForwardAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -606,7 +606,7 @@ -(void)moveWordLeft:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordLeft")); + GDK_DEBUG (EVENTS, "moveWordLeft"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -615,7 +615,7 @@ -(void)moveWordLeftAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordLeftAndModifySelection")); + GDK_DEBUG (EVENTS, "moveWordLeftAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -624,7 +624,7 @@ -(void)moveWordRight:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordRight")); + GDK_DEBUG (EVENTS, "moveWordRight"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -633,7 +633,7 @@ -(void)moveWordRightAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("moveWordRightAndModifySelection")); + GDK_DEBUG (EVENTS, "moveWordRightAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -642,7 +642,7 @@ -(void)pageDown:(id)sender { - GDK_NOTE (EVENTS, g_message ("pageDown")); + GDK_DEBUG (EVENTS, "pageDown"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -651,7 +651,7 @@ -(void)pageDownAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("pageDownAndModifySelection")); + GDK_DEBUG (EVENTS, "pageDownAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -660,7 +660,7 @@ -(void)pageUp:(id)sender { - GDK_NOTE (EVENTS, g_message ("pageUp")); + GDK_DEBUG (EVENTS, "pageUp"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -669,7 +669,7 @@ -(void)pageUpAndModifySelection:(id)sender { - GDK_NOTE (EVENTS, g_message ("pageUpAndModifySelection")); + GDK_DEBUG (EVENTS, "pageUpAndModifySelection"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -678,7 +678,7 @@ -(void)selectAll:(id)sender { - GDK_NOTE (EVENTS, g_message ("selectAll")); + GDK_DEBUG (EVENTS, "selectAll"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -687,7 +687,7 @@ -(void)selectLine:(id)sender { - GDK_NOTE (EVENTS, g_message ("selectLine")); + GDK_DEBUG (EVENTS, "selectLine"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -696,7 +696,7 @@ -(void)selectWord:(id)sender { - GDK_NOTE (EVENTS, g_message ("selectWord")); + GDK_DEBUG (EVENTS, "selectWord"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, @@ -705,7 +705,7 @@ -(void)noop: (id)sender { - GDK_NOTE (EVENTS, g_message ("noop")); + GDK_DEBUG (EVENTS, "noop"); g_object_set_data (G_OBJECT ([self gdkSurface]), GIC_FILTER_KEY, diff --git a/gdk/macos/gdkdisplaylinksource.c b/gdk/macos/gdkdisplaylinksource.c index 6a613b40a4..5241f1290e 100644 --- a/gdk/macos/gdkdisplaylinksource.c +++ b/gdk/macos/gdkdisplaylinksource.c @@ -217,11 +217,10 @@ gdk_display_link_source_new (CGDirectDisplayID display_id, } name = _gdk_macos_monitor_get_connector_name (display_id); - GDK_NOTE (MISC, - g_message ("Monitor \"%s\" discovered with Refresh Rate %d and Interval %"G_GINT64_FORMAT, - name ? name : "unknown", - impl->refresh_rate, - impl->refresh_interval)); + GDK_DEBUG (MISC, "Monitor \"%s\" discovered with Refresh Rate %d and Interval %"G_GINT64_FORMAT, + name ? name : "unknown", + impl->refresh_rate, + impl->refresh_interval); g_free (name); /* Wire up our callback to be executed within the high-priority thread. */ diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c index 41be42cfbe..a999908d88 100644 --- a/gdk/macos/gdkmacosdisplay.c +++ b/gdk/macos/gdkmacosdisplay.c @@ -156,9 +156,8 @@ gdk_macos_display_update_bounds (GdkMacosDisplay *self) self->width = self->max_x - self->min_x; self->height = self->max_y - self->min_y; - GDK_NOTE (MISC, - g_message ("Displays reconfigured to bounds %d,%d %dx%d", - self->min_x, self->min_y, self->width, self->height)); + GDK_DEBUG (MISC, "Displays reconfigured to bounds %d,%d %dx%d", + self->min_x, self->min_y, self->width, self->height); GDK_END_MACOS_ALLOC_POOL; } @@ -663,7 +662,7 @@ _gdk_macos_display_open (const char *display_name) return NULL; display_name = display_name ? display_name : ""; - GDK_NOTE (MISC, g_message ("opening display %s", display_name)); + GDK_DEBUG (MISC, "opening display %s", display_name); /* Make the current process a foreground application, i.e. an app * with a user interface, in case we're not running from a .app bundle diff --git a/gdk/macos/gdkmacoseventsource.c b/gdk/macos/gdkmacoseventsource.c index f32bd33336..f0a539512b 100644 --- a/gdk/macos/gdkmacoseventsource.c +++ b/gdk/macos/gdkmacoseventsource.c @@ -214,7 +214,7 @@ select_thread_set_state (SelectThreadState new_state) if (select_thread_state == new_state) return; - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Select thread state: %s => %s", state_names[select_thread_state], state_names[new_state])); + GDK_DEBUG (EVENTLOOP, "EventLoop: Select thread state: %s => %s", state_names[select_thread_state], state_names[new_state]); old_state = select_thread_state; select_thread_state = new_state; @@ -225,7 +225,7 @@ select_thread_set_state (SelectThreadState new_state) static void signal_main_thread (void) { - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Waking up main thread")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Waking up main thread"); /* If we are in nextEventMatchingMask, then we need to make sure an * event gets queued, otherwise it's enough to simply wake up the @@ -384,7 +384,7 @@ dump_poll_result (GPollFD *ufds, g_string_append (s, "\n"); } } - g_message ("%s", s->str); + gdk_debug_message ("%s", s->str); g_string_free (s, TRUE); } #endif @@ -439,7 +439,7 @@ select_thread_start_poll (GPollFD *ufds, if (nfds == 0 || (nfds == 1 && poll_fd_index >= 0)) { - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Nothing to poll")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Nothing to poll"); return 0; } @@ -458,7 +458,7 @@ select_thread_start_poll (GPollFD *ufds, #ifdef G_ENABLE_DEBUG if ((_gdk_debug_flags & GDK_DEBUG_EVENTLOOP) && n_ready > 0) { - g_message ("EventLoop: Found ready file descriptors before waiting"); + gdk_debug_message ("EventLoop: Found ready file descriptors before waiting"); dump_poll_result (ufds, nfds); } #endif @@ -537,7 +537,7 @@ select_thread_start_poll (GPollFD *ufds, if (have_new_pollfds) { - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Submitting a new set of file descriptor to the select thread")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Submitting a new set of file descriptor to the select thread"); g_assert (next_pollfds == NULL); @@ -602,7 +602,7 @@ select_thread_collect_poll (GPollFD *ufds, guint nfds) #ifdef G_ENABLE_DEBUG if (_gdk_debug_flags & GDK_DEBUG_EVENTLOOP) { - g_message ("EventLoop: Found ready file descriptors after waiting"); + gdk_debug_message ("EventLoop: Found ready file descriptors after waiting"); dump_poll_result (ufds, nfds); } #endif @@ -842,7 +842,7 @@ run_loop_entry (void) { if (g_main_context_acquire (NULL)) { - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Beginning tracking run loop activity")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Beginning tracking run loop activity"); acquired_loop_level = current_loop_level; } else @@ -857,7 +857,7 @@ run_loop_entry (void) * thread that does g_main_context_wait() and then wakes us back up, but * the gain doesn't seem worth the complexity. */ - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Can't acquire main loop; skipping tracking run loop activity")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Can't acquire main loop; skipping tracking run loop activity"); } } } @@ -895,7 +895,7 @@ run_loop_before_sources (void) if (g_main_context_check (context, max_priority, run_loop_pollfds, nfds)) { - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Dispatching high priority sources")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Dispatching high priority sources"); g_main_context_dispatch (context); } } @@ -938,7 +938,7 @@ run_loop_before_waiting (void) * expires. We do this by adding a dummy timer that we'll remove immediately * after the wait wakes up. */ - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Adding timer to wake us up in %d milliseconds", timeout)); + GDK_DEBUG (EVENTLOOP, "EventLoop: Adding timer to wake us up in %d milliseconds", timeout); run_loop_timer = CFRunLoopTimerCreate (NULL, /* allocator */ CFAbsoluteTimeGetCurrent () + timeout / 1000., @@ -978,7 +978,7 @@ run_loop_after_waiting (void) if (g_main_context_check (context, run_loop_max_priority, run_loop_pollfds, run_loop_n_pollfds)) { - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Dispatching after waiting")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Dispatching after waiting"); g_main_context_dispatch (context); } } @@ -991,7 +991,7 @@ run_loop_exit (void) { g_main_context_release (NULL); acquired_loop_level = -1; - GDK_NOTE (EVENTLOOP, g_message ("EventLoop: Ended tracking run loop activity")); + GDK_DEBUG (EVENTLOOP, "EventLoop: Ended tracking run loop activity"); } } diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c index 069d138b83..20ed528ff9 100644 --- a/gdk/macos/gdkmacosglcontext.c +++ b/gdk/macos/gdkmacosglcontext.c @@ -398,10 +398,9 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context, } } - GDK_DISPLAY_NOTE (display, - OPENGL, - g_message ("Creating CGLContextObj (version %d.%d)", - major, minor)); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Creating CGLContextObj (version %d.%d)", + major, minor); if (!(pixelFormat = create_pixel_format (major, minor, error))) return 0; @@ -441,11 +440,10 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context, CGLEnable (cgl_context, kCGLCESwapRectangle); } - GDK_DISPLAY_NOTE (display, - OPENGL, - g_message ("Created CGLContextObj@%p using %s", - cgl_context, - get_renderer_name (renderer_id))); + GDK_DISPLAY_DEBUG (display, OPENGL, + "Created CGLContextObj@%p using %s", + cgl_context, + get_renderer_name (renderer_id)); self->cgl_context = g_steal_pointer (&cgl_context); diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c index d10992ffd4..969f79d172 100644 --- a/gdk/macos/gdkmacossurface.c +++ b/gdk/macos/gdkmacossurface.c @@ -1152,10 +1152,9 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self) if (g_set_object (&self->best_monitor, best)) { - GDK_NOTE (MISC, - g_message ("Surface \"%s\" moved to monitor \"%s\"", - self->title ? self->title : "unknown", - gdk_monitor_get_connector (best))); + GDK_DEBUG (MISC, "Surface \"%s\" moved to monitor \"%s\"", + self->title ? self->title : "unknown", + gdk_monitor_get_connector (best)); _gdk_macos_surface_configure (self); diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c index 54bc4c8af9..0efa0a7791 100644 --- a/gdk/macos/gdkmacostoplevelsurface.c +++ b/gdk/macos/gdkmacostoplevelsurface.c @@ -188,12 +188,11 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel, _gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask); gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height); - GDK_NOTE (MISC, - g_message ("Resizing \"%s\" to %dx%d", - GDK_MACOS_SURFACE (self)->title ? - GDK_MACOS_SURFACE (self)->title : - "untitled", - width, height)); + GDK_DEBUG (MISC, "Resizing \"%s\" to %dx%d", + GDK_MACOS_SURFACE (self)->title ? + GDK_MACOS_SURFACE (self)->title : + "untitled", + width, height); _gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height); @@ -225,12 +224,11 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel, GDK_MACOS_SURFACE (self), &x, &y); - GDK_NOTE (MISC, - g_message ("Placing new toplevel \"%s\" at %d,%d", - GDK_MACOS_SURFACE (self)->title ? - GDK_MACOS_SURFACE (self)->title : - "untitled", - x, y)); + GDK_DEBUG (MISC, "Placing new toplevel \"%s\" at %d,%d", + GDK_MACOS_SURFACE (self)->title ? + GDK_MACOS_SURFACE (self)->title : + "untitled", + x, y); _gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y); } diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c index 9adf39200b..1f4168479a 100644 --- a/gtk/gtkimcontextquartz.c +++ b/gtk/gtkimcontextquartz.c @@ -24,6 +24,7 @@ #include "gtk/gtkimcontextquartz.h" #include "gtk/gtkintl.h" #include "gtk/gtkimmoduleprivate.h" +#include "gtk/gtkprivate.h" #include "gdk/macos/gdkmacos.h" #include "gdk/macos/gdkmacosdisplay-private.h" From bc159207bd05ca4bfc8e6f7ea819ee487bf75705 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 23 Sep 2022 10:32:07 -0400 Subject: [PATCH 23/30] gdk: Drop old debug macros Drop the old GDK_NOTE() and GDK_DISPLAY_NOTE() macros from gdkdebug.h. Reintroduce them in the win32 backend, where they are still used. --- gdk/gdkdebug.h | 5 ----- gdk/win32/gdkdrag-win32.c | 2 ++ gdk/win32/gdkprivate-win32.h | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h index 45519a1b4d..0dad93e828 100644 --- a/gdk/gdkdebug.h +++ b/gdk/gdkdebug.h @@ -65,9 +65,6 @@ void gdk_display_set_debug_flags (GdkDisplay *display, #define GDK_DISPLAY_DEBUG_CHECK(display,type) \ G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type) -#define GDK_DISPLAY_NOTE(display,type,action) G_STMT_START { \ - if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ - { action; }; } G_STMT_END #define GDK_DISPLAY_DEBUG(display,type,...) \ if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ @@ -76,13 +73,11 @@ void gdk_display_set_debug_flags (GdkDisplay *display, #else /* !G_ENABLE_DEBUG */ #define GDK_DISPLAY_DEBUG_CHECK(display,type) 0 -#define GDK_DISPLAY_NOTE(display,type,action) #define GDK_DISPLAY_DEBUG(display,type,...) #endif /* G_ENABLE_DEBUG */ #define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type) -#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action) #define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__) #endif diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index a53f6569b1..68bfbed814 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -37,6 +37,8 @@ #include #include +#define GDK_NOTE(a,b) + /* * Support for OLE-2 drag and drop added at Archaeopteryx Software, 2001 * For more information, do not contact Stephan R.A. Deibel (sdeibel@archaeopteryx.com), diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index c6ef3455df..3979970f59 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -26,6 +26,7 @@ #define __GDK_PRIVATE_WIN32_H__ #include +#include #include #include #include @@ -37,6 +38,23 @@ #include "config.h" + +/* Old debug macros */ + +#ifdef G_ENABLE_DEBUG + +#define GDK_NOTE(type,action) \ + G_STMT_START { \ + if (GDK_DEBUG_CHECK (type)) \ + { action; }; \ + } G_STMT_END + +#else + +#define GDK_NOTE(type,action) + +#endif + /* Make up for some minor w32api or MSVC6 header lossage */ #ifndef PS_JOIN_MASK From 4d08eb264d6e5fca203c48e2523f9d1f56a31505 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 21:35:24 -0400 Subject: [PATCH 24/30] gsk: Introduce new debug macros Introduce GSK_RENDERER_DEBUG() and GSK_DEBUG(), which mirror the new macros in gdk. They use the same helper function gdk_debug_message(). --- gsk/gskdebugprivate.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h index 345c1555ab..a8a69dafc3 100644 --- a/gsk/gskdebugprivate.h +++ b/gsk/gskdebugprivate.h @@ -2,6 +2,7 @@ #define __GSK_DEBUG_PRIVATE_H__ #include +#include "gdk/gdkdebug.h" G_BEGIN_DECLS @@ -41,8 +42,15 @@ gboolean gsk_check_debug_flags (GskDebugFlags flags); } } G_STMT_END #define GSK_RENDERER_NOTE(renderer,type,action) G_STMT_START { \ if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) { \ - action; \ - } } G_STMT_END + action; + +#define GSK_RENDERER_DEBUG(renderer,type,...) \ + if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) \ + gdk_debug_message (__VA_ARGS__); \ + +#define GSK_DEBUG(type,...) \ + if (GSK_DEBUG_CHECK (type)) \ + gdk_debug_message (__VA_ARGS__); \ #else @@ -50,6 +58,8 @@ gboolean gsk_check_debug_flags (GskDebugFlags flags); #define GSK_RENDERER_DEBUG_CHECK(renderer,type) 0 #define GSK_NOTE(type,action) #define GSK_RENDERER_NOTE(renderer,type,action) +#define GSK_RENDERER_DEBUG(display,type,...) +#define GSK_DEBUG(type,...) #endif From 9818ec4ad999557f807235dae2aa6b4fda6515dc Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 21:36:50 -0400 Subject: [PATCH 25/30] gsk: Use the new debug macros --- gsk/gl/gskgltexturelibrary.c | 47 ++++++++++++++------------- gsk/gskdebug.c | 2 ++ gsk/gskrenderer.c | 8 ++--- gsk/gskrendernode.c | 6 ++-- gsk/gskrendernodeimpl.c | 8 ++--- gsk/vulkan/gskvulkanglyphcache.c | 11 ++++--- gsk/vulkan/gskvulkanpipelineprivate.h | 2 +- gsk/vulkan/gskvulkanrenderpass.c | 22 ++++++------- gsk/vulkan/gskvulkanshader.c | 2 +- 9 files changed, 57 insertions(+), 51 deletions(-) diff --git a/gsk/gl/gskgltexturelibrary.c b/gsk/gl/gskgltexturelibrary.c index 24d3c5ab12..c2ec0f84ab 100644 --- a/gsk/gl/gskgltexturelibrary.c +++ b/gsk/gl/gskgltexturelibrary.c @@ -74,9 +74,9 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self, if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO) { - GSK_NOTE (GLYPH_CACHE, - g_message ("Dropping atlas %d (%g.2%% old)", i, - 100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas))); + GSK_DEBUG (GLYPH_CACHE, + "Dropping atlas %d (%g.2%% old)", i, + 100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)); if (removed == NULL) removed = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free); g_ptr_array_add (removed, g_ptr_array_steal_index (self->atlases, i - 1)); @@ -122,14 +122,14 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self, } } - GSK_NOTE (GLYPH_CACHE, g_message ("%s: Dropped %d individual items", - G_OBJECT_TYPE_NAME (self), - dropped); - g_message ("%s: %d items cached (%d atlased, %d individually)", - G_OBJECT_TYPE_NAME (self), - g_hash_table_size (self->hash_table), - atlased, - g_hash_table_size (self->hash_table) - atlased)); + GSK_DEBUG (GLYPH_CACHE, "%s: Dropped %d individual items", + G_OBJECT_TYPE_NAME (self), + dropped); + GSK_DEBUG (GLYPH_CACHE, "%s: %d items cached (%d atlased, %d individually)", + G_OBJECT_TYPE_NAME (self), + g_hash_table_size (self->hash_table), + atlased, + g_hash_table_size (self->hash_table) - atlased); if (dropped > 0) gsk_gl_texture_library_clear_cache (self); @@ -139,17 +139,20 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self, g_clear_pointer (&removed, g_ptr_array_unref); } - GSK_NOTE (GLYPH_CACHE, { - static gint64 last_message; - gint64 now = g_get_monotonic_time (); - if (now - last_message > G_USEC_PER_SEC) - { - last_message = now; - g_message ("%s contains %d atlases", - G_OBJECT_TYPE_NAME (self), - self->atlases->len); - } - }); +#ifdef G_ENABLE_DEBUG + if (GSK_DEBUG_CHECK (GLYPH_CACHE)) + { + static gint64 last_message; + gint64 now = g_get_monotonic_time (); + if (now - last_message > G_USEC_PER_SEC) + { + last_message = now; + gdk_debug_message ("%s contains %d atlases", + G_OBJECT_TYPE_NAME (self), + self->atlases->len); + } + } +#endif return ret; } diff --git a/gsk/gskdebug.c b/gsk/gskdebug.c index 83a3619fe7..cda64af2fa 100644 --- a/gsk/gskdebug.c +++ b/gsk/gskdebug.c @@ -1,3 +1,5 @@ +#include "config.h" + #include "gskdebugprivate.h" #include "gdk/gdk-private.h" diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c index a3ceb0172b..eeb6408506 100644 --- a/gsk/gskrenderer.c +++ b/gsk/gskrenderer.c @@ -648,10 +648,10 @@ gsk_renderer_new_for_surface (GdkSurface *surface) if (gsk_renderer_realize (renderer, surface, &error)) { - GSK_RENDERER_NOTE (renderer, RENDERER, - g_message ("Using renderer of type '%s' for surface '%s'\n", - G_OBJECT_TYPE_NAME (renderer), - G_OBJECT_TYPE_NAME (surface))); + GSK_RENDERER_DEBUG (renderer, RENDERER, + "Using renderer of type '%s' for surface '%s'", + G_OBJECT_TYPE_NAME (renderer), + G_OBJECT_TYPE_NAME (surface)); return renderer; } diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c index 14a29c358c..1587ab61b3 100644 --- a/gsk/gskrendernode.c +++ b/gsk/gskrendernode.c @@ -439,9 +439,9 @@ gsk_render_node_draw (GskRenderNode *node, cairo_save (cr); - GSK_NOTE (CAIRO, g_message ("Rendering node %s[%p]", - g_type_name_from_instance ((GTypeInstance *) node), - node)); + GSK_DEBUG (CAIRO, "Rendering node %s[%p]", + g_type_name_from_instance ((GTypeInstance *) node), + node); GSK_RENDER_NODE_GET_CLASS (node)->draw (node, cr); diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index c43a4636c1..ef5158313f 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -2881,10 +2881,10 @@ gsk_transform_node_draw (GskRenderNode *node, gsk_transform_to_2d (self->transform, &xx, &yx, &xy, &yy, &dx, &dy); cairo_matrix_init (&ctm, xx, yx, xy, yy, dx, dy); - GSK_NOTE (CAIRO, g_message ("CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }", - ctm.xx, ctm.yx, - ctm.xy, ctm.yy, - ctm.x0, ctm.y0)); + GSK_DEBUG (CAIRO, "CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }", + ctm.xx, ctm.yx, + ctm.xy, ctm.yy, + ctm.x0, ctm.y0); if (xx * yy == xy * yx) { /* broken matrix here. This can happen during transitions diff --git a/gsk/vulkan/gskvulkanglyphcache.c b/gsk/vulkan/gskvulkanglyphcache.c index 830b4d70c9..f1adefafca 100644 --- a/gsk/vulkan/gskvulkanglyphcache.c +++ b/gsk/vulkan/gskvulkanglyphcache.c @@ -309,8 +309,8 @@ upload_dirty_glyphs (GskVulkanGlyphCache *cache, for (l = atlas->dirty_glyphs, i = 0; l; l = l->next, i++) render_glyph (atlas, (DirtyGlyph *)l->data, ®ions[i]); - GSK_RENDERER_NOTE (cache->renderer, GLYPH_CACHE, - g_message ("uploading %d glyphs to cache", num_regions)); + GSK_RENDERER_DEBUG (cache->renderer, GLYPH_CACHE, + "uploading %d glyphs to cache", num_regions); gsk_vulkan_image_upload_regions (atlas->image, uploader, num_regions, regions); @@ -471,8 +471,9 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache) if (atlas->old_pixels > MAX_OLD * atlas->width * atlas->height) { - GSK_RENDERER_NOTE(cache->renderer, GLYPH_CACHE, - g_message ("Dropping atlas %d (%g.2%% old)", i, 100.0 * (double)atlas->old_pixels / (double)(atlas->width * atlas->height))); + GSK_RENDERER_DEBUG (cache->renderer, GLYPH_CACHE, + "Dropping atlas %d (%g.2%% old)", + i, 100.0 * (double)atlas->old_pixels / (double)(atlas->width * atlas->height)); g_ptr_array_remove_index (cache->atlases, i); drops[i] = 1; @@ -501,5 +502,5 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache) } } - GSK_RENDERER_NOTE(cache->renderer, GLYPH_CACHE, g_message ("Dropped %d glyphs", dropped)); + GSK_RENDERER_DEBUG (cache->renderer, GLYPH_CACHE, "Dropped %d glyphs", dropped); } diff --git a/gsk/vulkan/gskvulkanpipelineprivate.h b/gsk/vulkan/gskvulkanpipelineprivate.h index cd41f822b3..9adf44a1b6 100644 --- a/gsk/vulkan/gskvulkanpipelineprivate.h +++ b/gsk/vulkan/gskvulkanpipelineprivate.h @@ -25,7 +25,7 @@ gsk_vulkan_handle_result (VkResult res, { if (res != VK_SUCCESS) { - GSK_NOTE (VULKAN,g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res)); + GSK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res); } return res; } diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index 34b035245a..48127e20b9 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -235,7 +235,7 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self) } #define FALLBACK(...) G_STMT_START { \ - GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, g_message (__VA_ARGS__)); \ + GSK_RENDERER_DEBUG (gsk_vulkan_render_get_renderer (render), FALLBACK, __VA_ARGS__); \ goto fallback; \ }G_STMT_END @@ -763,9 +763,9 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self, } } - GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, g_message ("Node as texture not implemented for this case. Using %gx%g fallback surface", - ceil (bounds->size.width), - ceil (bounds->size.height))); + GSK_RENDERER_DEBUG (gsk_vulkan_render_get_renderer (render), FALLBACK, "Node as texture not implemented for this case. Using %gx%g fallback surface", + ceil (bounds->size.width), + ceil (bounds->size.height)); #ifdef G_ENABLE_DEBUG { GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render)); @@ -816,13 +816,13 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass *self, node = op->node; - GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, - g_message ("Upload op=%s, node %s[%p], bounds %gx%g", - op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" : - (op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" : "fallback"), - g_type_name_from_instance ((GTypeInstance *) node), node, - ceil (node->bounds.size.width), - ceil (node->bounds.size.height))); + GSK_RENDERER_DEBUG (gsk_vulkan_render_get_renderer (render), FALLBACK, + "Upload op=%s, node %s[%p], bounds %gx%g", + op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" : + (op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" : "fallback"), + g_type_name_from_instance ((GTypeInstance *) node), node, + ceil (node->bounds.size.width), + ceil (node->bounds.size.height)); #ifdef G_ENABLE_DEBUG { GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render)); diff --git a/gsk/vulkan/gskvulkanshader.c b/gsk/vulkan/gskvulkanshader.c index 0446412ea7..bd7475a7f0 100644 --- a/gsk/vulkan/gskvulkanshader.c +++ b/gsk/vulkan/gskvulkanshader.c @@ -65,7 +65,7 @@ gsk_vulkan_shader_new_from_resource (GdkVulkanContext *context, g_free (path); if (bytes == NULL) { - GSK_NOTE (VULKAN, g_message ("Error loading shader data: %s", local_error->message)); + GSK_DEBUG (VULKAN, "Error loading shader data: %s", local_error->message); g_propagate_error (error, local_error); return NULL; } From 8a4fd30797e95ce2ce1bbeb5df881c1024e73e67 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Sep 2022 21:45:39 -0400 Subject: [PATCH 26/30] gsk: drop old debug macros These are no longer used. --- gsk/gskdebugprivate.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h index a8a69dafc3..9714bec1a1 100644 --- a/gsk/gskdebugprivate.h +++ b/gsk/gskdebugprivate.h @@ -36,14 +36,6 @@ gboolean gsk_check_debug_flags (GskDebugFlags flags); #define GSK_RENDERER_DEBUG_CHECK(renderer,type) \ G_UNLIKELY ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ ## type) != 0) -#define GSK_NOTE(type,action) G_STMT_START { \ - if (GSK_DEBUG_CHECK (type)) { \ - action; \ - } } G_STMT_END -#define GSK_RENDERER_NOTE(renderer,type,action) G_STMT_START { \ - if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) { \ - action; - #define GSK_RENDERER_DEBUG(renderer,type,...) \ if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) \ gdk_debug_message (__VA_ARGS__); \ @@ -56,8 +48,6 @@ gboolean gsk_check_debug_flags (GskDebugFlags flags); #define GSK_DEBUG_CHECK(type) 0 #define GSK_RENDERER_DEBUG_CHECK(renderer,type) 0 -#define GSK_NOTE(type,action) -#define GSK_RENDERER_NOTE(renderer,type,action) #define GSK_RENDERER_DEBUG(display,type,...) #define GSK_DEBUG(type,...) From 1e65d6640fe03852c9f5b3ed40bf238104eb8c2b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 23 Sep 2022 13:12:41 -0400 Subject: [PATCH 27/30] tests: Rewrite the icontheme tests The lookup order tests were relying on out debug spew using g_log, so they can redirect the output by setting a log writer function. Rewrite this to use g_test_subprocess() and parse stderr. --- testsuite/gtk/icontheme.c | 368 +++++++++++++++++--------------------- 1 file changed, 166 insertions(+), 202 deletions(-) diff --git a/testsuite/gtk/icontheme.c b/testsuite/gtk/icontheme.c index fb5bf189f4..31c9b1cb40 100644 --- a/testsuite/gtk/icontheme.c +++ b/testsuite/gtk/icontheme.c @@ -135,59 +135,22 @@ assert_icon_lookup_fails (const char *icon_name, g_assert_cmpstr (gtk_icon_paintable_get_icon_name (info), ==, "image-missing"); } -static GList *lookups = NULL; -static gboolean collecting_lookups = FALSE; - -static GLogWriterOutput -log_writer (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields, - gpointer user_data) -{ - const char *domain = NULL; - const char *msg = NULL; - int i; - - if (!collecting_lookups) - return g_log_writer_default (log_level, fields, n_fields, user_data); - - for (i = 0; i < n_fields; i++) - { - if (strcmp (fields[i].key, "GLIB_DOMAIN") == 0) - domain = fields[i].value; - if (strcmp (fields[i].key, "MESSAGE") == 0) - msg = fields[i].value; - } - - if (log_level != G_LOG_LEVEL_MESSAGE || g_strcmp0 (domain, "Gtk") != 0) - return g_log_writer_default (log_level, fields, n_fields, user_data); - - if (g_str_has_prefix (msg, "\tlookup name: ")) - { - char *s; - s = g_strchomp (g_strdup (msg + strlen ("\tlookup name: "))); - lookups = g_list_append (lookups, s); - } - - return G_LOG_WRITER_HANDLED; -} +#ifdef G_ENABLE_DEBUG +#define require_debug() +#else +#define require_debug() \ + g_test_skip ("requires G_ENABLE_DEBUG"); \ + return; +#endif static void -assert_lookup_order (const char *icon_name, - int size, - GtkTextDirection direction, - GtkIconLookupFlags flags, - gboolean fallbacks, - const char *first, - ...) +do_icon_lookup (const char *icon_name, + int size, + GtkTextDirection direction, + GtkIconLookupFlags flags, + gboolean fallbacks) { - va_list args; - const char *s; - GtkIconPaintable *info; - GList *l; - - g_assert_null (lookups); - collecting_lookups = TRUE; + GtkIconPaintable *info = NULL; if (fallbacks) { @@ -203,165 +166,157 @@ assert_lookup_order (const char *icon_name, if (info) g_object_unref (info); +} - collecting_lookups = FALSE; +static char * +make_lookup_pattern (const char *first_name, + ...) +{ + GString *s; + va_list args; + char *name; + + s = g_string_new (""); + g_string_append_printf (s, "*lookup name: %s", first_name); + + va_start (args, first_name); + + while ((name = va_arg (args, char *)) != NULL) + g_string_append_printf (s, "*lookup name: %s", name); - va_start (args, first); - s = first; - l = lookups; - while (s != NULL) - { - g_assert_nonnull (l); - g_assert_cmpstr (s, ==, l->data); - s = va_arg (args, char *); - l = l->next; - } - g_assert_null (l); va_end (args); - g_list_free_full (lookups, g_free); - lookups = NULL; + g_string_append (s, "*"); + + return g_string_free (s, FALSE); } -#ifdef G_ENABLE_DEBUG -#define require_debug() -#else -#define require_debug() \ - g_test_skip ("requires G_ENABLE_DEBUG"); \ - return; -#endif - -static void -test_lookup_order (void) -{ - require_debug (); - - if (g_test_subprocess ()) - { - guint debug_flags; - - debug_flags = gtk_get_debug_flags (); - gtk_set_debug_flags (debug_flags | GTK_DEBUG_ICONTHEME); - - g_log_set_writer_func (log_writer, NULL, NULL); - - assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_NONE, 0, TRUE, - "foo-bar-baz", - "foo-bar", - "foo", - "foo-bar-baz-symbolic", - "foo-bar-symbolic", - "foo-symbolic", - NULL); - assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, TRUE, - "foo-bar-baz-rtl", - "foo-bar-baz", - "foo-bar-rtl", - "foo-bar", - "foo-rtl", - "foo", - "foo-bar-baz-symbolic-rtl", - "foo-bar-baz-symbolic", - "foo-bar-symbolic-rtl", - "foo-bar-symbolic", - "foo-symbolic-rtl", - "foo-symbolic", - NULL); - assert_lookup_order ("foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, FALSE, - "foo-bar-baz-rtl", - "foo-bar-baz", - NULL); - assert_lookup_order ("foo-bar-baz-symbolic", 16, GTK_TEXT_DIR_NONE, 0, TRUE, - "foo-bar-baz-symbolic", - "foo-bar-symbolic", - "foo-symbolic", - "foo-bar-baz", - "foo-bar", - "foo", - NULL); - - assert_lookup_order ("bla-bla", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, - "bla-bla-symbolic", - "bla-symbolic", - "bla-bla-symbolic", /* awkward */ - "bla-symbolic", /* awkward */ - "bla-bla", - "bla", - NULL); - assert_lookup_order ("bla-bla-symbolic", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, - "bla-bla-symbolic", - "bla-symbolic", - "bla-bla-symbolic", /* awkward */ - "bla-symbolic", /* awkward */ - "bla-bla", - "bla", - NULL); - - assert_lookup_order ("bar-baz", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, - "bar-baz-symbolic-rtl", - "bar-baz-symbolic", - "bar-symbolic-rtl", - "bar-symbolic", - "bar-baz-symbolic-rtl", /* awkward */ - "bar-baz-symbolic", /* awkward */ - "bar-symbolic-rtl", /* awkward */ - "bar-symbolic", /* awkward */ - "bar-baz-rtl", - "bar-baz", - "bar-rtl", - "bar", - NULL); - assert_lookup_order ("bar-baz-symbolic", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, - "bar-baz-symbolic-rtl", - "bar-baz-symbolic", - "bar-symbolic-rtl", - "bar-symbolic", - "bar-baz-symbolic-rtl", /* awkward */ - "bar-baz-symbolic", /* awkward */ - "bar-symbolic-rtl", /* awkward */ - "bar-symbolic", /* awkward */ - "bar-baz-rtl", - "bar-baz", - "bar-rtl", - "bar", - NULL); - - assert_lookup_order ("bar-baz", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, - "bar-baz-symbolic-ltr", - "bar-baz-symbolic", - "bar-symbolic-ltr", - "bar-symbolic", - "bar-baz-symbolic-ltr", /* awkward */ - "bar-baz-symbolic", /* awkward */ - "bar-symbolic-ltr", /* awkward */ - "bar-symbolic", /* awkward */ - "bar-baz-ltr", - "bar-baz", - "bar-ltr", - "bar", - NULL); - assert_lookup_order ("bar-baz-symbolic", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, - "bar-baz-symbolic-ltr", - "bar-baz-symbolic", - "bar-symbolic-ltr", - "bar-symbolic", - "bar-baz-symbolic-ltr", /* awkward */ - "bar-baz-symbolic", /* awkward */ - "bar-symbolic-ltr", /* awkward */ - "bar-symbolic", /* awkward */ - "bar-baz-ltr", - "bar-baz", - "bar-ltr", - "bar", - NULL); - - return; - } - - g_test_trap_subprocess (NULL, 0, 0); - g_test_trap_assert_passed (); +#define LOOKUP_ORDER_TEST(func,icon_name,size,direction,flags,fallback,...) \ +static void \ +func (void) \ +{ \ + char *pattern; \ + require_debug (); \ + if (g_test_subprocess ()) \ + { \ + guint debug_flags = gtk_get_debug_flags (); \ + gtk_set_debug_flags (debug_flags | GTK_DEBUG_ICONTHEME); \ + do_icon_lookup (icon_name, size, direction, flags, fallback); \ + return; \ + } \ + g_test_trap_subprocess (NULL, 0, 0); \ + g_test_trap_assert_passed (); \ + pattern = make_lookup_pattern (__VA_ARGS__, NULL); \ + g_test_trap_assert_stderr (pattern); \ + g_free (pattern); \ } +LOOKUP_ORDER_TEST (test_lookup_order0, "foo-bar-baz", 16, GTK_TEXT_DIR_NONE, 0, TRUE, + "foo-bar-baz", + "foo-bar", + "foo", + "foo-bar-baz-symbolic", + "foo-bar-symbolic", + "foo-symbolic") + +LOOKUP_ORDER_TEST (test_lookup_order1, "foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, TRUE, + "foo-bar-baz-rtl", + "foo-bar-baz", + "foo-bar-rtl", + "foo-bar", + "foo-rtl", + "foo", + "foo-bar-baz-symbolic-rtl", + "foo-bar-baz-symbolic", + "foo-bar-symbolic-rtl", + "foo-bar-symbolic", + "foo-symbolic-rtl", + "foo-symbolic") + +LOOKUP_ORDER_TEST (test_lookup_order2, "foo-bar-baz", 16, GTK_TEXT_DIR_RTL, 0, FALSE, + "foo-bar-baz-rtl", + "foo-bar-baz") + +LOOKUP_ORDER_TEST (test_lookup_order3, "foo-bar-baz-symbolic", 16, GTK_TEXT_DIR_NONE, 0, TRUE, + "foo-bar-baz-symbolic", + "foo-bar-symbolic", + "foo-symbolic", + "foo-bar-baz", + "foo-bar", + "foo") + +LOOKUP_ORDER_TEST (test_lookup_order4, "bla-bla", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, + "bla-bla-symbolic", + "bla-symbolic", + "bla-bla-symbolic", /* awkward */ + "bla-symbolic", /* awkward */ + "bla-bla", + "bla") + +LOOKUP_ORDER_TEST (test_lookup_order5, "bla-bla-symbolic", 16, GTK_TEXT_DIR_NONE, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, + "bla-bla-symbolic", + "bla-symbolic", + "bla-bla-symbolic", /* awkward */ + "bla-symbolic", /* awkward */ + "bla-bla", + "bla") + +LOOKUP_ORDER_TEST (test_lookup_order6, "bar-baz", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, + "bar-baz-symbolic-rtl", + "bar-baz-symbolic", + "bar-symbolic-rtl", + "bar-symbolic", + "bar-baz-symbolic-rtl", /* awkward */ + "bar-baz-symbolic", /* awkward */ + "bar-symbolic-rtl", /* awkward */ + "bar-symbolic", /* awkward */ + "bar-baz-rtl", + "bar-baz", + "bar-rtl", + "bar") + +LOOKUP_ORDER_TEST (test_lookup_order7, "bar-baz-symbolic", 16, GTK_TEXT_DIR_RTL, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, + "bar-baz-symbolic-rtl", + "bar-baz-symbolic", + "bar-symbolic-rtl", + "bar-symbolic", + "bar-baz-symbolic-rtl", /* awkward */ + "bar-baz-symbolic", /* awkward */ + "bar-symbolic-rtl", /* awkward */ + "bar-symbolic", /* awkward */ + "bar-baz-rtl", + "bar-baz", + "bar-rtl", + "bar") + +LOOKUP_ORDER_TEST (test_lookup_order8, "bar-baz", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, + "bar-baz-symbolic-ltr", + "bar-baz-symbolic", + "bar-symbolic-ltr", + "bar-symbolic", + "bar-baz-symbolic-ltr", /* awkward */ + "bar-baz-symbolic", /* awkward */ + "bar-symbolic-ltr", /* awkward */ + "bar-symbolic", /* awkward */ + "bar-baz-ltr", + "bar-baz", + "bar-ltr", + "bar") + +LOOKUP_ORDER_TEST (test_lookup_order9, "bar-baz-symbolic", 16, GTK_TEXT_DIR_LTR, GTK_ICON_LOOKUP_FORCE_SYMBOLIC, TRUE, + "bar-baz-symbolic-ltr", + "bar-baz-symbolic", + "bar-symbolic-ltr", + "bar-symbolic", + "bar-baz-symbolic-ltr", /* awkward */ + "bar-baz-symbolic", /* awkward */ + "bar-symbolic-ltr", /* awkward */ + "bar-symbolic", /* awkward */ + "bar-baz-ltr", + "bar-baz", + "bar-ltr", + "bar") + static void test_basics (void) { @@ -822,7 +777,16 @@ main (int argc, char *argv[]) g_test_add_func ("/icontheme/list", test_list); g_test_add_func ("/icontheme/inherit", test_inherit); g_test_add_func ("/icontheme/nonsquare-symbolic", test_nonsquare_symbolic); - g_test_add_func ("/icontheme/lookup-order", test_lookup_order); + g_test_add_func ("/icontheme/lookup_order0", test_lookup_order0); + g_test_add_func ("/icontheme/lookup_order1", test_lookup_order1); + g_test_add_func ("/icontheme/lookup_order2", test_lookup_order2); + g_test_add_func ("/icontheme/lookup_order3", test_lookup_order3); + g_test_add_func ("/icontheme/lookup_order4", test_lookup_order4); + g_test_add_func ("/icontheme/lookup_order5", test_lookup_order5); + g_test_add_func ("/icontheme/lookup_order6", test_lookup_order6); + g_test_add_func ("/icontheme/lookup_order7", test_lookup_order7); + g_test_add_func ("/icontheme/lookup_order8", test_lookup_order8); + g_test_add_func ("/icontheme/lookup_order9", test_lookup_order9); return g_test_run(); } From f4d3f45c16faf66b5984cea8a0b60d8ff6e76a94 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 23 Sep 2022 10:10:51 -0400 Subject: [PATCH 28/30] gtk: Introduce new debug macros Introduce GTK_DISPLAY_DEBUG() and GTK_DEBUG(), which mirror the new macros in gdk. They use the same helper function gdk_debug_message(). --- gtk/gtkprivate.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h index 7869347cad..c78efc03c6 100644 --- a/gtk/gtkprivate.h +++ b/gtk/gtkprivate.h @@ -28,6 +28,7 @@ #include #include #include +#include #include "gtkcsstypesprivate.h" #include "gtktexthandleprivate.h" @@ -135,16 +136,33 @@ GBytes *get_emoji_data (void); #ifdef G_ENABLE_DEBUG -#define GTK_DISPLAY_DEBUG_CHECK(display,type) (gtk_get_any_display_debug_flag_set () && G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type)) -#define GTK_DISPLAY_NOTE(display,type,action) \ - G_STMT_START { \ - if (GTK_DISPLAY_DEBUG_CHECK (display,type)) { action; }; \ +#define GTK_DISPLAY_DEBUG_CHECK(display,type) \ + (gtk_get_any_display_debug_flag_set () && \ + G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type)) + +#define GTK_DISPLAY_NOTE(display,type,action) \ + G_STMT_START { \ + if (GTK_DISPLAY_DEBUG_CHECK (display,type)) { action; }; \ + } G_STMT_END + +#define GTK_DEBUG(type,...) \ + G_STMT_START { \ + if (GTK_DEBUG_CHECK (type)) \ + gdk_debug_message (__VA_ARGS__); \ + } G_STMT_END + +#define GTK_DISPLAY_DEBUG(display,type,...) \ + G_STMT_START { \ + if (GTK_DISPLAY_DEBUG_CHECK (display,type)) \ + gdk_debug_message (__VA_ARGS__); \ } G_STMT_END #else #define GTK_DISPLAY_DEBUG_CHECK(display,type) 0 #define GTK_DISPLAY_NOTE(display,type,action) +#define GTK_DISPLAY_DEBUG(display,type,...) +#define GTK_DEBUG(type,...) #endif /* G_ENABLE_DEBUG */ From f33f55bcbb33833c9edf7d02c3c82a0a3ecc6e0d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 23 Sep 2022 10:11:59 -0400 Subject: [PATCH 29/30] gtk: Use the new debug macros --- gdk/gdkdebug.h | 2 + gsk/gskdebugprivate.h | 4 + gtk/a11y/gtkatspicache.c | 15 +- gtk/a11y/gtkatspicontext.c | 35 ++--- gtk/a11y/gtkatspiroot.c | 12 +- gtk/gtkactionhelper.c | 31 ++-- gtk/gtkatcontext.c | 5 +- gtk/gtkbuilder.c | 11 +- gtk/gtkbuilderparser.c | 12 +- gtk/gtkconstraintlayout.c | 15 +- gtk/gtkconstraintsolver.c | 24 ++- gtk/gtkiconcache.c | 9 +- gtk/gtkicontheme.c | 64 ++++---- gtk/gtkimcontextquartz.c | 30 ++-- gtk/gtkimmodule.c | 6 +- gtk/gtkmediafile.c | 12 +- gtk/gtkmenutrackeritem.c | 39 ++--- gtk/gtkprintbackend.c | 9 +- gtk/gtkshortcutaction.c | 14 +- gtk/gtksizerequest.c | 41 +++--- gtk/gtkwidget.c | 12 +- modules/printbackends/gtkcupssecretsutils.c | 52 +++---- modules/printbackends/gtkcupsutils.c | 28 ++-- modules/printbackends/gtkprintbackendcups.c | 155 ++++++++------------ modules/printbackends/gtkprintbackendfile.c | 16 +- modules/printbackends/gtkprintbackendlpr.c | 16 +- 26 files changed, 314 insertions(+), 355 deletions(-) diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h index 0dad93e828..94cc26aa6e 100644 --- a/gdk/gdkdebug.h +++ b/gdk/gdkdebug.h @@ -67,8 +67,10 @@ void gdk_display_set_debug_flags (GdkDisplay *display, G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type) #define GDK_DISPLAY_DEBUG(display,type,...) \ + G_STMT_START { \ if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \ gdk_debug_message (__VA_ARGS__); \ + } G_STMT_END #else /* !G_ENABLE_DEBUG */ diff --git a/gsk/gskdebugprivate.h b/gsk/gskdebugprivate.h index 9714bec1a1..f02130190c 100644 --- a/gsk/gskdebugprivate.h +++ b/gsk/gskdebugprivate.h @@ -37,12 +37,16 @@ gboolean gsk_check_debug_flags (GskDebugFlags flags); G_UNLIKELY ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ ## type) != 0) #define GSK_RENDERER_DEBUG(renderer,type,...) \ + G_STMT_START { \ if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) \ gdk_debug_message (__VA_ARGS__); \ + } G_STMT_END #define GSK_DEBUG(type,...) \ + G_STMT_START { \ if (GSK_DEBUG_CHECK (type)) \ gdk_debug_message (__VA_ARGS__); \ + } G_STMT_END #else diff --git a/gtk/a11y/gtkatspicache.c b/gtk/a11y/gtkatspicache.c index 6e85c5663f..3b16f24d6f 100644 --- a/gtk/a11y/gtkatspicache.c +++ b/gtk/a11y/gtkatspicache.c @@ -26,6 +26,7 @@ #include "gtkatspirootprivate.h" #include "gtkatspiutilsprivate.h" #include "gtkdebug.h" +#include "gtkprivate.h" #include "a11y/atspi/atspi-accessible.h" #include "a11y/atspi/atspi-application.h" @@ -282,9 +283,8 @@ handle_cache_method (GDBusConnection *connection, { GtkAtSpiCache *self = user_data; - GTK_NOTE (A11Y, - g_message ("[Cache] Method '%s' on interface '%s' for object '%s' from '%s'\n", - method_name, interface_name, object_path, sender)); + GTK_DEBUG (A11Y, "[Cache] Method '%s' on interface '%s' for object '%s' from '%s'", + method_name, interface_name, object_path, sender); if (g_strcmp0 (method_name, "GetItems") == 0) @@ -304,8 +304,7 @@ handle_cache_method (GDBusConnection *connection, self->in_get_items = FALSE; - GTK_NOTE (A11Y, - g_message ("Returning %lu items\n", g_variant_n_children (items))); + GTK_DEBUG (A11Y, "Returning %lu items", g_variant_n_children (items)); g_dbus_method_invocation_return_value (invocation, items); } @@ -351,7 +350,7 @@ gtk_at_spi_cache_constructed (GObject *gobject) NULL, NULL); - GTK_NOTE (A11Y, g_message ("Cache registered at %s", self->cache_path)); + GTK_DEBUG (A11Y, "Cache registered at %s", self->cache_path); G_OBJECT_CLASS (gtk_at_spi_cache_parent_class)->constructed (gobject); } @@ -428,7 +427,7 @@ gtk_at_spi_cache_add_context (GtkAtSpiCache *self, g_hash_table_insert (self->contexts_by_path, path_key, context); g_hash_table_insert (self->contexts_to_path, context, path_key); - GTK_NOTE (A11Y, g_message ("Adding context '%s' to cache", path_key)); + GTK_DEBUG (A11Y, "Adding context '%s' to cache", path_key); /* GetItems is safe from re-entrancy, but we still don't want to * emit an unnecessary signal while we're collecting ATContexts @@ -456,5 +455,5 @@ gtk_at_spi_cache_remove_context (GtkAtSpiCache *self, g_hash_table_remove (self->contexts_to_path, context); g_hash_table_remove (self->contexts_by_path, path); - GTK_NOTE (A11Y, g_message ("Removing context '%s' from cache", path)); + GTK_DEBUG (A11Y, "Removing context '%s' from cache", path); } diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index 7b62a1ea81..b098377de5 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -42,6 +42,7 @@ #include "a11y/atspi/atspi-component.h" #include "gtkdebug.h" +#include "gtkprivate.h" #include "gtkeditable.h" #include "gtkentryprivate.h" #include "gtkroot.h" @@ -461,7 +462,7 @@ handle_accessible_method (GDBusConnection *connection, { GtkAtSpiContext *self = user_data; - GTK_NOTE (A11Y, g_message ("handling %s on %s", method_name, object_path)); + GTK_DEBUG (A11Y, "handling %s on %s", method_name, object_path); if (g_strcmp0 (method_name, "GetRole") == 0) { @@ -666,7 +667,7 @@ handle_accessible_get_property (GDBusConnection *connection, GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self)); - GTK_NOTE (A11Y, g_message ("handling GetProperty %s on %s", property_name, object_path)); + GTK_DEBUG (A11Y, "handling GetProperty %s on %s", property_name, object_path); if (g_strcmp0 (property_name, "Name") == 0) { @@ -1420,9 +1421,9 @@ gtk_at_spi_context_register_object (GtkAtSpiContext *self) self->interfaces = g_variant_ref_sink (g_variant_builder_end (&interfaces)); - GTK_NOTE (A11Y, g_message ("Registered %d interfaces on object path '%s'", - self->n_registered_objects, - self->context_path)); + GTK_DEBUG (A11Y, "Registered %d interfaces on object path '%s'", + self->n_registered_objects, + self->context_path); } static void @@ -1549,9 +1550,9 @@ gtk_at_spi_context_unrealize (GtkATContext *context) GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (context); GtkAccessible *accessible = gtk_at_context_get_accessible (context); - GTK_NOTE (A11Y, g_message ("Unrealizing ATSPI context at '%s' for accessible '%s'", - self->context_path, - G_OBJECT_TYPE_NAME (accessible))); + GTK_DEBUG (A11Y, "Unrealizing ATSPI context at '%s' for accessible '%s'", + self->context_path, + G_OBJECT_TYPE_NAME (accessible)); /* Notify ATs that the accessible object is going away */ emit_defunct (self); @@ -1592,7 +1593,7 @@ gtk_at_spi_context_init (GtkAtSpiContext *self) static char * get_bus_address_x11 (GdkDisplay *display) { - GTK_NOTE (A11Y, g_message ("Acquiring a11y bus via X11...")); + GTK_DEBUG (A11Y, "Acquiring a11y bus via X11..."); Display *xdisplay = gdk_x11_display_get_xdisplay (display); Atom type_return; @@ -1623,14 +1624,14 @@ get_bus_address_x11 (GdkDisplay *display) static char * get_bus_address_dbus (GdkDisplay *display) { - GTK_NOTE (A11Y, g_message ("Acquiring a11y bus via DBus...")); + GTK_DEBUG (A11Y, "Acquiring a11y bus via DBus..."); GError *error = NULL; GDBusConnection *connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); if (error != NULL) { - GTK_NOTE (A11Y, g_message ("Unable to acquire session bus: %s", error->message)); + GTK_DEBUG (A11Y, "Unable to acquire session bus: %s", error->message); g_error_free (error); return NULL; } @@ -1647,8 +1648,8 @@ get_bus_address_dbus (GdkDisplay *display) &error); if (error != NULL) { - GTK_NOTE (A11Y, g_message ("Unable to acquire the address of the accessibility bus: %s", - error->message)); + GTK_DEBUG (A11Y, "Unable to acquire the address of the accessibility bus: %s", + error->message); g_error_free (error); } @@ -1681,7 +1682,7 @@ get_bus_address (GdkDisplay *display) bus_address = g_getenv ("AT_SPI_BUS_ADDRESS"); if (bus_address != NULL && *bus_address != '\0') { - GTK_NOTE (A11Y, g_message ("Using ATSPI bus address from environment: %s", bus_address)); + GTK_DEBUG (A11Y, "Using ATSPI bus address from environment: %s", bus_address); g_object_set_data_full (G_OBJECT (display), "-gtk-atspi-bus-address", g_strdup (bus_address), g_free); @@ -1695,7 +1696,7 @@ get_bus_address (GdkDisplay *display) { char *addr = get_bus_address_dbus (display); - GTK_NOTE (A11Y, g_message ("Using ATSPI bus address from D-Bus: %s", addr)); + GTK_DEBUG (A11Y, "Using ATSPI bus address from D-Bus: %s", addr); g_object_set_data_full (G_OBJECT (display), "-gtk-atspi-bus-address", addr, g_free); @@ -1714,11 +1715,11 @@ get_bus_address (GdkDisplay *display) if (addr == NULL) { addr = get_bus_address_x11 (display); - GTK_NOTE (A11Y, g_message ("Using ATSPI bus address from X11: %s", addr)); + GTK_DEBUG (A11Y, "Using ATSPI bus address from X11: %s", addr); } else { - GTK_NOTE (A11Y, g_message ("Using ATSPI bus address from D-Bus: %s", addr)); + GTK_DEBUG (A11Y, "Using ATSPI bus address from D-Bus: %s", addr); } g_object_set_data_full (G_OBJECT (display), "-gtk-atspi-bus-address", diff --git a/gtk/a11y/gtkatspiroot.c b/gtk/a11y/gtkatspiroot.c index 1335c7fb24..b39d0938d4 100644 --- a/gtk/a11y/gtkatspiroot.c +++ b/gtk/a11y/gtkatspiroot.c @@ -507,9 +507,9 @@ on_registration_reply (GObject *gobject, &self->desktop_path); g_variant_unref (reply); - GTK_NOTE (A11Y, g_message ("Connected to the a11y registry at (%s, %s)", - self->desktop_name, - self->desktop_path)); + GTK_DEBUG (A11Y, "Connected to the a11y registry at (%s, %s)", + self->desktop_name, + self->desktop_path); } /* Register the cache object */ @@ -581,9 +581,9 @@ root_register (gpointer user_data) NULL, NULL); - GTK_NOTE (A11Y, g_message ("Registering (%s, %s) on the a11y bus", - unique_name, - self->root_path)); + GTK_DEBUG (A11Y, "Registering (%s, %s) on the a11y bus", + unique_name, + self->root_path); g_dbus_connection_call (self->connection, "org.a11y.atspi.Registry", diff --git a/gtk/gtkactionhelper.c b/gtk/gtkactionhelper.c index 59da82a5dc..5bdeb02e74 100644 --- a/gtk/gtkactionhelper.c +++ b/gtk/gtkactionhelper.c @@ -24,6 +24,7 @@ #include "gtkdebug.h" #include "gtktypebuiltins.h" #include "gtkmodelbuttonprivate.h" +#include "gtkprivate.h" #include @@ -138,7 +139,7 @@ gtk_action_helper_action_added (GtkActionHelper *helper, GVariant *state, gboolean should_emit_signals) { - GTK_NOTE(ACTIONS, g_message("%s: action %s added", "actionhelper", helper->action_name)); + GTK_DEBUG (ACTIONS, "%s: action %s added", "actionhelper", helper->action_name); /* we can only activate if we have the correct type of parameter */ helper->can_activate = (helper->target == NULL && parameter_type == NULL) || @@ -156,11 +157,11 @@ gtk_action_helper_action_added (GtkActionHelper *helper, return; } - GTK_NOTE(ACTIONS, g_message ("%s: %s can be activated", "actionhelper", helper->action_name)); + GTK_DEBUG (ACTIONS, "%s: %s can be activated", "actionhelper", helper->action_name); helper->enabled = enabled; - GTK_NOTE(ACTIONS, g_message ("%s: action %s is %s", "actionhelper", helper->action_name, enabled ? "enabled" : "disabled")); + GTK_DEBUG (ACTIONS, "%s: action %s is %s", "actionhelper", helper->action_name, enabled ? "enabled" : "disabled"); if (helper->target != NULL && state != NULL) { @@ -193,7 +194,7 @@ static void gtk_action_helper_action_removed (GtkActionHelper *helper, gboolean should_emit_signals) { - GTK_NOTE(ACTIONS, g_message ("%s: action %s was removed", "actionhelper", helper->action_name)); + GTK_DEBUG (ACTIONS, "%s: action %s was removed", "actionhelper", helper->action_name); if (!helper->can_activate) return; @@ -221,7 +222,7 @@ static void gtk_action_helper_action_enabled_changed (GtkActionHelper *helper, gboolean enabled) { - GTK_NOTE(ACTIONS, g_message ("%s: action %s: enabled changed to %d", "actionhelper", helper->action_name, enabled)); + GTK_DEBUG (ACTIONS, "%s: action %s: enabled changed to %d", "actionhelper", helper->action_name, enabled); if (!helper->can_activate) return; @@ -239,7 +240,7 @@ gtk_action_helper_action_state_changed (GtkActionHelper *helper, { gboolean was_active; - GTK_NOTE(ACTIONS, g_message ("%s: %s state changed", "actionhelper", helper->action_name)); + GTK_DEBUG (ACTIONS, "%s: %s state changed", "actionhelper", helper->action_name); if (!helper->can_activate) return; @@ -415,11 +416,15 @@ gtk_action_helper_set_action_name (GtkActionHelper *helper, if (g_strcmp0 (action_name, helper->action_name) == 0) return; - GTK_NOTE(ACTIONS, - if (action_name == NULL || !strchr (action_name, '.')) - g_message ("%s: action name %s doesn't look like 'app.' or 'win.'; " - "it is unlikely to work", - "actionhelper", action_name)); +#ifdef G_ENABLE_DEBUG + if (GTK_DEBUG_CHECK (ACTIONS)) + { + if (action_name == NULL || !strchr (action_name, '.')) + gdk_debug_message ("%s: action name %s doesn't look like 'app.' or 'win.'; " + "it is unlikely to work", + "actionhelper", action_name); + } +#endif /* Start by recording the current state of our properties so we know * what notify signals we will need to send. @@ -448,7 +453,7 @@ gtk_action_helper_set_action_name (GtkActionHelper *helper, &enabled, ¶meter_type, NULL, NULL, &state)) { - GTK_NOTE(ACTIONS, g_message ("%s: action %s existed from the start", "actionhelper", helper->action_name)); + GTK_DEBUG (ACTIONS, "%s: action %s existed from the start", "actionhelper", helper->action_name); gtk_action_helper_action_added (helper, enabled, parameter_type, state, FALSE); @@ -457,7 +462,7 @@ gtk_action_helper_set_action_name (GtkActionHelper *helper, } else { - GTK_NOTE(ACTIONS, g_message ("%s: action %s missing from the start", "actionhelper", helper->action_name)); + GTK_DEBUG (ACTIONS, "%s: action %s missing from the start", "actionhelper", helper->action_name); helper->enabled = FALSE; } } diff --git a/gtk/gtkatcontext.c b/gtk/gtkatcontext.c index 9205e9b5fd..aa4b9f51f2 100644 --- a/gtk/gtkatcontext.c +++ b/gtk/gtkatcontext.c @@ -36,6 +36,7 @@ #include "gtkaccessiblevalueprivate.h" #include "gtkaccessibleprivate.h" #include "gtkdebug.h" +#include "gtkprivate.h" #include "gtktestatcontextprivate.h" #include "gtktypebuiltins.h" @@ -651,7 +652,7 @@ gtk_at_context_realize (GtkATContext *self) if (self->realized) return; - GTK_NOTE (A11Y, g_message ("Realizing AT context '%s'", G_OBJECT_TYPE_NAME (self))); + GTK_DEBUG (A11Y, "Realizing AT context '%s'", G_OBJECT_TYPE_NAME (self)); GTK_AT_CONTEXT_GET_CLASS (self)->realize (self); self->realized = TRUE; @@ -663,7 +664,7 @@ gtk_at_context_unrealize (GtkATContext *self) if (!self->realized) return; - GTK_NOTE (A11Y, g_message ("Unrealizing AT context '%s'", G_OBJECT_TYPE_NAME (self))); + GTK_DEBUG (A11Y, "Unrealizing AT context '%s'", G_OBJECT_TYPE_NAME (self)); GTK_AT_CONTEXT_GET_CLASS (self)->unrealize (self); self->realized = FALSE; diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index 8b7ce86eda..ee546191d7 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -650,9 +650,8 @@ gtk_builder_get_internal_child (GtkBuilder *builder, if (!info) break; - GTK_NOTE (BUILDER, - g_message ("Trying to get internal child %s from %s", - childname, object_get_id (info->object))); + GTK_DEBUG (BUILDER, "Trying to get internal child %s from %s", + childname, object_get_id (info->object)); if (GTK_IS_BUILDABLE (info->object)) obj = gtk_buildable_get_internal_child (GTK_BUILDABLE (info->object), @@ -857,8 +856,7 @@ _gtk_builder_construct (GtkBuilder *builder, if (G_IS_INITIALLY_UNOWNED (obj)) g_object_ref_sink (obj); - GTK_NOTE (BUILDER, - g_message ("created %s of type %s", info->id, g_type_name (info->type))); + GTK_DEBUG (BUILDER, "created %s of type %s", info->id, g_type_name (info->type)); } object_properties_destroy (&construct_parameters); @@ -1032,8 +1030,7 @@ _gtk_builder_add (GtkBuilder *builder, parent = ((ObjectInfo*)child_info->parent)->object; - GTK_NOTE (BUILDER, - g_message ("adding %s to %s", object_get_id (object), object_get_id (parent))); + GTK_DEBUG (BUILDER, "adding %s to %s", object_get_id (object), object_get_id (parent)); if (G_IS_LIST_STORE (parent)) { diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c index d02ad44d73..6f41b61943 100644 --- a/gtk/gtkbuilderparser.c +++ b/gtk/gtkbuilderparser.c @@ -648,9 +648,8 @@ parse_object (GtkBuildableParseContext *context, { data->requested_object_level = data->cur_object_level; - GTK_NOTE (BUILDER, - g_message ("requested object \"%s\" found at level %d", - object_id, data->requested_object_level)); + GTK_DEBUG (BUILDER, "requested object \"%s\" found at level %d", + object_id, data->requested_object_level); data->inside_requested_object = TRUE; } @@ -1848,7 +1847,7 @@ end_element (GtkBuildableParseContext *context, { ParserData *data = (ParserData*)user_data; - GTK_NOTE (BUILDER, g_message ("", element_name)); + GTK_DEBUG (BUILDER, "", element_name); if (data->subparser && data->subparser->start) { @@ -1930,9 +1929,8 @@ end_element (GtkBuildableParseContext *context, if (data->requested_objects && data->inside_requested_object && (data->cur_object_level == data->requested_object_level)) { - GTK_NOTE (BUILDER, - g_message ("requested object end found at level %d", - data->requested_object_level)); + GTK_DEBUG (BUILDER, "requested object end found at level %d", + data->requested_object_level); data->inside_requested_object = FALSE; } diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c index 7d83b83d16..bcf33dd310 100644 --- a/gtk/gtkconstraintlayout.c +++ b/gtk/gtkconstraintlayout.c @@ -998,12 +998,11 @@ gtk_constraint_layout_measure (GtkLayoutManager *manager, gtk_constraint_solver_remove_edit_variable (solver, opposite_size); gtk_constraint_solver_end_edit (solver); - GTK_NOTE (LAYOUT, - g_print ("layout %p %s size: min %d nat %d (for opposite size: %d)\n", + GTK_DEBUG (LAYOUT, "layout %p %s size: min %d nat %d (for opposite size: %d)", self, orientation == GTK_ORIENTATION_HORIZONTAL ? "horizontal" : "vertical", min_value, nat_value, - for_size)); + for_size); if (minimum != NULL) *minimum = min_value; @@ -1054,13 +1053,12 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager, stay_h = gtk_constraint_solver_add_stay_variable (solver, layout_height, GTK_CONSTRAINT_STRENGTH_REQUIRED); - GTK_NOTE (LAYOUT, - g_print ("Layout [%p]: { .x: %g, .y: %g, .w: %g, .h: %g }\n", + GTK_DEBUG (LAYOUT, "Layout [%p]: { .x: %g, .y: %g, .w: %g, .h: %g }", self, gtk_constraint_variable_get_value (layout_left), gtk_constraint_variable_get_value (layout_top), gtk_constraint_variable_get_value (layout_width), - gtk_constraint_variable_get_value (layout_height))); + gtk_constraint_variable_get_value (layout_height)); for (child = _gtk_widget_get_first_child (widget); child != NULL; @@ -1081,14 +1079,13 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager, var_height = get_child_attribute (self, child, GTK_CONSTRAINT_ATTRIBUTE_HEIGHT); var_baseline = get_child_attribute (self, child, GTK_CONSTRAINT_ATTRIBUTE_BASELINE); - GTK_NOTE (LAYOUT, - g_print ("Allocating child '%s'[%p] with { .x: %g, .y: %g, .w: %g, .h: %g, .b: %g }\n", + GTK_DEBUG (LAYOUT, "Allocating child '%s'[%p] with { .x: %g, .y: %g, .w: %g, .h: %g, .b: %g }", gtk_widget_get_name (child), child, gtk_constraint_variable_get_value (var_left), gtk_constraint_variable_get_value (var_top), gtk_constraint_variable_get_value (var_width), gtk_constraint_variable_get_value (var_height), - gtk_constraint_variable_get_value (var_baseline))); + gtk_constraint_variable_get_value (var_baseline)); child_alloc.x = floor (gtk_constraint_variable_get_value (var_left)); child_alloc.y = floor (gtk_constraint_variable_get_value (var_top)); diff --git a/gtk/gtkconstraintsolver.c b/gtk/gtkconstraintsolver.c index 4148cfc43a..dc562e4992 100644 --- a/gtk/gtkconstraintsolver.c +++ b/gtk/gtkconstraintsolver.c @@ -160,6 +160,7 @@ #include "gtkconstraintexpressionprivate.h" #include "gtkdebug.h" +#include "gtkprivate.h" #include #include @@ -796,7 +797,7 @@ gtk_constraint_solver_optimize (GtkConstraintSolver *self, if (min_ratio == DBL_MAX) { - GTK_NOTE (CONSTRAINTS, g_message ("Unbounded objective variable during optimization")); + GTK_DEBUG (CONSTRAINTS, "Unbounded objective variable during optimization"); break; } @@ -814,10 +815,9 @@ gtk_constraint_solver_optimize (GtkConstraintSolver *self, gtk_constraint_solver_pivot (self, entry, exit); } - GTK_NOTE (CONSTRAINTS, - g_message ("solver.optimize.time := %.3f ms (pass: %d)", - (float) (g_get_monotonic_time () - start_time) / 1000.f, - self->optimize_count)); + GTK_DEBUG (CONSTRAINTS, "solver.optimize.time := %.3f ms (pass: %d)", + (float) (g_get_monotonic_time () - start_time) / 1000.f, + self->optimize_count); } /*< private > @@ -1055,9 +1055,8 @@ gtk_constraint_solver_dual_optimize (GtkConstraintSolver *self) gtk_constraint_solver_pivot (self, entry_var, exit_var); } - GTK_NOTE (CONSTRAINTS, - g_message ("dual_optimize.time := %.3f ms", - (float) (g_get_monotonic_time () - start_time) / 1000.f)); + GTK_DEBUG (CONSTRAINTS, "dual_optimize.time := %.3f ms", + (float) (g_get_monotonic_time () - start_time) / 1000.f); } static void @@ -1198,8 +1197,8 @@ gtk_constraint_solver_choose_subject (GtkConstraintSolver *self, if (!G_APPROX_VALUE (gtk_constraint_expression_get_constant (expression), 0.0, 0.001)) { - GTK_NOTE (CONSTRAINTS, - g_message ("Unable to satisfy required constraint (choose_subject)")); + GTK_DEBUG (CONSTRAINTS, + "Unable to satisfy required constraint (choose_subject)"); return NULL; } @@ -1508,9 +1507,8 @@ gtk_constraint_solver_resolve (GtkConstraintSolver *solver) gtk_constraint_solver_reset_stay_constants (solver); - GTK_NOTE (CONSTRAINTS, - g_message ("resolve.time := %.3f ms", - (float) (g_get_monotonic_time () - start_time) / 1000.f)); + GTK_DEBUG (CONSTRAINTS, "resolve.time := %.3f ms", + (float) (g_get_monotonic_time () - start_time) / 1000.f); solver->needs_solving = FALSE; } diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c index 061b66f1cc..706de5450d 100644 --- a/gtk/gtkiconcache.c +++ b/gtk/gtkiconcache.c @@ -20,6 +20,7 @@ #include "gtkdebug.h" #include "gtkiconcacheprivate.h" #include "gtkiconcachevalidatorprivate.h" +#include "gtkprivate.h" #include #include @@ -66,7 +67,7 @@ gtk_icon_cache_unref (GtkIconCache *cache) if (cache->ref_count == 0) { - GTK_NOTE (ICONTHEME, g_message ("unmapping icon cache")); + GTK_DEBUG (ICONTHEME, "unmapping icon cache"); if (cache->map) g_mapped_file_unref (cache->map); @@ -87,7 +88,7 @@ gtk_icon_cache_new_for_path (const char *path) /* Check if we have a cache file */ cache_filename = g_build_filename (path, "icon-theme.cache", NULL); - GTK_NOTE (ICONTHEME, g_message ("look for icon cache in %s", path)); + GTK_DEBUG (ICONTHEME, "look for icon cache in %s", path); if (g_stat (path, &path_st) < 0) goto done; @@ -98,7 +99,7 @@ gtk_icon_cache_new_for_path (const char *path) /* Verify cache is up-to-date */ if (st.st_mtime < path_st.st_mtime) { - GTK_NOTE (ICONTHEME, g_message ("icon cache outdated")); + GTK_DEBUG (ICONTHEME, "icon cache outdated"); goto done; } @@ -127,7 +128,7 @@ gtk_icon_cache_new_for_path (const char *path) } #endif - GTK_NOTE (ICONTHEME, g_message ("found icon cache for %s", path)); + GTK_DEBUG (ICONTHEME, "found icon cache for %s", path); cache = g_new0 (GtkIconCache, 1); cache->ref_count = 1; diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 4c39604132..159c841a5f 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -1346,8 +1346,7 @@ do_theme_change (GtkIconTheme *self) if (!self->themes_valid) return; - GTK_DISPLAY_NOTE (self->display, ICONTHEME, - g_message ("change to icon theme \"%s\"", self->current_theme)); + GTK_DISPLAY_DEBUG (self->display, ICONTHEME, "change to icon theme \"%s\"", self->current_theme); blow_themes (self); queue_theme_changed (self); @@ -2038,19 +2037,22 @@ load_themes (GtkIconTheme *self) self->last_stat_time = g_get_monotonic_time (); - GTK_DISPLAY_NOTE (self->display, ICONTHEME, { - GList *l; - GString *s; - s = g_string_new ("Current icon themes "); - for (l = self->themes; l; l = l->next) - { - IconTheme *theme = l->data; - g_string_append (s, theme->name); - g_string_append_c (s, ' '); - } - g_message ("%s", s->str); - g_string_free (s, TRUE); - }); +#ifdef G_ENABLE_DEBUG + if (GTK_DISPLAY_DEBUG_CHECK (self->display, ICONTHEME)) + { + GList *l; + GString *s; + s = g_string_new ("Current icon themes "); + for (l = self->themes; l; l = l->next) + { + IconTheme *theme = l->data; + g_string_append (s, theme->name); + g_string_append_c (s, ' '); + } + gdk_debug_message ("%s", s->str); + g_string_free (s, TRUE); + } +#endif } static gboolean @@ -2169,9 +2171,13 @@ real_choose_icon (GtkIconTheme *self, key.flags = flags; /* This is used in the icontheme unit test */ - GTK_DISPLAY_NOTE (self->display, ICONTHEME, - for (i = 0; icon_names[i]; i++) - g_message ("\tlookup name: %s", icon_names[i])); +#ifdef G_ENABLE_DEBUG + if (GTK_DISPLAY_DEBUG_CHECK (self->display, ICONTHEME)) + { + for (i = 0; icon_names[i]; i++) + gdk_debug_message ("\tlookup name: %s", icon_names[i]); + } +#endif icon = icon_cache_lookup (self, &key); if (icon) @@ -2270,11 +2276,14 @@ real_choose_icon (GtkIconTheme *self, /* Fall back to missing icon */ if (icon == NULL) { - GTK_NOTE(ICONFALLBACK, { - char *s = g_strjoinv (", ", (char **)icon_names); - g_message ("No icon found in %s (or fallbacks) for: %s", self->current_theme, s); - g_free (s); - }); +#ifdef G_ENABLE_DEBUG + if (GTK_DEBUG_CHECK (ICONFALLBACK)) + { + char *s = g_strjoinv (", ", (char **)icon_names); + gdk_debug_message ("No icon found in %s (or fallbacks) for: %s", self->current_theme, s); + g_free (s); + } +#endif icon = icon_paintable_new ("image-missing", size, scale); icon->filename = g_strdup (IMAGE_MISSING_RESOURCE_PATH); icon->is_resource = TRUE; @@ -2482,8 +2491,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self, g_return_val_if_fail (icon_name != NULL, NULL); g_return_val_if_fail (scale >= 1, NULL); - GTK_DISPLAY_NOTE (self->display, ICONTHEME, - g_message ("looking up icon %s for scale %d", icon_name, scale)); + GTK_DISPLAY_DEBUG (self->display, ICONTHEME, "looking up icon %s for scale %d", icon_name, scale); gtk_icon_theme_lock (self); @@ -3151,8 +3159,7 @@ scan_directory (GtkIconTheme *self, const char *name; GHashTable *icons = NULL; - GTK_DISPLAY_NOTE (self->display, ICONTHEME, - g_message ("scanning directory %s", full_dir)); + GTK_DISPLAY_DEBUG (self->display, ICONTHEME, "scanning directory %s", full_dir); gdir = g_dir_open (full_dir, 0, NULL); @@ -3193,8 +3200,7 @@ scan_resource_directory (GtkIconTheme *self, char **children; int i; - GTK_DISPLAY_NOTE (self->display, ICONTHEME, - g_message ("scanning resource directory %s", full_dir)); + GTK_DISPLAY_DEBUG (self->display, ICONTHEME, "scanning resource directory %s", full_dir); children = g_resources_enumerate_children (full_dir, 0, NULL); diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c index 1f4168479a..5ad4ea6a66 100644 --- a/gtk/gtkimcontextquartz.c +++ b/gtk/gtkimcontextquartz.c @@ -71,7 +71,7 @@ quartz_get_preedit_string (GtkIMContext *context, { GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context); - GTK_NOTE (MODULES, g_print ("quartz_get_preedit_string\n")); + GTK_DEBUG (MODULES, "quartz_get_preedit_string\n"); if (str) *str = qc->preedit_str ? g_strdup (qc->preedit_str) : g_strdup (""); @@ -126,7 +126,7 @@ output_result (GtkIMContext *context, marked_str = g_strdup (g_object_get_data (G_OBJECT (surface), TIC_MARKED_TEXT)); if (fixed_str) { - GTK_NOTE (MODULES, g_print ("tic-insert-text: %s\n", fixed_str)); + GTK_DEBUG (MODULES, "tic-insert-text: %s", fixed_str); g_free (qc->preedit_str); qc->preedit_str = NULL; g_object_set_data (G_OBJECT (surface), TIC_INSERT_TEXT, NULL); @@ -136,7 +136,7 @@ output_result (GtkIMContext *context, unsigned int filtered = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (surface), GIC_FILTER_KEY)); - GTK_NOTE (MODULES, g_print ("filtered, %d\n", filtered)); + GTK_DEBUG (MODULES, "filtered, %d", filtered); if (filtered) retval = TRUE; else @@ -144,7 +144,7 @@ output_result (GtkIMContext *context, } if (marked_str) { - GTK_NOTE (MODULES, g_print ("tic-marked-text: %s\n", marked_str)); + GTK_DEBUG (MODULES, "tic-marked-text: %s", marked_str); qc->cursor_index = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (surface), TIC_SELECTED_POS)); @@ -177,7 +177,7 @@ quartz_filter_keypress (GtkIMContext *context, guint keyval; guint keycode; - GTK_NOTE (MODULES, g_print ("quartz_filter_keypress\n")); + GTK_DEBUG (MODULES, "quartz_filter_keypress"); if (!GDK_IS_MACOS_SURFACE (qc->client_surface)) return FALSE; @@ -220,7 +220,7 @@ quartz_filter_keypress (GtkIMContext *context, g_object_set_data (G_OBJECT (qc->client_surface), TIC_IN_KEY_DOWN, GUINT_TO_POINTER (FALSE)); - GTK_NOTE (MODULES, g_print ("quartz_filter_keypress done\n")); + GTK_DEBUG (MODULES, "quartz_filter_keypress done"); return retval; } @@ -257,7 +257,7 @@ discard_preedit (GtkIMContext *context) static void quartz_reset (GtkIMContext *context) { - GTK_NOTE (MODULES, g_print ("quartz_reset\n")); + GTK_DEBUG (MODULES, "quartz_reset"); discard_preedit (context); } @@ -267,7 +267,7 @@ quartz_set_client_surface (GtkIMContext *context, { GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context); - GTK_NOTE (MODULES, g_print ("quartz_set_client_surface: %p\n", widget)); + GTK_DEBUG (MODULES, "quartz_set_client_surface: %p", widget); qc->client_widget = widget; qc->client_surface = NULL; @@ -284,7 +284,7 @@ quartz_set_client_surface (GtkIMContext *context, static void quartz_focus_in (GtkIMContext *context) { - GTK_NOTE (MODULES, g_print ("quartz_focus_in\n")); + GTK_DEBUG (MODULES, "quartz_focus_in"); GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context); qc->focused = TRUE; @@ -293,7 +293,7 @@ quartz_focus_in (GtkIMContext *context) static void quartz_focus_out (GtkIMContext *context) { - GTK_NOTE (MODULES, g_print ("quartz_focus_out\n")); + GTK_DEBUG (MODULES, "quartz_focus_out"); GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context); qc->focused = FALSE; @@ -310,7 +310,7 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area) int sx, sy; double wx, wy; - GTK_NOTE (MODULES, g_print ("quartz_set_cursor_location\n")); + GTK_DEBUG (MODULES, "quartz_set_cursor_location"); if (!qc->client_surface || !qc->client_widget) return; @@ -341,7 +341,7 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area) static void quartz_set_use_preedit (GtkIMContext *context, gboolean use_preedit) { - GTK_NOTE (MODULES, g_print ("quartz_set_use_preedit: %d\n", use_preedit)); + GTK_DEBUG (MODULES, "quartz_set_use_preedit: %d", use_preedit); } static void @@ -353,7 +353,7 @@ commit_cb (GtkIMContext *context, const char *str, GtkIMContextQuartz *qc) static void imquartz_finalize (GObject *obj) { - GTK_NOTE (MODULES, g_print ("imquartz_finalize\n")); + GTK_DEBUG (MODULES, "imquartz_finalize"); GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (obj); g_free (qc->preedit_str); @@ -370,7 +370,7 @@ imquartz_finalize (GObject *obj) static void gtk_im_context_quartz_class_init (GtkIMContextQuartzClass *class) { - GTK_NOTE (MODULES, g_print ("gtk_im_context_quartz_class_init\n")); + GTK_DEBUG (MODULES, "gtk_im_context_quartz_class_init"); GtkIMContextClass *klass = GTK_IM_CONTEXT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -390,7 +390,7 @@ gtk_im_context_quartz_class_init (GtkIMContextQuartzClass *class) static void gtk_im_context_quartz_init (GtkIMContextQuartz *qc) { - GTK_NOTE (MODULES, g_print ("gtk_im_context_quartz_init\n")); + GTK_DEBUG (MODULES, "gtk_im_context_quartz_init"); qc->preedit_str = g_strdup (""); qc->cursor_index = 0; diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c index d252d2fce3..4c36cbe251 100644 --- a/gtk/gtkimmodule.c +++ b/gtk/gtkimmodule.c @@ -242,8 +242,7 @@ gtk_im_module_ensure_extension_point (void) if (registered) return; - GTK_NOTE (MODULES, - g_print ("Registering extension point %s\n", GTK_IM_MODULE_EXTENSION_POINT_NAME)); + GTK_DEBUG (MODULES, "Registering extension point %s", GTK_IM_MODULE_EXTENSION_POINT_NAME); ep = g_io_extension_point_register (GTK_IM_MODULE_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, GTK_TYPE_IM_CONTEXT); @@ -279,8 +278,7 @@ gtk_im_modules_init (void) paths = _gtk_get_module_path ("immodules"); for (i = 0; paths[i]; i++) { - GTK_NOTE (MODULES, - g_print ("Scanning io modules in %s\n", paths[i])); + GTK_DEBUG (MODULES, "Scanning io modules in %s", paths[i]); g_io_modules_scan_all_in_directory_with_scope (paths[i], scope); } g_strfreev (paths); diff --git a/gtk/gtkmediafile.c b/gtk/gtkmediafile.c index fa1f12d2a1..ea6df0560b 100644 --- a/gtk/gtkmediafile.c +++ b/gtk/gtkmediafile.c @@ -22,6 +22,7 @@ #include "gtkmediafileprivate.h" #include "gtkdebug.h" +#include "gtkprivate.h" #include "gtkintl.h" #include "gtkmodulesprivate.h" #include "gtknomediafileprivate.h" @@ -186,7 +187,7 @@ gtk_media_file_get_extension (void) GIOExtension *e; GIOExtensionPoint *ep; - GTK_NOTE (MODULES, g_print ("Looking up MediaFile extension\n")); + GTK_DEBUG (MODULES, "Looking up MediaFile extension"); ep = g_io_extension_point_lookup (GTK_MEDIA_FILE_EXTENSION_POINT_NAME); e = NULL; @@ -246,7 +247,8 @@ gtk_media_file_get_impl_type (void) e = gtk_media_file_get_extension (); impl_type = g_io_extension_get_type (e); - GTK_NOTE (MODULES, g_print ("Using %s from \"%s\" extension\n", g_type_name (impl_type), g_io_extension_get_name (e))); + GTK_DEBUG (MODULES, "Using %s from \"%s\" extension", + g_type_name (impl_type), g_io_extension_get_name (e)); return impl_type; } @@ -609,8 +611,7 @@ gtk_media_file_extension_init (void) char **paths; int i; - GTK_NOTE (MODULES, - g_print ("Registering extension point %s\n", GTK_MEDIA_FILE_EXTENSION_POINT_NAME)); + GTK_DEBUG (MODULES, "Registering extension point %s", GTK_MEDIA_FILE_EXTENSION_POINT_NAME); ep = g_io_extension_point_register (GTK_MEDIA_FILE_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, GTK_TYPE_MEDIA_FILE); @@ -622,8 +623,7 @@ gtk_media_file_extension_init (void) paths = _gtk_get_module_path ("media"); for (i = 0; paths[i]; i++) { - GTK_NOTE (MODULES, - g_print ("Scanning io modules in %s\n", paths[i])); + GTK_DEBUG (MODULES, "Scanning io modules in %s", paths[i]); g_io_modules_scan_all_in_directory_with_scope (paths[i], scope); } g_strfreev (paths); diff --git a/gtk/gtkmenutrackeritem.c b/gtk/gtkmenutrackeritem.c index 8b459c7a41..f938b3fe1d 100644 --- a/gtk/gtkmenutrackeritem.c +++ b/gtk/gtkmenutrackeritem.c @@ -23,6 +23,7 @@ #include "gtkactionmuxerprivate.h" #include "gtkdebug.h" #include "gtkintl.h" +#include "gtkprivate.h" #include @@ -302,7 +303,7 @@ gtk_menu_tracker_item_action_added (GtkActionObserver *observer, GtkMenuTrackerItemRole old_role; guint n_changed; - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s added", action_name)); + GTK_DEBUG (ACTIONS, "menutracker: action %s added", action_name); old_sensitive = self->sensitive; old_toggled = self->toggled; @@ -316,22 +317,22 @@ gtk_menu_tracker_item_action_added (GtkActionObserver *observer, if (!self->can_activate) { - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s can't be activated due to parameter type mismatch " - "(parameter type %s, target type %s)", - action_name, - parameter_type ? g_variant_type_peek_string (parameter_type) : "NULL", - action_target ? g_variant_get_type_string (action_target) : "NULL")); + GTK_DEBUG (ACTIONS, "menutracker: action %s can't be activated due to parameter type mismatch " + "(parameter type %s, target type %s)", + action_name, + parameter_type ? g_variant_type_peek_string (parameter_type) : "NULL", + action_target ? g_variant_get_type_string (action_target) : "NULL"); if (action_target) g_variant_unref (action_target); return; } - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s can be activated", action_name)); + GTK_DEBUG (ACTIONS, "menutracker: action %s can be activated", action_name); self->sensitive = enabled; - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s is %s", action_name, enabled ? "enabled" : "disabled")); + GTK_DEBUG (ACTIONS, "menutracker: action %s is %s", action_name, enabled ? "enabled" : "disabled"); if (action_target != NULL && state != NULL) { @@ -387,7 +388,7 @@ gtk_menu_tracker_item_action_enabled_changed (GtkActionObserver *observer, { GtkMenuTrackerItem *self = GTK_MENU_TRACKER_ITEM (observer); - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s: enabled changed to %d", action_name, enabled)); + GTK_DEBUG (ACTIONS, "menutracker: action %s: enabled changed to %d", action_name, enabled); if (!self->can_activate) return; @@ -412,7 +413,7 @@ gtk_menu_tracker_item_action_state_changed (GtkActionObserver *observer, GVariant *action_target; gboolean was_toggled; - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s: state changed", action_name)); + GTK_DEBUG (ACTIONS, "menutracker: action %s: state changed", action_name); if (!self->can_activate) return; @@ -445,7 +446,7 @@ gtk_menu_tracker_item_action_removed (GtkActionObserver *observer, gboolean was_sensitive, was_toggled; GtkMenuTrackerItemRole old_role; - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s was removed", action_name)); + GTK_DEBUG (ACTIONS, "menutracker: action %s was removed", action_name); if (!self->can_activate) return; @@ -562,10 +563,14 @@ _gtk_menu_tracker_item_new (GtkActionObservable *observable, action_name = strrchr (self->action_and_target, '|') + 1; - GTK_NOTE(ACTIONS, - if (!strchr (action_name, '.')) - g_message ("menutracker: action name %s doesn't look like 'app.' or 'win.'; " - "it is unlikely to work", action_name)); +#ifdef G_ENABLE_DEBUG + if (GTK_DEBUG_CHECK (ACTIONS)) + { + if (!strchr (action_name, '.')) + gdk_debug_message ("menutracker: action name %s doesn't look like 'app.' or 'win.'; " + "it is unlikely to work", action_name); + } +#endif state = NULL; @@ -574,12 +579,12 @@ _gtk_menu_tracker_item_new (GtkActionObservable *observable, if (found) { - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s existed from the start", action_name)); + GTK_DEBUG (ACTIONS, "menutracker: action %s existed from the start", action_name); gtk_menu_tracker_item_action_added (GTK_ACTION_OBSERVER (self), observable, action_name, parameter_type, enabled, state); } else { - GTK_NOTE(ACTIONS, g_message ("menutracker: action %s missing from the start", action_name)); + GTK_DEBUG (ACTIONS, "menutracker: action %s missing from the start", action_name); gtk_menu_tracker_item_update_visibility (self); } diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c index 9e628a5704..292e6d7bc9 100644 --- a/gtk/gtkprintbackend.c +++ b/gtk/gtkprintbackend.c @@ -88,8 +88,7 @@ gtk_print_backends_init (void) char **paths; int i; - GTK_NOTE (MODULES, - g_print ("Registering extension point %s\n", GTK_PRINT_BACKEND_EXTENSION_POINT_NAME)); + GTK_DEBUG (MODULES, "Registering extension point %s", GTK_PRINT_BACKEND_EXTENSION_POINT_NAME); ep = g_io_extension_point_register (GTK_PRINT_BACKEND_EXTENSION_POINT_NAME); g_io_extension_point_set_required_type (ep, GTK_TYPE_PRINT_BACKEND); @@ -99,8 +98,7 @@ gtk_print_backends_init (void) paths = _gtk_get_module_path ("printbackends"); for (i = 0; paths[i]; i++) { - GTK_NOTE (MODULES, - g_print ("Scanning io modules in %s\n", paths[i])); + GTK_DEBUG (MODULES, "Scanning io modules in %s", paths[i]); g_io_modules_scan_all_in_directory_with_scope (paths[i], scope); } g_strfreev (paths); @@ -159,8 +157,7 @@ gtk_print_backend_load_modules (void) if (!ext) continue; - GTK_NOTE (PRINTING, - g_print ("Found %s print backend\n", backends[i])); + GTK_DEBUG (PRINTING, "Found %s print backend", backends[i]); type = g_io_extension_get_type (ext); backend = g_object_new (type, NULL); diff --git a/gtk/gtkshortcutaction.c b/gtk/gtkshortcutaction.c index ccb46e327d..2d2d413900 100644 --- a/gtk/gtkshortcutaction.c +++ b/gtk/gtkshortcutaction.c @@ -57,6 +57,7 @@ #include "gtkintl.h" #include "gtkwidgetprivate.h" #include "gtkdebug.h" +#include "gtkprivate.h" /* {{{ GtkShortcutAction */ @@ -161,11 +162,14 @@ gtk_shortcut_action_activate (GtkShortcutAction *self, g_return_val_if_fail (GTK_IS_SHORTCUT_ACTION (self), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - GTK_NOTE (KEYBINDINGS, { - char *act = gtk_shortcut_action_to_string (self); - g_print ("Shortcut action activate on %s: %s\n", G_OBJECT_TYPE_NAME (widget), act); - g_free (act); - }); +#ifdef G_ENABLE_DEBUG + if (GTK_DEBUG_CHECK (KEYBINDINGS)) + { + char *act = gtk_shortcut_action_to_string (self); + gdk_debug_message ("Shortcut action activate on %s: %s", G_OBJECT_TYPE_NAME (widget), act); + g_free (act); + } +#endif return GTK_SHORTCUT_ACTION_GET_CLASS (self)->activate (self, flags, widget, args); } diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c index 637a705f87..100b3db809 100644 --- a/gtk/gtksizerequest.c +++ b/gtk/gtksizerequest.c @@ -427,26 +427,29 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget, g_assert (min_size <= nat_size); - GTK_DISPLAY_NOTE (_gtk_widget_get_display (widget), SIZE_REQUEST, { - GString *s; +#ifdef G_ENABLE_DEBUG + if (GTK_DISPLAY_DEBUG_CHECK (_gtk_widget_get_display (widget), SIZE_REQUEST)) + { + GString *s; - s = g_string_new (""); - g_string_append_printf (s, "[%p] %s\t%s: %d is minimum %d and natural: %d", - widget, G_OBJECT_TYPE_NAME (widget), - orientation == GTK_ORIENTATION_HORIZONTAL - ? "width for height" - : "height for width", - for_size, min_size, nat_size); - if (min_baseline != -1 || nat_baseline != -1) - { - g_string_append_printf (s, ", baseline %d/%d", - min_baseline, nat_baseline); - } - g_string_append_printf (s, " (hit cache: %s)\n", - found_in_cache ? "yes" : "no"); - g_printerr ("%s", s->str); - g_string_free (s, TRUE); - }); + s = g_string_new (""); + g_string_append_printf (s, "[%p] %s\t%s: %d is minimum %d and natural: %d", + widget, G_OBJECT_TYPE_NAME (widget), + orientation == GTK_ORIENTATION_HORIZONTAL + ? "width for height" + : "height for width", + for_size, min_size, nat_size); + if (min_baseline != -1 || nat_baseline != -1) + { + g_string_append_printf (s, ", baseline %d/%d", + min_baseline, nat_baseline); + } + g_string_append_printf (s, " (hit cache: %s)\n", + found_in_cache ? "yes" : "no"); + g_printerr ("%s", s->str); + g_string_free (s, TRUE); + } +#endif } /** diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index dda5a1f042..2a90295270 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -8412,9 +8412,9 @@ gtk_widget_accessible_get_at_context (GtkAccessible *accessible) if (priv->in_destruction) { - GTK_NOTE (A11Y, g_message ("ATContext for widget ā€œ%sā€ [%p] accessed during destruction", - G_OBJECT_TYPE_NAME (self), - self)); + GTK_DEBUG (A11Y, "ATContext for widget ā€œ%sā€ [%p] accessed during destruction", + G_OBJECT_TYPE_NAME (self), + self); return NULL; } @@ -12485,9 +12485,9 @@ gtk_widget_class_add_action (GtkWidgetClass *widget_class, { GtkWidgetClassPrivate *priv = widget_class->priv; - GTK_NOTE(ACTIONS, g_message ("%sClass: Adding %s action\n", - g_type_name (G_TYPE_FROM_CLASS (widget_class)), - action->name)); + GTK_DEBUG (ACTIONS, "%sClass: Adding %s action", + g_type_name (G_TYPE_FROM_CLASS (widget_class)), + action->name); action->next = priv->actions; priv->actions = action; diff --git a/modules/printbackends/gtkcupssecretsutils.c b/modules/printbackends/gtkcupssecretsutils.c index 47e707b114..d7a50fbbc3 100644 --- a/modules/printbackends/gtkcupssecretsutils.c +++ b/modules/printbackends/gtkcupssecretsutils.c @@ -20,6 +20,7 @@ #include #include +#include "gtkprivate.h" #include "gtkcupssecretsutils.h" @@ -69,8 +70,7 @@ create_attributes (const char *printer_uri, if (printer_uri == NULL) { - GTK_NOTE (PRINTING, - g_print ("create_attributes called with invalid parameters.\n")); + GTK_DEBUG (PRINTING, "create_attributes called with invalid parameters."); return NULL; } @@ -128,7 +128,7 @@ get_secret_cb (GObject *source_object, "Attributes"); if (attributes == NULL) { - GTK_NOTE (PRINTING, g_print ("Failed to lookup attributes.\n")); + GTK_DEBUG (PRINTING, "Failed to lookup attributes."); g_variant_unref (output); g_task_return_pointer (task, NULL, NULL); return; @@ -173,7 +173,7 @@ get_secret_cb (GObject *source_object, if (pw_field == -1) { /* should not happen... */ - GTK_NOTE (PRINTING, g_print ("No password required?.\n")); + GTK_DEBUG (PRINTING, "No password required?."); g_variant_unref (output); goto fail; } @@ -188,7 +188,7 @@ get_secret_cb (GObject *source_object, g_variant_unref (output); if (secret == NULL || g_variant_n_children (secret) != 4) { - GTK_NOTE (PRINTING, g_print ("Get secret response invalid.\n")); + GTK_DEBUG (PRINTING, "Get secret response invalid."); if (secret != NULL) g_variant_unref (secret); goto fail; @@ -202,7 +202,7 @@ get_secret_cb (GObject *source_object, if (ba_passwd == NULL) { - GTK_NOTE (PRINTING, g_print ("Invalid / no secret found.\n")); + GTK_DEBUG (PRINTING, "Invalid / no secret found."); g_variant_unref (s_value); goto fail; } @@ -216,8 +216,8 @@ get_secret_cb (GObject *source_object, if (auth_info[i] == NULL) { /* Error out if we did not find everything */ - GTK_NOTE (PRINTING, g_print ("Failed to lookup required attribute: %s.\n", - task_data->auth_info_required[i])); + GTK_DEBUG (PRINTING, "Failed to lookup required attribute: %s.", + task_data->auth_info_required[i]); goto fail; } } @@ -227,7 +227,7 @@ get_secret_cb (GObject *source_object, fail: /* Error out */ - GTK_NOTE (PRINTING, g_print ("Failed to lookup secret.\n")); + GTK_DEBUG (PRINTING, "Failed to lookup secret."); required_len = g_strv_length (task_data->auth_info_required); for (i = 0; i < required_len; i++) { @@ -263,7 +263,7 @@ create_item_cb (GObject *source_object, g_variant_get (output, "(&o&o)", &item, NULL); if (item != NULL && strlen (item) > 1) { - GTK_NOTE (PRINTING, g_print ("Successfully stored auth info.\n")); + GTK_DEBUG (PRINTING, "Successfully stored auth info."); g_task_return_pointer (task, NULL, NULL); return; } @@ -316,14 +316,14 @@ do_store_auth_info (GTask *task) g_free (additional_attrs); if (attributes == NULL) { - GTK_NOTE (PRINTING, g_print ("Failed to create attributes.\n")); + GTK_DEBUG (PRINTING, "Failed to create attributes."); g_task_return_pointer (task, NULL, NULL); return; } if (password == NULL) { - GTK_NOTE (PRINTING, g_print ("No secret to store.\n")); + GTK_DEBUG (PRINTING, "No secret to store."); g_task_return_pointer (task, NULL, NULL); return; } @@ -387,7 +387,7 @@ prompt_completed_cb (GDBusConnection *connection, if (dismissed == NULL) { - GTK_NOTE (PRINTING, g_print ("Invalid prompt signal.\n")); + GTK_DEBUG (PRINTING, "Invalid prompt signal."); g_task_return_pointer (task, NULL, NULL); return; } @@ -397,7 +397,7 @@ prompt_completed_cb (GDBusConnection *connection, if (is_dismissed) { - GTK_NOTE (PRINTING, g_print ("Collection unlock dismissed.\n")); + GTK_DEBUG (PRINTING, "Collection unlock dismissed."); g_task_return_pointer (task, NULL, NULL); return; } @@ -560,7 +560,7 @@ unlock_read_alias_cb (GObject *source_object, if (subresult == NULL) { - GTK_NOTE (PRINTING, g_print ("Invalid ReadAlias response.\n")); + GTK_DEBUG (PRINTING, "Invalid ReadAlias response."); g_task_return_pointer (task, NULL, NULL); return; } @@ -616,7 +616,7 @@ item_proxy_cb (GObject *source_object, if (locked == NULL) { - GTK_NOTE (PRINTING, g_print ("Failed to look up \"Locked\" property on item.\n")); + GTK_DEBUG (PRINTING, "Failed to look up \"Locked\" property on item."); g_task_return_pointer (task, NULL, NULL); return; } @@ -699,8 +699,7 @@ search_items_cb (GObject *source_object, if (item_paths == NULL) { - GTK_NOTE (PRINTING, - g_print ("SearchItems returned invalid result.\n")); + GTK_DEBUG (PRINTING, "SearchItems returned invalid result."); continue; } @@ -732,7 +731,7 @@ search_items_cb (GObject *source_object, if (!found_item) { - GTK_NOTE (PRINTING, g_print ("No match found in secrets service.\n")); + GTK_DEBUG (PRINTING, "No match found in secrets service."); g_task_return_pointer (task, NULL, NULL); return; } @@ -765,7 +764,7 @@ open_session_cb (GObject *source_object, if (session_variant == NULL) { - GTK_NOTE (PRINTING, g_print ("Invalid session path response.\n")); + GTK_DEBUG (PRINTING, "Invalid session path response."); g_variant_unref (output); g_task_return_pointer (task, NULL, NULL); return; @@ -775,7 +774,7 @@ open_session_cb (GObject *source_object, if (task_data->session_path == NULL) { - GTK_NOTE (PRINTING, g_print ("Invalid session path string value.\n")); + GTK_DEBUG (PRINTING, "Invalid session path string value."); g_variant_unref (session_variant); g_variant_unref (output); g_task_return_pointer (task, NULL, NULL); @@ -795,7 +794,7 @@ open_session_cb (GObject *source_object, secrets_attrs = create_attributes (task_data->printer_uri, NULL, NULL); if (secrets_attrs == NULL) { - GTK_NOTE (PRINTING, g_print ("Failed to create attributes.\n")); + GTK_DEBUG (PRINTING, "Failed to create attributes."); g_task_return_pointer (task, NULL, NULL); return; } @@ -1001,14 +1000,12 @@ store_done_cb (GObject *source_object, if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("Failed to store auth info: %s\n", error->message)); + GTK_DEBUG (PRINTING, "Failed to store auth info: %s", error->message); g_error_free (error); } g_object_unref (task); - GTK_NOTE (PRINTING, - g_print ("gtk_cups_secrets_service_store finished.\n")); + GTK_DEBUG (PRINTING, "gtk_cups_secrets_service_store finished."); } /** @@ -1029,8 +1026,7 @@ gtk_cups_secrets_service_store (char **auth_info, if (auth_info == NULL || auth_info_labels == NULL || printer_uri == NULL) { - GTK_NOTE (PRINTING, - g_print ("Invalid call to gtk_cups_secrets_service_store.\n")); + GTK_DEBUG (PRINTING, "Invalid call to gtk_cups_secrets_service_store."); return; } diff --git a/modules/printbackends/gtkcupsutils.c b/modules/printbackends/gtkcupsutils.c index 7955302819..325dc4880e 100644 --- a/modules/printbackends/gtkcupsutils.c +++ b/modules/printbackends/gtkcupsutils.c @@ -20,6 +20,7 @@ #include "config.h" #include #include "gtkcupsutils.h" +#include "gtkprivate.h" #include #include @@ -693,8 +694,7 @@ _post_send (GtkCupsRequest *request) char length[255]; struct stat data_info; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); request->poll_state = GTK_CUPS_HTTP_WRITE; @@ -745,8 +745,7 @@ _post_write_request (GtkCupsRequest *request) { ipp_state_t ipp_status; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); request->poll_state = GTK_CUPS_HTTP_WRITE; @@ -786,8 +785,7 @@ _post_write_data (GtkCupsRequest *request) char buffer[_GTK_CUPS_MAX_CHUNK_SIZE]; http_status_t http_status; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); request->poll_state = GTK_CUPS_HTTP_WRITE; @@ -941,8 +939,7 @@ _post_check (GtkCupsRequest *request) http_status = request->last_status; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s - status %i\n", G_STRFUNC, http_status)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s - status %i", G_STRFUNC, http_status); request->poll_state = GTK_CUPS_HTTP_READ; @@ -1135,8 +1132,7 @@ _post_read_response (GtkCupsRequest *request) { ipp_state_t ipp_status; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); request->poll_state = GTK_CUPS_HTTP_READ; @@ -1172,8 +1168,7 @@ _post_read_response (GtkCupsRequest *request) static void _get_send (GtkCupsRequest *request) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); request->poll_state = GTK_CUPS_HTTP_WRITE; @@ -1232,8 +1227,7 @@ _get_check (GtkCupsRequest *request) { http_status_t http_status; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); http_status = request->last_status; @@ -1406,8 +1400,7 @@ _get_read_data (GtkCupsRequest *request) GIOStatus io_status; GError *error; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); error = NULL; @@ -1416,8 +1409,7 @@ _get_read_data (GtkCupsRequest *request) bytes = httpRead2 (request->http, buffer, sizeof (buffer)); request->bytes_received += bytes; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %"G_GSIZE_FORMAT" bytes read\n", bytes)); + GTK_DEBUG (PRINTING, "CUPS Backend: %"G_GSIZE_FORMAT" bytes read", bytes); io_status = g_io_channel_write_chars (request->data_io, diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c index 9a713da0e4..41774a0bdd 100644 --- a/modules/printbackends/gtkprintbackendcups.c +++ b/modules/printbackends/gtkprintbackendcups.c @@ -48,6 +48,7 @@ #include #include #include +#include #include "gtkprintbackendcups.h" #include "gtkprintercups.h" @@ -291,8 +292,7 @@ g_io_module_query (void) GtkPrintBackend * gtk_print_backend_cups_new (void) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Creating a new CUPS print backend object\n")); + GTK_DEBUG (PRINTING, "CUPS Backend: Creating a new CUPS print backend object"); return g_object_new (GTK_TYPE_PRINT_BACKEND_CUPS, NULL); } @@ -365,8 +365,7 @@ _cairo_write_to_cups (void *closure, error = NULL; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Writing %i byte chunk to temp file\n", length)); + GTK_DEBUG (PRINTING, "CUPS Backend: Writing %i byte chunk to temp file", length); while (length > 0) { @@ -374,16 +373,15 @@ _cairo_write_to_cups (void *closure, if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Error writing to temp file, %s\n", - error->message)); + GTK_DEBUG (PRINTING, "CUPS Backend: Error writing to temp file, %s", + error->message); g_error_free (error); return CAIRO_STATUS_WRITE_ERROR; } - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Wrote %"G_GSIZE_FORMAT" bytes to temp file\n", written)); + GTK_DEBUG (PRINTING, "CUPS Backend: Wrote %"G_GSIZE_FORMAT" bytes to temp file", + written); data += written; length -= written; @@ -496,8 +494,7 @@ typedef struct { static void cups_free_print_stream_data (CupsPrintStreamData *data) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); if (data->dnotify) data->dnotify (data->user_data); @@ -515,8 +512,7 @@ cups_print_cb (GtkPrintBackendCups *print_backend, GError *error = NULL; CupsPrintStreamData *ps = user_data; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); if (gtk_cups_result_is_error (result)) error = g_error_new_literal (gtk_print_error_quark (), @@ -707,8 +703,7 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, char printer_absolute_uri[HTTP_MAX_URI]; http_t *http = NULL; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); cups_printer = GTK_PRINTER_CUPS (gtk_print_job_get_printer (job)); settings = gtk_print_job_get_settings (job); @@ -735,10 +730,9 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, { GError *error = NULL; - GTK_NOTE (PRINTING, - g_warning ("CUPS Backend: Error connecting to %s:%d", + GTK_DEBUG (PRINTING, "CUPS Backend: Error connecting to %s:%d", cups_printer->hostname, - cups_printer->port)); + cups_printer->port); error = g_error_new (gtk_print_error_quark (), GTK_CUPS_ERROR_GENERAL, @@ -836,9 +830,8 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, g_strv_length (cups_printer->auth_info_required) == 1 && g_strcmp0 (cups_printer->auth_info_required[0], "negotiate") == 0) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Ignoring auth-info-required \"%s\"\n", - cups_printer->auth_info_required[0])); + GTK_DEBUG (PRINTING, "CUPS Backend: Ignoring auth-info-required \"%s\"", + cups_printer->auth_info_required[0]); } else if (cups_printer->auth_info_required != NULL) { @@ -915,8 +908,7 @@ gtk_print_backend_cups_finalize (GObject *object) { GtkPrintBackendCups *backend_cups; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: finalizing CUPS backend module\n")); + GTK_DEBUG (PRINTING, "CUPS Backend: finalizing CUPS backend module"); backend_cups = GTK_PRINT_BACKEND_CUPS (object); @@ -959,8 +951,7 @@ gtk_print_backend_cups_dispose (GObject *object) GtkPrintBackendCups *backend_cups; int i; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); backend_cups = GTK_PRINT_BACKEND_CUPS (object); @@ -1061,8 +1052,7 @@ gtk_print_backend_cups_set_password (GtkPrintBackend *backend, { char *key = g_strconcat (username, "@", hostname, NULL); g_hash_table_insert (cups_backend->auth, key, g_strdup (password)); - GTK_NOTE (PRINTING, - g_print ("CUPS backend: caching password for %s\n", key)); + GTK_DEBUG (PRINTING, "CUPS backend: caching password for %s", key); } g_free (cups_backend->username); @@ -1160,8 +1150,7 @@ request_password (gpointer data) if (password && dispatch->request->password_state != GTK_CUPS_PASSWORD_NOT_VALID) { - GTK_NOTE (PRINTING, - g_print ("CUPS backend: using stored password for %s\n", key)); + GTK_DEBUG (PRINTING, "CUPS backend: using stored password for %s", key); overwrite_and_free (dispatch->request->password); dispatch->request->password = g_strdup (password); @@ -1348,14 +1337,13 @@ lookup_auth_info_cb (GObject *source_object, { if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("Failed to look up auth info: %s\n", error->message)); + GTK_DEBUG (PRINTING, "Failed to look up auth info: %s", error->message); g_error_free (error); } else { /* Error note should have been shown by the function causing this */ - GTK_NOTE (PRINTING, g_print ("Failed to look up auth info.\n")); + GTK_DEBUG (PRINTING, "Failed to look up auth info."); } dispatch->backend->authentication_lock = FALSE; g_object_unref (task); @@ -1521,8 +1509,7 @@ cups_dispatch_watch_check (GSource *source) GtkCupsPollState poll_state; gboolean result; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s \n", G_STRFUNC, source)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s ", G_STRFUNC, source); dispatch = (GtkPrintCupsDispatchWatch *) source; @@ -1559,8 +1546,7 @@ cups_dispatch_watch_prepare (GSource *source, dispatch = (GtkPrintCupsDispatchWatch *) source; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s \n", G_STRFUNC, source)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s ", G_STRFUNC, source); *timeout_ = -1; @@ -1588,17 +1574,15 @@ cups_dispatch_watch_dispatch (GSource *source, result = gtk_cups_request_get_result (dispatch->request); - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s \n", G_STRFUNC, source)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s ", G_STRFUNC, source); if (gtk_cups_result_is_error (result)) { - GTK_NOTE (PRINTING, - g_print("Error result: %s (type %i, status %i, code %i)\n", - gtk_cups_result_get_error_string (result), - gtk_cups_result_get_error_type (result), - gtk_cups_result_get_error_status (result), - gtk_cups_result_get_error_code (result))); + GTK_DEBUG (PRINTING, "Error result: %s (type %i, status %i, code %i)", + gtk_cups_result_get_error_string (result), + gtk_cups_result_get_error_type (result), + gtk_cups_result_get_error_status (result), + gtk_cups_result_get_error_code (result)); } ep_callback (GTK_PRINT_BACKEND (dispatch->backend), result, user_data); @@ -1612,8 +1596,7 @@ cups_dispatch_watch_finalize (GSource *source) GtkPrintCupsDispatchWatch *dispatch; GtkCupsResult *result; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s \n", G_STRFUNC, source)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s ", G_STRFUNC, source); dispatch = (GtkPrintCupsDispatchWatch *) source; @@ -1634,8 +1617,7 @@ cups_dispatch_watch_finalize (GSource *source) username = cupsUser (); key = g_strconcat (username, "@", hostname, NULL); - GTK_NOTE (PRINTING, - g_print ("CUPS backend: removing stored password for %s\n", key)); + GTK_DEBUG (PRINTING, "CUPS backend: removing stored password for %s", key); g_hash_table_remove (dispatch->backend->auth, key); g_free (key); @@ -1693,8 +1675,8 @@ cups_request_execute (GtkPrintBackendCups *print_backend, sizeof (GtkPrintCupsDispatchWatch)); g_source_set_static_name (&dispatch->source, "GTK CUPS backend"); - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s - Executing cups request on server '%s' and resource '%s'\n", G_STRFUNC, dispatch, request->server, request->resource)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s - Executing cups request on server '%s' and resource '%s'", + G_STRFUNC, dispatch, request->server, request->resource); dispatch->request = request; dispatch->backend = g_object_ref (print_backend); @@ -2438,8 +2420,7 @@ cups_printer_handle_attribute (GtkPrintBackendCups *cups_backend, } else { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Attribute %s ignored\n", ippGetName (attr))); + GTK_DEBUG (PRINTING, "CUPS Backend: Attribute %s ignored", ippGetName (attr)); } } @@ -2482,16 +2463,14 @@ cups_create_printer (GtkPrintBackendCups *cups_backend, { cups_printer->printer_uri = g_strdup (info->member_uris); /* TODO if member_uris is a class we need to recursively find a printer */ - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Found class with printer %s\n", - info->member_uris)); + GTK_DEBUG (PRINTING, "CUPS Backend: Found class with printer %s", + info->member_uris); } else { cups_printer->printer_uri = g_strdup (info->printer_uri); - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Found printer %s\n", - info->printer_uri)); + GTK_DEBUG (PRINTING, "CUPS Backend: Found printer %s", + info->printer_uri); } httpSeparateURI (HTTP_URI_CODING_ALL, cups_printer->printer_uri, @@ -2504,8 +2483,8 @@ cups_create_printer (GtkPrintBackendCups *cups_backend, if (strncmp (resource, "/printers/", 10) == 0) { cups_printer->ppd_name = g_strdup (resource + 10); - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Setting ppd name '%s' for printer/class '%s'\n", cups_printer->ppd_name, info->printer_name)); + GTK_DEBUG (PRINTING, "CUPS Backend: Setting ppd name '%s' for printer/class '%s'", + cups_printer->ppd_name, info->printer_name); } gethostname (uri, sizeof (uri)); @@ -2741,8 +2720,7 @@ typedef struct { static void request_printer_info_data_free (RequestPrinterInfoData *data) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); httpClose (data->http); g_object_unref (data->printer); g_free (data); @@ -2761,16 +2739,14 @@ cups_request_printer_info_cb (GtkPrintBackendCups *cups_backend, gboolean status_changed = FALSE; ipp_t *response; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); if (gtk_cups_result_is_error (result)) { - GTK_NOTE (PRINTING, - g_warning ("CUPS Backend: Error getting printer info: %s %d %d", + GTK_DEBUG (PRINTING, "CUPS Backend: Error getting printer info: %s %d %d", gtk_cups_result_get_error_string (result), gtk_cups_result_get_error_type (result), - gtk_cups_result_get_error_code (result))); + gtk_cups_result_get_error_code (result)); goto done; } @@ -2979,13 +2955,12 @@ cups_create_local_printer_cb (GtkPrintBackendCups *print_backend, printer_name = g_strdup (g_strrstr (ippGetString (attr, 0, NULL), "/") + 1); } - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Created local printer %s\n", printer_name)); + GTK_DEBUG (PRINTING, "CUPS Backend: Created local printer %s", printer_name); } else { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Creating of local printer failed: %d\n", ippGetStatusCode (response))); + GTK_DEBUG (PRINTING, "CUPS Backend: Creating of local printer failed: %d", + ippGetStatusCode (response)); } iter = g_list_find_custom (print_backend->temporary_queues_in_construction, printer_name, (GCompareFunc) g_strcmp0); @@ -3015,8 +2990,7 @@ create_temporary_queue (GtkPrintBackendCups *backend, if (iter != NULL) return; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Creating local printer %s\n", printer_name)); + GTK_DEBUG (PRINTING, "CUPS Backend: Creating local printer %s", printer_name); backend->temporary_queues_in_construction = g_list_prepend (backend->temporary_queues_in_construction, g_strdup (printer_name)); @@ -3175,10 +3149,9 @@ avahi_connection_test_cb (GObject *source_object, } else { - GTK_NOTE (PRINTING, - g_warning ("CUPS Backend: Can not connect to %s: %s\n", + GTK_DEBUG (PRINTING, "CUPS Backend: Can not connect to %s: %s", data->address, - error->message)); + error->message); g_error_free (error); } @@ -3680,18 +3653,16 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, list_has_changed = FALSE; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); cups_backend->list_printers_pending = FALSE; if (gtk_cups_result_is_error (result)) { - GTK_NOTE (PRINTING, - g_warning ("CUPS Backend: Error getting printer list: %s %d %d", + GTK_DEBUG (PRINTING, "CUPS Backend: Error getting printer list: %s %d %d", gtk_cups_result_get_error_string (result), gtk_cups_result_get_error_type (result), - gtk_cups_result_get_error_code (result))); + gtk_cups_result_get_error_code (result)); if (gtk_cups_result_get_error_type (result) == GTK_CUPS_ERROR_AUTH && gtk_cups_result_get_error_code (result) == 1) @@ -3998,8 +3969,7 @@ typedef struct { static void get_ppd_data_free (GetPPDData *data) { - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); httpClose (data->http); g_io_channel_unref (data->ppd_io); g_object_unref (data->printer); @@ -4014,8 +3984,7 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, GtkPrinter *printer; struct stat data_info; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); printer = GTK_PRINTER (data->printer); GTK_PRINTER_CUPS (printer)->reading_ppd = FALSE; @@ -4111,8 +4080,7 @@ cups_request_ppd (GtkPrinter *printer) error = NULL; - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: %s\n", G_STRFUNC)); + GTK_DEBUG (PRINTING, "CUPS Backend: %s", G_STRFUNC); if (cups_printer->remote && !cups_printer->avahi_browsed) { @@ -4186,9 +4154,8 @@ cups_request_ppd (GtkPrinter *printer) if (error != NULL) { - GTK_NOTE (PRINTING, - g_warning ("CUPS Backend: Failed to create temp file, %s\n", - error->message)); + GTK_DEBUG (PRINTING, "CUPS Backend: Failed to create temp file, %s", + error->message); g_error_free (error); httpClose (http); g_free (ppd_filename); @@ -4220,9 +4187,8 @@ cups_request_ppd (GtkPrinter *printer) cups_printer->ipp_version_major, cups_printer->ipp_version_minor); - GTK_NOTE (PRINTING, - g_print ("CUPS Backend: Requesting resource %s to be written to temp file %s\n", resource, ppd_filename)); - + GTK_DEBUG (PRINTING, "CUPS Backend: Requesting resource %s to be written to temp file %s", + resource, ppd_filename); cups_printer->reading_ppd = TRUE; GTK_PRINT_BACKEND_CUPS (print_backend)->reading_ppds++; @@ -4602,8 +4568,7 @@ ppd_text_to_utf8 (ppd_file_t *ppd_file, if (res == NULL) { - GTK_NOTE (PRINTING, - g_warning ("CUPS Backend: Unable to convert PPD text\n")); + GTK_DEBUG (PRINTING, "CUPS Backend: Unable to convert PPD text"); res = g_strdup ("???"); } diff --git a/modules/printbackends/gtkprintbackendfile.c b/modules/printbackends/gtkprintbackendfile.c index 94718820c4..0275492f65 100644 --- a/modules/printbackends/gtkprintbackendfile.c +++ b/modules/printbackends/gtkprintbackendfile.c @@ -36,6 +36,7 @@ #include "gtk/gtk.h" #include "gtk/gtkprinterprivate.h" +#include "gtk/gtkprivate.h" #include "gtkprintbackendfile.h" @@ -282,8 +283,7 @@ _cairo_write (void *closure, error = NULL; - GTK_NOTE (PRINTING, - g_print ("FILE Backend: Writing %u byte chunk to temp file\n", length)); + GTK_DEBUG (PRINTING, "FILE Backend: Writing %u byte chunk to temp file", length); while (length > 0) { @@ -295,8 +295,7 @@ _cairo_write (void *closure, { if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("FILE Backend: Error writing to temp file, %s\n", error->message)); + GTK_DEBUG (PRINTING, "FILE Backend: Error writing to temp file, %s", error->message); g_error_free (error); } @@ -304,8 +303,7 @@ _cairo_write (void *closure, return CAIRO_STATUS_WRITE_ERROR; } - GTK_NOTE (PRINTING, - g_print ("FILE Backend: Wrote %zd bytes to temp file\n", written)); + GTK_DEBUG (PRINTING, "FILE Backend: Wrote %zd bytes to temp file", written); data += written; length -= written; @@ -436,8 +434,7 @@ file_write (GIOChannel *source, if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("FILE Backend: %s\n", error->message)); + GTK_DEBUG (PRINTING, "FILE Backend: %s", error->message); g_error_free (error); } @@ -445,8 +442,7 @@ file_write (GIOChannel *source, return FALSE; } - GTK_NOTE (PRINTING, - g_print ("FILE Backend: Writing %"G_GSIZE_FORMAT" byte chunk to target file\n", bytes_read)); + GTK_DEBUG (PRINTING, "FILE Backend: Writing %"G_GSIZE_FORMAT" byte chunk to target file", bytes_read); return TRUE; } diff --git a/modules/printbackends/gtkprintbackendlpr.c b/modules/printbackends/gtkprintbackendlpr.c index 44c40a1626..f3029e64ae 100644 --- a/modules/printbackends/gtkprintbackendlpr.c +++ b/modules/printbackends/gtkprintbackendlpr.c @@ -155,8 +155,7 @@ _cairo_write (void *closure, error = NULL; - GTK_NOTE (PRINTING, - g_print ("LPR Backend: Writing %i byte chunk to temp file\n", length)); + GTK_DEBUG (PRINTING, "LPR Backend: Writing %i byte chunk to temp file", length); while (length > 0) { @@ -164,15 +163,13 @@ _cairo_write (void *closure, if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("LPR Backend: Error writing to temp file, %s\n", error->message)); + GTK_DEBUG (PRINTING, "LPR Backend: Error writing to temp file, %s", error->message); g_error_free (error); return CAIRO_STATUS_WRITE_ERROR; } - GTK_NOTE (PRINTING, - g_print ("LPR Backend: Wrote %" G_GSIZE_FORMAT " bytes to temp file\n", written)); + GTK_DEBUG (PRINTING, "LPR Backend: Wrote %" G_GSIZE_FORMAT " bytes to temp file", written); data += written; length -= written; @@ -274,8 +271,7 @@ lpr_write (GIOChannel *source, if (error != NULL) { - GTK_NOTE (PRINTING, - g_print ("LPR Backend: %s\n", error->message)); + GTK_DEBUG (PRINTING, "LPR Backend: %s", error->message); g_error_free (error); } @@ -283,9 +279,7 @@ lpr_write (GIOChannel *source, return FALSE; } - GTK_NOTE (PRINTING, - g_print ("LPR Backend: Writing %" G_GSIZE_FORMAT " byte chunk to lpr pipe\n", bytes_read)); - + GTK_DEBUG (PRINTING, "LPR Backend: Writing %" G_GSIZE_FORMAT " byte chunk to lpr pipe", bytes_read); return TRUE; } From 52b6dbf2b44059962d919a355bed1201cb63f532 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 23 Sep 2022 18:51:46 -0400 Subject: [PATCH 30/30] gtk: Remove old debug macros These are no longer used. --- gtk/gtkdebug.h | 5 ----- gtk/gtkprivate.h | 6 ------ 2 files changed, 11 deletions(-) diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h index a5b8eff2d1..f65c1e76de 100644 --- a/gtk/gtkdebug.h +++ b/gtk/gtkdebug.h @@ -89,14 +89,9 @@ typedef enum { #define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_##type) -#define GTK_NOTE(type,action) G_STMT_START { \ - if (GTK_DEBUG_CHECK (type)) \ - { action; }; } G_STMT_END - #else /* !G_ENABLE_DEBUG */ #define GTK_DEBUG_CHECK(type) 0 -#define GTK_NOTE(type, action) #endif /* G_ENABLE_DEBUG */ diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h index c78efc03c6..f7574dea72 100644 --- a/gtk/gtkprivate.h +++ b/gtk/gtkprivate.h @@ -140,11 +140,6 @@ GBytes *get_emoji_data (void); (gtk_get_any_display_debug_flag_set () && \ G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type)) -#define GTK_DISPLAY_NOTE(display,type,action) \ - G_STMT_START { \ - if (GTK_DISPLAY_DEBUG_CHECK (display,type)) { action; }; \ - } G_STMT_END - #define GTK_DEBUG(type,...) \ G_STMT_START { \ if (GTK_DEBUG_CHECK (type)) \ @@ -160,7 +155,6 @@ GBytes *get_emoji_data (void); #else #define GTK_DISPLAY_DEBUG_CHECK(display,type) 0 -#define GTK_DISPLAY_NOTE(display,type,action) #define GTK_DISPLAY_DEBUG(display,type,...) #define GTK_DEBUG(type,...)