[gtk+] Make gdk logging per-display



commit e151058dffbfd3b43798c2e6813eae9b952ba2d1
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 11 19:48:27 2018 -0500

    Make gdk logging per-display
    
    As far as possible, use per-display debug flags.
    
    This will minimize the debug spew that we get from
    the inspector if it is running on a separate display.

 gdk/gdk-private.h                      |    4 -
 gdk/gdkdisplay.c                       |    2 +-
 gdk/gdkgl.c                            |   10 ++-
 gdk/gdkglcontext.c                     |   19 +++-
 gdk/gdkinternals.h                     |   21 +++--
 gdk/gdkvulkancontext.c                 |   21 +++--
 gdk/gdkvulkancontextprivate.h          |    6 +-
 gdk/gdkwindow.c                        |   10 +-
 gdk/wayland/gdkclipboard-wayland.c     |   23 +++--
 gdk/wayland/gdkdevice-wayland.c        |  149 +++++++++++++++++++-------------
 gdk/wayland/gdkdisplay-wayland.c       |    2 +-
 gdk/wayland/gdkdnd-wayland.c           |    2 +-
 gdk/wayland/gdkglcontext-wayland.c     |   16 ++--
 gdk/wayland/gdkkeys-wayland.c          |    4 +-
 gdk/wayland/gdkprimary-wayland.c       |   18 ++--
 gdk/wayland/gdkselection-wayland.c     |   21 ++---
 gdk/wayland/gdkwindow-wayland.c        |   18 ++--
 gdk/x11/gdkclipboard-x11.c             |  115 +++++++++++++-----------
 gdk/x11/gdkdevice-core-x11.c           |    2 +-
 gdk/x11/gdkdevice-xi2.c                |   20 ++--
 gdk/x11/gdkdevicemanager-core-x11.c    |   14 ++--
 gdk/x11/gdkdevicemanager-x11.c         |    4 +-
 gdk/x11/gdkdevicemanager-xi2.c         |   18 ++--
 gdk/x11/gdkdisplay-x11.c               |   33 ++++----
 gdk/x11/gdkdnd-x11.c                   |   96 ++++++++++----------
 gdk/x11/gdkglcontext-x11.c             |   28 +++---
 gdk/x11/gdkselectioninputstream-x11.c  |   24 +++---
 gdk/x11/gdkselectionoutputstream-x11.c |   40 ++++----
 gdk/x11/gdkvisual-x11.c                |    2 +-
 gdk/x11/gdkwindow-x11.c                |    4 +-
 gdk/x11/xsettings-client.c             |   14 ++--
 gtk/inspector/window.c                 |    5 +
 32 files changed, 412 insertions(+), 353 deletions(-)
---
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index 5c1c575..d262809 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -22,10 +22,6 @@ void            gdk_window_thaw_toplevel_updates        (GdkWindow *window);
 
 gboolean        gdk_window_supports_edge_constraints    (GdkWindow *window);
 
-GdkDebugFlags    gdk_display_get_debug_flags    (GdkDisplay       *display);
-void             gdk_display_set_debug_flags    (GdkDisplay       *display,
-                                                 GdkDebugFlags     flags);
-
 void            gdk_window_move_to_rect         (GdkWindow          *window,
                                                  const GdkRectangle *rect,
                                                  GdkGravity          rect_anchor,
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index aff7577..fd425d6 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1505,7 +1505,7 @@ gdk_display_make_gl_context_current (GdkDisplay   *display,
 GdkDebugFlags
 gdk_display_get_debug_flags (GdkDisplay *display)
 {
-  return display->debug_flags;
+  return display ? display->debug_flags : _gdk_debug_flags;
 }
 
 void
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index 9b45b75..cf0fbd5 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -455,6 +455,7 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
                             cairo_region_t  *region)
 {
   GdkGLContext *paint_context;
+  GdkDisplay *display;
   cairo_surface_t *image;
   double device_x_offset, device_y_offset;
   cairo_rectangle_int_t rect, e;
@@ -469,8 +470,13 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
   guint target;
 
   paint_context = gdk_gl_context_get_current ();
-  if (GDK_DEBUG_CHECK (GL_SOFTWARE) == 0 &&
-      paint_context &&
+  if (paint_context)
+    display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (paint_context));
+  else
+    display = NULL;
+
+  if (paint_context &&
+      GDK_DISPLAY_DEBUG_CHECK (display, GL_SOFTWARE) == 0 &&
       GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface &&
       GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface (paint_context, surface, region))
     return;
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index a24825e..64d7297 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -555,6 +555,7 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
                                      int           minor)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+  GdkDisplay *display;
   int version, min_ver;
 
   g_return_if_fail (GDK_IS_GL_CONTEXT (context));
@@ -571,7 +572,9 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
   /* Enforce a minimum context version number of 3.2 */
   version = (major * 100) + minor;
 
-  if (priv->use_es > 0 || GDK_DEBUG_CHECK (GL_GLES))
+  display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
+
+  if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES))
     min_ver = 200;
   else
     min_ver = 302;
@@ -602,12 +605,15 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
                                      int          *minor)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+  GdkDisplay *display;
   int default_major, default_minor;
   int maj, min;
 
   g_return_if_fail (GDK_IS_GL_CONTEXT (context));
 
-  if (priv->use_es > 0 || GDK_DEBUG_CHECK (GL_GLES))
+  display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
+
+  if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES))
     {
       default_major = 2;
       default_minor = 0;
@@ -769,6 +775,7 @@ static void
 gdk_gl_context_check_extensions (GdkGLContext *context)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+  GdkDisplay *display;
   gboolean has_npot, has_texture_rectangle;
 
   if (!priv->realized)
@@ -812,7 +819,9 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
         priv->is_legacy = TRUE;
     }
 
-  if (!priv->use_es && GDK_DEBUG_CHECK (GL_TEXTURE_RECT))
+  display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
+
+  if (!priv->use_es && GDK_DISPLAY_DEBUG_CHECK (display, GL_TEXTURE_RECT))
     priv->use_texture_rectangle = TRUE;
   else if (has_npot)
     priv->use_texture_rectangle = FALSE;
@@ -821,8 +830,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
   else
     g_warning ("GL implementation doesn't support any form of non-power-of-two textures");
 
-  GDK_NOTE (OPENGL,
-            g_message ("%s version: %d.%d (%s)\n"
+  GDK_DISPLAY_NOTE (display, OPENGL,
+    g_message ("%s version: %d.%d (%s)\n"
                        "* GLSL version: %s\n"
                        "* Extensions checked:\n"
                        " - GL_ARB_texture_non_power_of_two: %s\n"
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 38d078e..e47281f 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -87,25 +87,28 @@ extern GdkWindow        *_gdk_parent_root;
 
 extern guint _gdk_debug_flags;
 
+GdkDebugFlags    gdk_display_get_debug_flags    (GdkDisplay       *display);
+void             gdk_display_set_debug_flags    (GdkDisplay       *display,
+                                                 GdkDebugFlags     flags);
 
 #ifdef G_ENABLE_DEBUG
 
-#define GDK_DEBUG_CHECK(type) G_UNLIKELY (_gdk_debug_flags & GDK_DEBUG_##type)
-
-#define GDK_NOTE(type,action)                G_STMT_START {     \
-    if (GDK_DEBUG_CHECK (type))                                 \
-       { action; };                          } G_STMT_END
-
-#define GDK_DISPLAY_DEBUG_CHECK(display,type) G_UNLIKELY(gdk_display_get_debug_flags (display) & 
GDK_DEBUG_##type)
+#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
 
 #else /* !G_ENABLE_DEBUG */
 
-#define GDK_DEBUG_CHECK(type) 0
-#define GDK_NOTE(type,action)
 #define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
+#define GDK_DISPLAY_NOTE(display,type,action)
 
 #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)
+
 /* Event handling */
 
 typedef struct _GdkEventPrivate GdkEventPrivate;
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index 72657f2..df502c5 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -245,7 +245,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext  *context,
     }
   else
     {
-      GDK_NOTE (VULKAN, g_warning ("Vulkan swapchain doesn't do transparency. Using opaque swapchain 
instead."));
+      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."));
       composite_alpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
     }
 
@@ -762,7 +763,7 @@ gdk_display_create_vulkan_device (GdkDisplay  *display,
         }
     }
 
-  if (list_devices || GDK_DEBUG_CHECK (VULKAN))
+  if (list_devices || GDK_DISPLAY_DEBUG_CHECK (display, VULKAN))
     {
       for (i = 0; i < n_devices; i++)
         {
@@ -824,7 +825,7 @@ gdk_display_create_vulkan_device (GdkDisplay  *display,
         {
           if (queue_props[j].queueFlags & VK_QUEUE_GRAPHICS_BIT)
             {
-              GDK_NOTE (VULKAN, g_print ("Using Vulkan device %u, queue %u\n", i, j));
+              GDK_DISPLAY_NOTE (display, VULKAN, g_print ("Using Vulkan device %u, queue %u\n", i, j));
               if (GDK_VK_CHECK (vkCreateDevice, devices[i],
                                                 &(VkDeviceCreateInfo) {
                                                     VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
@@ -913,11 +914,12 @@ gdk_display_create_vulkan_instance (GdkDisplay  *display,
 
   for (i = 0; i < n_extensions; i++)
     {
-      GDK_NOTE (VULKAN, g_print ("Extension available: %s v%u.%u.%u\n",
+      if (GDK_DISPLAY_DEBUG_CHECK (display, VULKAN))
+        g_print ("Extension available: %s v%u.%u.%u\n",
                                  extensions[i].extensionName,
                                  VK_VERSION_MAJOR (extensions[i].specVersion),
                                  VK_VERSION_MINOR (extensions[i].specVersion),
-                                 VK_VERSION_PATCH (extensions[i].specVersion)));
+                                 VK_VERSION_PATCH (extensions[i].specVersion));
 
       if (g_str_equal (extensions[i].extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME))
         {
@@ -935,13 +937,14 @@ gdk_display_create_vulkan_instance (GdkDisplay  *display,
 
   for (i = 0; i < n_layers; i++)
     {
-      GDK_NOTE (VULKAN, g_print ("Layer available: %s v%u.%u.%u (%s)\n",
+      if (GDK_DISPLAY_DEBUG_CHECK (display, VULKAN))
+        g_print ("Layer available: %s v%u.%u.%u (%s)\n",
                                  layers[i].layerName,
                                  VK_VERSION_MAJOR (layers[i].specVersion),
                                  VK_VERSION_MINOR (layers[i].specVersion),
                                  VK_VERSION_PATCH (layers[i].specVersion),
-                                 layers[i].description));
-      if (GDK_DEBUG_CHECK (VULKAN_VALIDATE) &&
+                                 layers[i].description);
+      if (GDK_DISPLAY_DEBUG_CHECK (display, VULKAN_VALIDATE) &&
           g_str_equal (layers[i].layerName, "VK_LAYER_LUNARG_standard_validation"))
         {
           g_ptr_array_add (used_layers, (gpointer) "VK_LAYER_LUNARG_standard_validation");
@@ -949,7 +952,7 @@ gdk_display_create_vulkan_instance (GdkDisplay  *display,
         }
     }
 
-  if (GDK_DEBUG_CHECK (VULKAN_VALIDATE) && !validate)
+  if (GDK_DISPLAY_DEBUG_CHECK (display, VULKAN_VALIDATE) && !validate)
     {
       g_warning ("Vulkan validation layers were requested, but not found. Running without.");
     }
diff --git a/gdk/gdkvulkancontextprivate.h b/gdk/gdkvulkancontextprivate.h
index c7b987f..cd2216e 100644
--- a/gdk/gdkvulkancontextprivate.h
+++ b/gdk/gdkvulkancontextprivate.h
@@ -60,9 +60,7 @@ gdk_vulkan_handle_result (VkResult    res,
                           const char *called_function)
 {
   if (res != VK_SUCCESS)
-    {
-      GDK_NOTE (VULKAN,g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res));
-    }
+    GDK_NOTE (VULKAN, g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res));
   return res;
 }
 
@@ -78,7 +76,7 @@ static inline gboolean
 gdk_display_ref_vulkan (GdkDisplay  *display,
                         GError     **error)
 {
-  GDK_NOTE (VULKAN, g_print ("Support for Vulkan disabled at compile-time"));
+  GDK_NOTE (display, VULKAN, g_print ("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.");
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c67117f..2b55976 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -998,7 +998,7 @@ gdk_window_new (GdkDisplay    *display,
 
   g_signal_connect (display, "seat-removed", G_CALLBACK (seat_removed_cb), window);
 
-  if (GDK_DEBUG_CHECK (GL_ALWAYS))
+  if (GDK_DISPLAY_DEBUG_CHECK (display, GL_ALWAYS))
     {
       GError *error = NULL;
 
@@ -1871,7 +1871,7 @@ gdk_window_get_paint_gl_context (GdkWindow  *window,
 {
   GError *internal_error = NULL;
 
-  if (GDK_DEBUG_CHECK (GL_DISABLE))
+  if (GDK_DISPLAY_DEBUG_CHECK (window->display, GL_DISABLE))
     {
       g_set_error_literal (error, GDK_GL_ERROR,
                            GDK_GL_ERROR_NOT_AVAILABLE,
@@ -1976,7 +1976,7 @@ gdk_window_create_vulkan_context (GdkWindow  *window,
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
-  if (GDK_DEBUG_CHECK (VULKAN_DISABLE))
+  if (GDK_DISPLAY_DEBUG_CHECK (window->display, VULKAN_DISABLE))
     {
       g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
                            _("Vulkan support disabled via GDK_DEBUG"));
@@ -5781,13 +5781,13 @@ gdk_window_create_similar_surface (GdkWindow *     window,
   sx = sy = 1;
   cairo_surface_get_device_scale (window_surface, &sx, &sy);
 
-  if (GDK_DEBUG_CHECK (CAIRO_RECORDING))
+  if (GDK_DISPLAY_DEBUG_CHECK (window->display, CAIRO_RECORDING))
     {
       cairo_rectangle_t rect = { 0, 0, width * sx, height *sy };
       surface = cairo_recording_surface_create (content, &rect);
       cairo_surface_set_device_scale (surface, sx, sy);
     }
-  else if (GDK_DEBUG_CHECK (CAIRO_IMAGE))
+  else if (GDK_DISPLAY_DEBUG_CHECK (window->display, CAIRO_IMAGE))
     {
       surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
                                             content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : 
CAIRO_FORMAT_ARGB32,
diff --git a/gdk/wayland/gdkclipboard-wayland.c b/gdk/wayland/gdkclipboard-wayland.c
index 585fb8e..97d0934 100644
--- a/gdk/wayland/gdkclipboard-wayland.c
+++ b/gdk/wayland/gdkclipboard-wayland.c
@@ -77,7 +77,7 @@ gdk_wayland_clipboard_data_source_target (void                  *data,
                                           struct wl_data_source *source,
                                           const char            *mime_type)
 {
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: Huh? data_source.target() events?\n", data));
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_printerr ("%p: Huh? 
data_source.target() events?\n", data));
 }
 
 static void
@@ -89,7 +89,7 @@ gdk_wayland_clipboard_write_done (GObject      *clipboard,
 
   if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error))
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%p: failed to write stream: %s\n", clipboard, error->message));
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), CLIPBOARD, g_printerr ("%p: 
failed to write stream: %s\n", clipboard, error->message));
       g_error_free (error);
     }
 }
@@ -103,7 +103,7 @@ gdk_wayland_clipboard_data_source_send (void                  *data,
   GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (data);
   GOutputStream *stream;
 
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: data source send request for %s on fd %d\n",
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_printerr ("%p: data 
source send request for %s on fd %d\n",
                                    source, mime_type, fd));
 
   mime_type = gdk_intern_mime_type (mime_type);
@@ -125,7 +125,7 @@ gdk_wayland_clipboard_data_source_cancelled (void                  *data,
 {
   GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (data);
 
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: data source cancelled\n", data));
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_printerr ("%p: data 
source cancelled\n", data));
 
   if (cb->source == source)
     {
@@ -138,14 +138,16 @@ static void
 gdk_wayland_clipboard_data_source_dnd_drop_performed (void                  *data,
                                                       struct wl_data_source *source)
 {
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: Huh? data_source.dnd_drop_performed() events?\n", data));
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)),
+            CLIPBOARD, g_printerr ("%p: Huh? data_source.dnd_drop_performed() events?\n", data));
 }
 
 static void
 gdk_wayland_clipboard_data_source_dnd_finished (void                  *data,
                                                struct wl_data_source *source)
 {
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: Huh? data_source.dnd_finished() events?\n", data));
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)),
+            CLIPBOARD, g_printerr ("%p: Huh? data_source.dnd_finished() events?\n", data));
 }
 
 static void
@@ -153,7 +155,8 @@ gdk_wayland_clipboard_data_source_action (void                  *data,
                                           struct wl_data_source *source,
                                           uint32_t               action)
 {
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: Huh? data_source.action() events?\n", data));
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)),
+            CLIPBOARD, g_printerr ("%p: Huh? data_source.action() events?\n", data));
 }
 
 static const struct wl_data_source_listener data_source_listener = {
@@ -218,7 +221,7 @@ 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_NOTE (CLIPBOARD, char *s = gdk_content_formats_to_string (formats);
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = 
gdk_content_formats_to_string (formats);
                        g_printerr ("%p: read for %s\n", cb, s);
                        g_free (s); );
   mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats);
@@ -302,14 +305,14 @@ gdk_wayland_clipboard_claim_remote (GdkWaylandClipboard  *cb,
 
   if (cb->source)
     {
-      GDK_NOTE (CLIPBOARD, g_printerr ("%p: Ignoring clipboard offer for self\n", cb));
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_printerr ("%p: Ignoring 
clipboard offer for self\n", cb));
       gdk_content_formats_unref (formats);
       return;
     }
 
   gdk_wayland_clipboard_discard_offer (cb);
 
-  GDK_NOTE (CLIPBOARD, char *s = gdk_content_formats_to_string (formats);
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = 
gdk_content_formats_to_string (formats);
                        g_printerr ("%p: remote clipboard claim for %s\n", cb, s);
                        g_free (s); );
   cb->offer_formats = formats;
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index b6a950d..55cfa89 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1062,7 +1062,7 @@ data_device_data_offer (void                  *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("data device data offer, data device %p, offer %p",
                        data_device, offer));
 
@@ -1086,7 +1086,7 @@ data_device_enter (void                  *data,
   if (!GDK_IS_WINDOW (dest_window))
     return;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, 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));
 
@@ -1118,7 +1118,7 @@ data_device_leave (void                  *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("data device leave, data device %p", data_device));
 
   if (!gdk_drag_context_get_dest_window (seat->drop_context))
@@ -1142,7 +1142,7 @@ data_device_motion (void                  *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, 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)));
 
@@ -1167,7 +1167,7 @@ data_device_drop (void                  *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("data device drop, data device %p", data_device));
 
   _gdk_wayland_drag_context_emit_event (seat->drop_context,
@@ -1392,7 +1392,7 @@ pointer_handle_enter (void              *data,
                    &event->crossing.x_root,
                    &event->crossing.y_root);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("enter, seat %p surface %p",
                        seat, seat->pointer_info.focus));
 
@@ -1440,7 +1440,7 @@ pointer_handle_leave (void              *data,
                    &event->crossing.x_root,
                    &event->crossing.y_root);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("leave, seat %p surface %p",
                        seat, seat->pointer_info.focus));
 
@@ -1487,7 +1487,7 @@ pointer_handle_motion (void              *data,
                    &event->motion.x_root,
                    &event->motion.y_root);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("motion %f %f, seat %p state %d",
                        wl_fixed_to_double (sx), wl_fixed_to_double (sy),
                       seat, event->motion.state));
@@ -1560,7 +1560,7 @@ pointer_handle_button (void              *data,
   else
     seat->pointer_info.button_modifiers &= ~modifier;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
            g_message ("button %d %s, seat %p state %d",
                       event->button.button,
                       state ? "press" : "release",
@@ -1618,7 +1618,7 @@ pointer_handle_axis (void              *data,
 
   seat->pointer_info.time = time;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("scroll, axis %s, value %f, seat %p",
                        get_axis_name (axis), wl_fixed_to_double (value) / 10.0,
                        seat));
@@ -1633,7 +1633,7 @@ pointer_handle_frame (void              *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("frame, seat %p", seat));
 
   gdk_wayland_seat_flush_frame_event (seat);
@@ -1674,7 +1674,7 @@ pointer_handle_axis_source (void                        *data,
 
   pointer_frame->source = source;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("axis source %s, seat %p", get_axis_source_name (source), seat));
 }
 
@@ -1706,7 +1706,7 @@ pointer_handle_axis_stop (void              *data,
 
   pointer_frame->is_scroll_stop = TRUE;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("axis %s stop, seat %p", get_axis_name (axis), seat));
 }
 
@@ -1734,7 +1734,7 @@ pointer_handle_axis_discrete (void              *data,
       g_return_if_reached ();
     }
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("discrete scroll, axis %s, value %d, seat %p",
                        get_axis_name (axis), value, seat));
 }
@@ -1790,7 +1790,7 @@ keyboard_handle_enter (void               *data,
   gdk_event_set_device (event, seat->master_keyboard);
   gdk_event_set_source_device (event, seat->keyboard);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("focus in, seat %p surface %p",
                        seat, seat->keyboard_focus));
 
@@ -1831,7 +1831,7 @@ keyboard_handle_leave (void               *data,
   seat->keyboard_focus = NULL;
   seat->repeat_key = 0;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("focus out, seat %p surface %p",
                        seat, seat->keyboard_focus));
 
@@ -2026,7 +2026,7 @@ deliver_key_event (GdkWaylandSeat *seat,
 
   _gdk_wayland_display_deliver_event (seat->display, event);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("keyboard %s event%s, code %d, sym %d, "
                        "string %s, mods 0x%x",
                        (state ? "press" : "release"),
@@ -2314,7 +2314,7 @@ touch_handle_down (void              *data,
       mimic_pointer_emulating_touch_info (seat->touch_master, touch);
     }
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("touch begin %f %f", event->touch.x, event->touch.y));
 
   _gdk_wayland_display_deliver_event (seat->display, event);
@@ -2337,7 +2337,7 @@ touch_handle_up (void            *data,
   touch = gdk_wayland_seat_get_touch (seat, id);
   event = _create_touch_event (seat, touch, GDK_TOUCH_END, time);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("touch end %f %f", event->touch.x, event->touch.y));
 
   _gdk_wayland_display_deliver_event (seat->display, event);
@@ -2369,7 +2369,7 @@ touch_handle_motion (void            *data,
 
   event = _create_touch_event (seat, touch, GDK_TOUCH_UPDATE, time);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("touch update %f %f", event->touch.x, event->touch.y));
 
   _gdk_wayland_display_deliver_event (seat->display, event);
@@ -2406,7 +2406,7 @@ touch_handle_cancel (void            *data,
       g_hash_table_iter_remove (&iter);
     }
 
-  GDK_NOTE (EVENTS, g_message ("touch cancel"));
+  GDK_DISPLAY_NOTE (wayland_seat->display, EVENTS, g_message ("touch cancel"));
 }
 
 static void
@@ -2442,7 +2442,7 @@ emit_gesture_swipe_event (GdkWaylandSeat          *seat,
                    &event->touchpad_swipe.x_root,
                    &event->touchpad_swipe.y_root);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("swipe event %d, coords: %f %f, seat %p state %d",
                        event->any.type, event->touchpad_swipe.x,
                        event->touchpad_swipe.y, seat,
@@ -2545,7 +2545,7 @@ emit_gesture_pinch_event (GdkWaylandSeat          *seat,
                    &event->touchpad_pinch.x_root,
                    &event->touchpad_pinch.y_root);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("pinch event %d, coords: %f %f, seat %p state %d",
                        event->any.type, event->touchpad_pinch.x,
                        event->touchpad_pinch.y, seat,
@@ -2869,7 +2869,7 @@ seat_handle_capabilities (void                    *data,
   GdkWaylandSeat *seat = data;
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
 
-  GDK_NOTE (MISC,
+  GDK_DISPLAY_NOTE (seat->display, MISC,
             g_message ("seat %p with %s%s%s", wl_seat,
                        (caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "",
                        (caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "",
@@ -3097,7 +3097,7 @@ seat_handle_name (void           *data,
                   const char     *name)
 {
   /* We don't care about the name. */
-  GDK_NOTE (MISC,
+  GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (data)->display, MISC,
             g_message ("seat %p name %s", seat, name));
 }
 
@@ -3402,7 +3402,7 @@ tablet_tool_handle_proximity_in (void                      *data,
   gdk_event_set_source_device (event, tablet->current_device);
   gdk_event_set_device_tool (event, tool->tool);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("proximity in, seat %p surface %p tool %d",
                        seat, tablet->pointer_info.focus,
                        gdk_device_tool_get_tool_type (tool->tool)));
@@ -3417,7 +3417,7 @@ tablet_tool_handle_proximity_out (void                      *data,
   GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
   GdkEvent *event;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("proximity out, seat %p, tool %d", seat,
                        gdk_device_tool_get_tool_type (tool->tool)));
 
@@ -3510,7 +3510,7 @@ 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_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet motion %f %f",
                        tablet->pointer_info.surface_x,
                        tablet->pointer_info.surface_y));
@@ -3544,7 +3544,7 @@ tablet_tool_handle_pressure (void                      *data,
   _gdk_device_translate_axis (tablet->current_device, axis_index,
                               pressure, &tablet->axes[axis_index]);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
             g_message ("tablet tool %d pressure %d",
                        gdk_device_tool_get_tool_type (tool->tool), pressure));
 }
@@ -3561,7 +3561,7 @@ tablet_tool_handle_distance (void                      *data,
   _gdk_device_translate_axis (tablet->current_device, axis_index,
                               distance, &tablet->axes[axis_index]);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
             g_message ("tablet tool %d distance %d",
                        gdk_device_tool_get_tool_type (tool->tool), distance));
 }
@@ -3584,7 +3584,7 @@ tablet_tool_handle_tilt (void                      *data,
                               wl_fixed_to_double (ytilt),
                               &tablet->axes[ytilt_axis_index]);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, 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)));
@@ -3637,7 +3637,7 @@ tablet_tool_handle_rotation (void                      *data,
                               wl_fixed_to_double (degrees),
                               &tablet->axes[axis_index]);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
             g_message ("tablet tool %d rotation %f",
                        gdk_device_tool_get_tool_type (tool->tool),
                        wl_fixed_to_double (degrees)));
@@ -3655,7 +3655,7 @@ tablet_tool_handle_slider (void                      *data,
   _gdk_device_translate_axis (tablet->current_device, axis_index,
                               position, &tablet->axes[axis_index]);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (GDK_WAYLAND_SEAT (tool->seat)->display, EVENTS,
             g_message ("tablet tool %d slider %d",
                        gdk_device_tool_get_tool_type (tool->tool), position));
 }
@@ -3671,7 +3671,7 @@ tablet_tool_handle_wheel (void                      *data,
   GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
   GdkEvent *event;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet tool %d wheel %d/%d",
                        gdk_device_tool_get_tool_type (tool->tool), degrees, clicks));
 
@@ -3701,9 +3701,10 @@ tablet_tool_handle_frame (void                      *data,
 {
   GdkWaylandTabletToolData *tool = data;
   GdkWaylandTabletData *tablet = tool->current_tablet;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
   GdkEvent *frame_event;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet frame, time %d", time));
 
   frame_event = tablet->pointer_info.frame.event;
@@ -3746,8 +3747,10 @@ tablet_pad_ring_handle_source (void                          *data,
                                uint32_t                       source)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad ring handle source, ring = %p source = %d",
                        wp_tablet_pad_ring, source));
 
@@ -3760,8 +3763,10 @@ tablet_pad_ring_handle_angle (void                          *data,
                               wl_fixed_t                     angle)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad ring handle angle, %s ring = %p angle = %f",
                        wp_tablet_pad_ring, wl_fixed_to_double (angle)));
 
@@ -3773,8 +3778,10 @@ tablet_pad_ring_handle_stop (void                          *data,
                              struct zwp_tablet_pad_ring_v2 *wp_tablet_pad_ring)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad ring handle stop, ring = %p", wp_tablet_pad_ring));
 
   group->axis_tmp_info.is_stop = TRUE;
@@ -3790,7 +3797,7 @@ tablet_pad_ring_handle_frame (void                          *data,
   GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
   GdkEvent *event;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
 
   event = gdk_event_new (GDK_PAD_RING);
@@ -3820,8 +3827,10 @@ tablet_pad_strip_handle_source (void                           *data,
                                 uint32_t                        source)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad strip handle source, strip = %p source = %d",
                        wp_tablet_pad_strip, source));
 
@@ -3834,8 +3843,10 @@ tablet_pad_strip_handle_position (void                           *data,
                                   uint32_t                        position)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad strip handle position, strip = %p position = %d",
                        wp_tablet_pad_strip, position));
 
@@ -3847,8 +3858,10 @@ tablet_pad_strip_handle_stop (void                           *data,
                               struct zwp_tablet_pad_strip_v2 *wp_tablet_pad_strip)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad strip handle stop, strip = %p",
                        wp_tablet_pad_strip));
 
@@ -3865,7 +3878,7 @@ tablet_pad_strip_handle_frame (void                           *data,
   GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
   GdkEvent *event;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad strip handle frame, strip = %p",
                        wp_tablet_pad_strip));
 
@@ -3897,9 +3910,11 @@ tablet_pad_group_handle_buttons (void                           *data,
                                  struct wl_array                *buttons)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
   uint32_t *p;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad group handle buttons, pad group = %p, n_buttons = %ld",
                        wp_tablet_pad_group, buttons->size));
 
@@ -3917,8 +3932,10 @@ tablet_pad_group_handle_ring (void                           *data,
                               struct zwp_tablet_pad_ring_v2  *wp_tablet_pad_ring)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad group handle ring, pad group = %p, ring = %p",
                        wp_tablet_pad_group, wp_tablet_pad_ring));
 
@@ -3936,8 +3953,10 @@ tablet_pad_group_handle_strip (void                           *data,
                                struct zwp_tablet_pad_strip_v2 *wp_tablet_pad_strip)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad group handle strip, pad group = %p, strip = %p",
                        wp_tablet_pad_group, wp_tablet_pad_strip));
 
@@ -3955,8 +3974,10 @@ tablet_pad_group_handle_modes (void                           *data,
                                uint32_t                        modes)
 {
   GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad group handle modes, pad group = %p, n_modes = %d",
                        wp_tablet_pad_group, modes));
 
@@ -3967,7 +3988,11 @@ static void
 tablet_pad_group_handle_done (void                           *data,
                               struct zwp_tablet_pad_group_v2 *wp_tablet_pad_group)
 {
-  GDK_NOTE (EVENTS,
+  GdkWaylandTabletPadGroupData *group = data;
+  GdkWaylandTabletPadData *pad = group->pad;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
+
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad group handle done, pad group = %p",
                        wp_tablet_pad_group));
 }
@@ -3985,7 +4010,7 @@ tablet_pad_group_handle_mode (void                           *data,
   GdkEvent *event;
   guint n_group;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad group handle mode, pad group = %p, mode = %d",
                        wp_tablet_pad_group, mode));
 
@@ -4021,8 +4046,9 @@ tablet_pad_handle_group (void                           *data,
 {
   GdkWaylandTabletPadData *pad = data;
   GdkWaylandTabletPadGroupData *group;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle group, pad group = %p, group = %p",
                        wp_tablet_pad_group, wp_tablet_pad_group));
 
@@ -4042,8 +4068,9 @@ tablet_pad_handle_path (void                     *data,
                         const char               *path)
 {
   GdkWaylandTabletPadData *pad = data;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle path, pad = %p, path = %s",
                        wp_tablet_pad, path));
 
@@ -4056,8 +4083,9 @@ tablet_pad_handle_buttons (void                     *data,
                            uint32_t                  buttons)
 {
   GdkWaylandTabletPadData *pad = data;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle buttons, pad = %p, n_buttons = %d",
                        wp_tablet_pad, buttons));
 
@@ -4071,7 +4099,7 @@ tablet_pad_handle_done (void                     *data,
   GdkWaylandTabletPadData *pad = data;
   GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle done, pad = %p", wp_tablet_pad));
 
   pad->device =
@@ -4101,7 +4129,7 @@ tablet_pad_handle_button (void                     *data,
   GdkEvent *event;
   gint n_group;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle button, pad = %p, button = %d, state = %d",
                        wp_tablet_pad, button, state));
 
@@ -4131,9 +4159,10 @@ tablet_pad_handle_enter (void                     *data,
                          struct wl_surface        *surface)
 {
   GdkWaylandTabletPadData *pad = data;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
   GdkWaylandTabletData *tablet = zwp_tablet_v2_get_user_data (wp_tablet);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle enter, pad = %p, tablet = %p surface = %p",
                        wp_tablet_pad, wp_tablet, surface));
 
@@ -4149,8 +4178,9 @@ tablet_pad_handle_leave (void                     *data,
                          struct wl_surface        *surface)
 {
   GdkWaylandTabletPadData *pad = data;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle leave, pad = %p, surface = %p",
                        wp_tablet_pad, surface));
 
@@ -4166,8 +4196,9 @@ tablet_pad_handle_removed (void                     *data,
                            struct zwp_tablet_pad_v2 *wp_tablet_pad)
 {
   GdkWaylandTabletPadData *pad = data;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("tablet pad handle removed, pad = %p", wp_tablet_pad));
 
   /* Remove from the current tablet */
@@ -4326,7 +4357,7 @@ pointer_surface_enter (void              *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("pointer surface of seat %p entered output %p",
                        seat, output));
 
@@ -4343,7 +4374,7 @@ pointer_surface_leave (void              *data,
 {
   GdkWaylandSeat *seat = data;
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (seat->display, EVENTS,
             g_message ("pointer surface of seat %p left output %p",
                        seat, output));
 
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 85cecc0..582d74d 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -133,7 +133,7 @@ xdg_shell_ping (void                 *data,
 
   _gdk_wayland_display_update_serial (display_wayland, serial);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (GDK_DISPLAY (data), EVENTS,
             g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
 
   zxdg_shell_v6_pong (xdg_shell, serial);
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 95bd8e2..dc7055a 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -335,7 +335,7 @@ gdk_wayland_drag_context_read_async (GdkDragContext      *context,
   g_task_set_priority (task, io_priority);
   g_task_set_source_tag (task, gdk_wayland_drag_context_read_async);
 
-  GDK_NOTE (DND, char *s = gdk_content_formats_to_string (formats);
+  GDK_DISPLAY_NOTE (display, DND, char *s = gdk_content_formats_to_string (formats);
                  g_printerr ("%p: read for %s\n", context, s);
                  g_free (s); );
   dnd_formats = gdk_wayland_selection_get_targets (display);
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index a2aecda..14cece9 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -56,9 +56,9 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
   gdk_gl_context_get_required_version (context, &major, &minor);
   debug_bit = gdk_gl_context_get_debug_enabled (context);
   forward_bit = gdk_gl_context_get_forward_compatible (context);
-  legacy_bit = GDK_DEBUG_CHECK (GL_LEGACY) ||
+  legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
                (share != NULL && gdk_gl_context_is_legacy (share));
-  use_es = GDK_DEBUG_CHECK (GL_GLES) ||
+  use_es = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
            (share != NULL && gdk_gl_context_get_use_es (share));
 
   flags = 0;
@@ -102,7 +102,8 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
   context_attribs[i++] = EGL_NONE;
   g_assert (i < N_EGL_ATTRS);
 
-  GDK_NOTE (OPENGL, g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
+  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",
@@ -129,7 +130,8 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
       legacy_bit = TRUE;
       use_es = FALSE;
 
-      GDK_NOTE (OPENGL, g_message ("eglCreateContext failed, switching to legacy"));
+      GDK_DISPLAY_NOTE (display, OPENGL,
+                g_message ("eglCreateContext failed, switching to legacy"));
       ctx = eglCreateContext (display_wayland->egl_display,
                               context_wayland->egl_config,
                               share != NULL ? GDK_WAYLAND_GL_CONTEXT (share)->egl_context
@@ -145,7 +147,7 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
       return FALSE;
     }
 
-  GDK_NOTE (OPENGL, g_message ("Created EGL context[%p]", ctx));
+  GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
 
   context_wayland->egl_context = ctx;
 
@@ -338,7 +340,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display)
   display_wayland->have_egl_surfaceless_context =
     epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context");
 
-  GDK_NOTE (OPENGL,
+  GDK_DISPLAY_NOTE (display, OPENGL,
             g_message ("EGL API version %d.%d found\n"
                        " - Vendor: %s\n"
                        " - Version: %s\n"
@@ -472,7 +474,7 @@ gdk_wayland_gl_context_dispose (GObject *gobject)
         eglMakeCurrent(display_wayland->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                        EGL_NO_CONTEXT);
 
-      GDK_NOTE (OPENGL, g_message ("Destroying EGL context"));
+      GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying EGL context"));
 
       eglDestroyContext (display_wayland->egl_display,
                          context_wayland->egl_context);
diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index fd95b27..da23fca 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -625,7 +625,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
       return;
     }
 
-  GDK_NOTE(INPUT, g_print ("keymap:\n%s\n", map_str));
+  GDK_DISPLAY_NOTE (keymap->display, INPUT, g_print ("keymap:\n%s\n", map_str));
 
   xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0);
   munmap (map_str, size);
@@ -638,7 +638,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
       return;
     }
 
-  GDK_NOTE(INPUT, print_modifiers (xkb_keymap));
+  GDK_DISPLAY_NOTE (keymap->display, INPUT, print_modifiers (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 b29a033..8558bba 100644
--- a/gdk/wayland/gdkprimary-wayland.c
+++ b/gdk/wayland/gdkprimary-wayland.c
@@ -99,14 +99,14 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary                  *cb,
 
   if (cb->source)
     {
-      GDK_NOTE (CLIPBOARD, g_printerr ("%p: Ignoring clipboard offer for self\n", cb));
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_printerr ("%p: Ignoring 
clipboard offer for self\n", cb));
       gdk_content_formats_unref (formats);
       return;
     }
 
   gdk_wayland_primary_discard_offer (cb);
 
-  GDK_NOTE (CLIPBOARD, char *s = gdk_content_formats_to_string (formats);
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, char *s = 
gdk_content_formats_to_string (formats);
                        g_printerr ("%p: remote clipboard claim for %s\n", cb, s);
                        g_free (s); );
   cb->offer_formats = formats;
@@ -125,7 +125,7 @@ primary_offer_offer (void                               *data,
 
   if (cb->pending != offer)
     {
-      GDK_NOTE (SELECTION, g_printerr ("%p: offer for unknown selection %p of %s\n",
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_printerr ("%p: offer 
for unknown selection %p of %s\n",
                                        cb, offer, type));
       return;
     }
@@ -144,7 +144,7 @@ primary_selection_data_offer (void                                *data,
 {
   GdkWaylandPrimary *cb = data;
 
-  GDK_NOTE (SELECTION, g_printerr ("%p: new primary offer %p\n",
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_printerr ("%p: new primary 
offer %p\n",
                                    cb, offer));
 
   gdk_wayland_primary_discard_pending (cb);
@@ -173,7 +173,7 @@ primary_selection_selection (void                                *data,
 
   if (cb->pending != offer)
     {
-      GDK_NOTE (SELECTION, g_printerr ("%p: ignoring unknown data offer %p\n",
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), SELECTION, g_printerr ("%p: ignoring 
unknown data offer %p\n",
                                        cb, offer));
       return;
     }
@@ -199,7 +199,7 @@ gdk_wayland_primary_write_done (GObject      *clipboard,
 
   if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error))
     {
-      GDK_NOTE (SELECTION, g_printerr ("%p: failed to write stream: %s\n", clipboard, error->message));
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard)), SELECTION, g_printerr ("%p: 
failed to write stream: %s\n", clipboard, error->message));
       g_error_free (error);
     }
 }
@@ -213,7 +213,7 @@ gdk_wayland_primary_data_source_send (void                                *data,
   GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (data);
   GOutputStream *stream;
 
-  GDK_NOTE (SELECTION, g_printerr ("%p: data source send request for %s on fd %d\n",
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), SELECTION, g_printerr ("%p: data 
source send request for %s on fd %d\n",
                                    source, mime_type, fd));
 
   mime_type = gdk_intern_mime_type (mime_type);
@@ -235,7 +235,7 @@ gdk_wayland_primary_data_source_cancelled (void                                *
 {
   GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (data);
 
-  GDK_NOTE (CLIPBOARD, g_printerr ("%p: data source cancelled\n", data));
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (data)), CLIPBOARD, g_printerr ("%p: data 
source cancelled\n", data));
 
   if (cb->source == source)
     {
@@ -302,7 +302,7 @@ 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_NOTE (CLIPBOARD, char *s = gdk_content_formats_to_string (formats);
+  GDK_DISPLAY_NOTE (gdk_clipboard_get_display (clipboard), CLIPBOARD, char *s = 
gdk_content_formats_to_string (formats);
                        g_printerr ("%p: read for %s\n", cb, s);
                        g_free (s); );
   mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats);
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index e89102d..c5220af 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -159,7 +159,7 @@ data_offer_source_actions (void                 *data,
 
   drop_context->actions = _wl_to_gdk_actions (source_actions);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (display, EVENTS,
             g_message ("data offer source actions, offer %p, actions %d", wl_data_offer, source_actions));
 
   if (gdk_drag_context_get_dest_window (drop_context))
@@ -311,7 +311,7 @@ gdk_wayland_drag_context_write_done (GObject      *context,
 
   if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (context), result, &error))
     {
-      GDK_NOTE(DND, g_printerr ("%p: failed to write stream: %s\n", context, error->message));
+      GDK_DISPLAY_NOTE (gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context)), DND, g_printerr ("%p: 
failed to write stream: %s\n", context, error->message));
       g_error_free (error);
     }
 }
@@ -329,7 +329,7 @@ data_source_send (void                  *data,
   if (!context)
     return;
 
-  GDK_NOTE (DND, g_printerr ("%p: data source send request for %s on fd %d\n",
+  GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_printerr ("%p: data source send request 
for %s on fd %d\n",
                              source, mime_type, fd));
 
   //mime_type = gdk_intern_mime_type (mime_type);
@@ -354,11 +354,11 @@ data_source_cancelled (void                  *data,
   GdkDragContext *context;
   GdkDisplay *display;
 
-  GDK_NOTE (EVENTS,
-            g_message ("data source cancelled, source = %p", source));
-
   display = gdk_display_get_default ();
 
+  GDK_DISPLAY_NOTE (display, EVENTS,
+            g_message ("data source cancelled, source = %p", source));
+
   if (source != wayland_selection->dnd_source)
     return;
 
@@ -405,15 +405,14 @@ data_source_action (void                  *data,
 {
   GdkDragContext *context;
 
-  GDK_NOTE (EVENTS,
-            g_message ("data source action, source = %p action=%x",
-                       source, action));
-
   context = gdk_wayland_drag_context_lookup_by_data_source (source);
-
   if (!context)
     return;
 
+  GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
+            g_message ("data source action, source = %p action=%x",
+                       source, action));
+
   context->action = _wl_to_gdk_actions (action);
   g_signal_emit_by_name (context, "action-changed", context->action);
 }
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index e02bac8..f5611f0 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -444,8 +444,7 @@ frame_callback (void               *data,
   GdkFrameClock *clock = gdk_window_get_frame_clock (window);
   GdkFrameTimings *timings;
 
-  GDK_NOTE (EVENTS,
-            g_message ("frame %p", window));
+  GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), EVENTS, g_message ("frame %p", window));
 
   wl_callback_destroy (callback);
 
@@ -1212,7 +1211,7 @@ surface_enter (void              *data,
   GdkWindow *window = GDK_WINDOW (data);
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS,
             g_message ("surface enter, window %p output %p", window, output));
 
   impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
@@ -1228,7 +1227,7 @@ surface_leave (void              *data,
   GdkWindow *window = GDK_WINDOW (data);
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS,
             g_message ("surface leave, window %p output %p", window, output));
 
   impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output);
@@ -1377,7 +1376,7 @@ xdg_surface_configure (void                   *data,
       gdk_wayland_window_configure (window, width, height, impl->scale);
     }
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS,
             g_message ("configure, window %p %dx%d,%s%s%s%s",
                        window, width, height,
                        (new_state & GDK_WINDOW_STATE_FULLSCREEN) ? " fullscreen" : "",
@@ -1441,14 +1440,14 @@ xdg_toplevel_close (void                    *data,
   GdkDisplay *display;
   GdkEvent *event;
 
-  GDK_NOTE (EVENTS,
-            g_message ("close %p", window));
+  display = gdk_window_get_display (window);
+
+  GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", window));
 
   event = gdk_event_new (GDK_DELETE);
   event->any.window = g_object_ref (window);
   event->any.send_event = TRUE;
 
-  display = gdk_window_get_display (window);
   _gdk_wayland_display_deliver_event (display, event);
 }
 
@@ -1546,8 +1545,7 @@ xdg_popup_done (void                 *data,
 {
   GdkWindow *window = GDK_WINDOW (data);
 
-  GDK_NOTE (EVENTS,
-            g_message ("done %p", window));
+  GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS, g_message ("done %p", window));
 
   gdk_window_hide (window);
 }
diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c
index 38151ae..02a0b4e 100644
--- a/gdk/x11/gdkclipboard-x11.c
+++ b/gdk/x11/gdkclipboard-x11.c
@@ -64,17 +64,16 @@ print_atoms (GdkX11Clipboard *cb,
              const Atom      *atoms,
              gsize            n_atoms)
 {
-  GDK_NOTE(CLIPBOARD,
-           GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
-           gsize i;
-            
-           g_printerr ("%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");
-          ); 
+  GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
+
+  GDK_DISPLAY_NOTE (display, CLIPBOARD,
+      gsize i;
+
+      g_printerr ("%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");
+  );
 }
 
 static void
@@ -86,7 +85,11 @@ gdk_x11_clipboard_default_output_done (GObject      *clipboard,
 
   if (!gdk_clipboard_write_finish (GDK_CLIPBOARD (clipboard), result, &error))
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: failed to write stream: %s\n", GDK_X11_CLIPBOARD 
(clipboard)->selection, error->message));
+      GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (clipboard));
+
+      GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                g_printerr ("%s: failed to write stream: %s\n",
+                            GDK_X11_CLIPBOARD (clipboard)->selection, error->message));
       g_error_free (error);
     }
 }
@@ -258,7 +261,9 @@ gdk_x11_clipboard_request_targets_finish (GObject      *source_object,
   bytes = g_input_stream_read_bytes_finish (stream, res, &error);
   if (bytes == NULL)
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: error reading TARGETS: %s\n", cb->selection, error->message));
+      GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                g_printerr ("%s: error reading TARGETS: %s\n", cb->selection, error->message));
       g_error_free (error);
       g_object_unref (stream);
       g_object_unref (cb);
@@ -290,7 +295,7 @@ 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_NOTE(CLIPBOARD, char *s = gdk_content_formats_to_string (formats); g_printerr ("%s: got formats: 
%s\n", cb->selection, s); g_free (s));
+  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));
 
   /* union with previously loaded formats */
   formats = gdk_content_formats_union (formats, gdk_clipboard_get_formats (GDK_CLIPBOARD (cb)));
@@ -318,17 +323,18 @@ gdk_x11_clipboard_request_targets_got_stream (GObject      *source,
   const char *type;
   int format;
 
+  display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
   stream = gdk_x11_selection_input_stream_new_finish (result, &type, &format, &error);
   if (stream == NULL)
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: can't request TARGETS: %s\n", cb->selection, error->message));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: can't request TARGETS: %s\n", cb->selection, 
error->message));
       g_object_unref (cb);
       g_error_free (error);
       return;
     }
   else if (!g_str_equal (type, "ATOM") || format != 32)
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or format %d != 
32\n",
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: Wrong reply type to TARGETS: type %s != ATOM or 
format %d != 32\n",
                                       cb->selection, type, format));
       g_input_stream_close (stream, NULL, NULL);
       g_object_unref (stream);
@@ -336,8 +342,6 @@ gdk_x11_clipboard_request_targets_got_stream (GObject      *source,
       return;
     }
 
-  display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
-
   g_input_stream_read_bytes_async (stream,
                                    gdk_x11_display_get_max_request_size (display),
                                    G_PRIORITY_DEFAULT,
@@ -393,12 +397,13 @@ gdk_x11_clipboard_xevent (GdkDisplay   *display,
 
       if (xevent->xselectionclear.time < cb->timestamp)
         {
-          GDK_NOTE(CLIPBOARD, g_printerr ("%s: ignoring SelectionClear with too old timestamp (%lu vs 
%lu)\n",
-                                          cb->selection, 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));
           return FALSE;
         }
 
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: got SelectionClear\n", cb->selection));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: got SelectionClear\n", cb->selection));
       gdk_x11_clipboard_claim_remote (cb, xevent->xselectionclear.time);
       return TRUE;
 
@@ -415,13 +420,13 @@ gdk_x11_clipboard_xevent (GdkDisplay   *display,
       /* We already received a selectionNotify before */
       if (cb->store_task == NULL)
         {
-          GDK_NOTE(CLIPBOARD, g_printerr ("%s: got SelectionNotify for nonexisting task?!\n",
-                                          cb->selection));
+          GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                    g_printerr ("%s: got SelectionNotify for nonexisting task?!\n", cb->selection));
           return FALSE;
         }
 
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: got SelectionNotify for store task\n",
-                                      cb->selection));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                g_printerr ("%s: got SelectionNotify for store task\n", cb->selection));
 
       if (xevent->xselection.property != None)
         g_task_return_boolean (cb->store_task, TRUE);
@@ -447,19 +452,21 @@ gdk_x11_clipboard_xevent (GdkDisplay   *display,
 
         if (!gdk_clipboard_is_local (GDK_CLIPBOARD (cb)))
           {
-            GDK_NOTE(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_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));
             return TRUE;
           }
         if (xevent->xselectionrequest.requestor == None)
           {
-            GDK_NOTE(CLIPBOARD, g_printerr ("%s: got SelectionRequest for %s @ %s with NULL window, 
ignoring\n",
-                                            cb->selection, target, property));
+            GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                      g_printerr ("%s: got SelectionRequest for %s @ %s with NULL window, ignoring\n",
+                                  cb->selection, target, property));
             return TRUE;
           }
         
-        GDK_NOTE(CLIPBOARD, g_printerr ("%s: got SelectionRequest for %s @ %s\n",
-                                        cb->selection, target, property));
+        GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                  g_printerr ("%s: got SelectionRequest for %s @ %s\n", cb->selection, target, property));
 
         gdk_x11_selection_output_streams_create (display,
                                                  gdk_clipboard_get_formats (GDK_CLIPBOARD (cb)),
@@ -485,13 +492,13 @@ gdk_x11_clipboard_xevent (GdkDisplay   *display,
 
           if (sn->owner == GDK_X11_DISPLAY (display)->leader_window)
             {
-              GDK_NOTE(CLIPBOARD, g_printerr ("%s: Ignoring XFixesSelectionNotify for ourselves\n",
-                                              cb->selection));
+              GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                        g_printerr ("%s: Ignoring XFixesSelectionNotify for ourselves\n", cb->selection));
               return FALSE;
             }
 
-          GDK_NOTE(CLIPBOARD, g_printerr ("%s: Received XFixesSelectionNotify, claiming selection\n",
-                                          cb->selection));
+          GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                    g_printerr ("%s: Received XFixesSelectionNotify, claiming selection\n", cb->selection));
 
           gdk_x11_clipboard_claim_remote (cb, sn->selection_timestamp);
         }
@@ -535,7 +542,7 @@ gdk_x11_clipboard_claim (GdkClipboard       *clipboard,
 
           if (XGetSelectionOwner (xdisplay, cb->xselection) != xwindow)
             {
-              GDK_NOTE(CLIPBOARD, g_printerr ("%s: failed XSetSelectionOwner()\n", cb->selection));
+              GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: failed XSetSelectionOwner()\n", 
cb->selection));
               return FALSE;
             }
         }
@@ -545,7 +552,7 @@ gdk_x11_clipboard_claim (GdkClipboard       *clipboard,
         }
 
       cb->timestamp = time;
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: claimed via XSetSelectionOwner()\n", cb->selection));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: claimed via XSetSelectionOwner()\n", 
cb->selection));
     }
 
   return GDK_CLIPBOARD_CLASS (gdk_x11_clipboard_parent_class)->claim (clipboard, formats, local, content);
@@ -571,8 +578,7 @@ gdk_x11_clipboard_store_async (GdkClipboard        *clipboard,
   /* clipboard managers don't work on anythig but the clipbpoard selection */
   if (!g_str_equal (cb->selection, "CLIPBOARD"))
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: can only store on CLIPBOARD\n",
-                                      cb->selection));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: can only store on CLIPBOARD\n", cb->selection));
       GDK_CLIPBOARD_CLASS (gdk_x11_clipboard_parent_class)->store_async (clipboard,
                                                                          io_priority,
                                                                          cancellable,
@@ -590,8 +596,9 @@ gdk_x11_clipboard_store_async (GdkClipboard        *clipboard,
 
   if (XGetSelectionOwner (xdisplay, clipboard_manager) == None)
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: XGetSelectionOwner (CLIPBOARD_MANAGER) returned None, 
aborting.\n",
-                                      cb->selection));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                g_printerr ("%s: XGetSelectionOwner (CLIPBOARD_MANAGER) returned None, aborting.\n",
+                            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);
@@ -601,8 +608,7 @@ gdk_x11_clipboard_store_async (GdkClipboard        *clipboard,
   content = gdk_clipboard_get_content (clipboard);
   if (content == NULL)
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: storing empty clipboard: SUCCESS!\n",
-                                      cb->selection));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: storing empty clipboard: SUCCESS!\n", 
cb->selection));
       g_task_return_boolean (cb->store_task, TRUE);
       g_clear_object (&cb->store_task);
       return;
@@ -634,8 +640,8 @@ gdk_x11_clipboard_store_async (GdkClipboard        *clipboard,
   error = gdk_x11_display_error_trap_pop (display);
   if (error != Success)
     {
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: X error during ConvertSelection() while storing selection: %d\n",
-                                      cb->selection, error));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD,
+                g_printerr ("%s: X error during ConvertSelection() while storing selection: %d\n", 
cb->selection, error));
     }
 }
 
@@ -672,8 +678,9 @@ gdk_x11_clipboard_read_got_stream (GObject      *source,
         {
           GdkX11Clipboard *cb = GDK_X11_CLIPBOARD (g_task_get_source_object (task));
 
-          GDK_NOTE(CLIPBOARD, g_printerr ("%s: reading %s failed, trying %s next\n",
-                                          cb->selection, (char *) targets->data, (char *) next->data));
+          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));
           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)),
@@ -702,8 +709,9 @@ gdk_x11_clipboard_read_got_stream (GObject      *source,
             {
               g_assert (special_targets[i].mime_type != NULL);
 
-              GDK_NOTE(CLIPBOARD, g_printerr ("%s: reading with converter from %s to %s\n",
-                                              cb->selection, mime_type, special_targets[i].mime_type));
+              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));
               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);
@@ -711,8 +719,8 @@ gdk_x11_clipboard_read_got_stream (GObject      *source,
             }
         }
 
-      GDK_NOTE(CLIPBOARD, g_printerr ("%s: reading clipboard as %s now\n",
-                                      cb->selection, mime_type));
+      GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD,
+                g_printerr ("%s: reading clipboard as %s now\n", cb->selection, mime_type));
       g_task_return_pointer (task, stream, g_object_unref);
     }
 
@@ -744,8 +752,9 @@ gdk_x11_clipboard_read_async (GdkClipboard        *clipboard,
       return;
     }
 
-  GDK_NOTE(CLIPBOARD, g_printerr ("%s: new read for %s (%u other options)\n",
-                                  cb->selection, (char *) targets->data, g_slist_length (targets->next)));
+  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_x11_selection_input_stream_new_async (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)),
                                             cb->selection,
                                             targets->data,
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index cbc1a5c..c02299c 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -353,7 +353,7 @@ gdk_x11_device_core_grab (GdkDevice    *device,
     xconfine_to = GDK_WINDOW_XID (confine_to);
 
 #ifdef G_ENABLE_DEBUG
-  if (GDK_DEBUG_CHECK (NOGRABS))
+  if (GDK_DISPLAY_DEBUG_CHECK (display, NOGRABS))
     status = GrabSuccess;
   else
 #endif
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 169ea16..8da6ef5 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -451,19 +451,19 @@ gdk_x11_device_xi2_grab (GdkDevice    *device,
                                                         event_mask,
                                                         &mask.mask_len);
 
-#ifdef G_ENABLE_DEBUG
-  if (GDK_DEBUG_CHECK (NOGRABS))
+#if G_ENABLE_DEBUG
+  if (GDK_DISPLAY_DEBUG_CHECK (display, NOGRABS))
     status = GrabSuccess;
   else
 #endif
-  status = XIGrabDevice (GDK_DISPLAY_XDISPLAY (display),
-                         device_xi2->device_id,
-                         xwindow,
-                         time_,
-                         xcursor,
-                         GrabModeAsync, GrabModeAsync,
-                         owner_events,
-                         &mask);
+    status = XIGrabDevice (GDK_DISPLAY_XDISPLAY (display),
+                           device_xi2->device_id,
+                           xwindow,
+                           time_,
+                           xcursor,
+                           GrabModeAsync, GrabModeAsync,
+                           owner_events,
+                           &mask);
 
   g_free (mask.mask);
 
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index e151890..3062902 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -223,7 +223,7 @@ translate_key_event (GdkDisplay              *display,
   _gdk_x11_event_translate_keyboard_string (&event->key);
 
 #ifdef G_ENABLE_DEBUG
-  if (GDK_DEBUG_CHECK (EVENTS))
+  if (GDK_DISPLAY_DEBUG_CHECK (display, EVENTS))
     {
       g_message ("%s:\t\twindow: %ld     key: %12s  %d",
                  event->any.type == GDK_KEY_PRESS ? "key press  " : "key release",
@@ -467,7 +467,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
       break;
 
     case ButtonPress:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                 g_message ("button press:\t\twindow: %ld  x,y: %d %d  button: %d",
                            xevent->xbutton.window,
                            xevent->xbutton.x, xevent->xbutton.y,
@@ -537,7 +537,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
       break;
 
     case ButtonRelease:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                 g_message ("button release:\twindow: %ld  x,y: %d %d  button: %d",
                            xevent->xbutton.window,
                            xevent->xbutton.x, xevent->xbutton.y,
@@ -574,7 +574,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
       break;
 
     case MotionNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                 g_message ("motion notify:\t\twindow: %ld  x,y: %d %d  hint: %s",
                            xevent->xmotion.window,
                            xevent->xmotion.x, xevent->xmotion.y,
@@ -603,7 +603,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
       break;
 
     case EnterNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                 g_message ("enter notify:\t\twindow: %ld  detail: %d subwin: %ld",
                            xevent->xcrossing.window,
                            xevent->xcrossing.detail,
@@ -644,7 +644,7 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
       break;
 
     case LeaveNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                 g_message ("leave notify:\t\twindow: %ld  detail: %d subwin: %ld",
                            xevent->xcrossing.window,
                            xevent->xcrossing.detail, xevent->xcrossing.subwindow));
@@ -808,7 +808,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
   g_return_if_fail (GDK_IS_DEVICE (device));
   g_return_if_fail (source_device == NULL || GDK_IS_DEVICE (source_device));
 
-  GDK_NOTE (EVENTS,
+  GDK_DISPLAY_NOTE (gdk_window_get_display (window), EVENTS,
             g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s",
                        GDK_WINDOW_XID (window),
                        notify_details[detail],
diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c
index ecc8ef8..d5ef24b 100644
--- a/gdk/x11/gdkdevicemanager-x11.c
+++ b/gdk/x11/gdkdevicemanager-x11.c
@@ -57,7 +57,7 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
             {
               GdkX11DeviceManagerXI2 *device_manager_xi2;
 
-              GDK_NOTE (INPUT, g_message ("Creating XI2 device manager"));
+              GDK_DISPLAY_NOTE (display, INPUT, g_message ("Creating XI2 device manager"));
 
               device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2,
                                                  "display", display,
@@ -72,7 +72,7 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
 #endif /* XINPUT_2 */
     }
 
-  GDK_NOTE (INPUT, g_message ("Creating core device manager"));
+  GDK_DISPLAY_NOTE (display, INPUT, g_message ("Creating core device manager"));
 
   return g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_CORE,
                        "display", display,
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 851c52f..bd8fe7d 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -193,7 +193,7 @@ translate_valuator_class (GdkDisplay          *display,
     label = NULL;
 
   _gdk_device_add_axis (device, label, use, min, max, resolution);
-  GDK_NOTE (INPUT, g_message ("\n\taxis: %s %s", (const char *)label, use == GDK_AXIS_IGNORE ? "(ignored)" : 
"(used)"));
+  GDK_DISPLAY_NOTE (display, INPUT, g_message ("\n\taxis: %s %s", (const char *)label, use == 
GDK_AXIS_IGNORE ? "(ignored)" : "(used)"));
 }
 
 static void
@@ -244,7 +244,7 @@ translate_device_classes (GdkDisplay      *display,
             else
               direction = GDK_SCROLL_RIGHT;
 
-            GDK_NOTE (INPUT,
+            GDK_DISPLAY_NOTE (display, INPUT,
                       g_message ("\n\tscroll valuator %d: %s, increment %f",
                                  scroll_info->number,
                                  scroll_info->scroll_type == XIScrollTypeVertical
@@ -471,7 +471,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
       break;
     }
 
-  GDK_NOTE (INPUT,
+  GDK_DISPLAY_NOTE (display, INPUT,
             ({
               const gchar *type_names[] = { "master", "slave", "floating" };
               const gchar *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct 
touch", "indirect touch", "trackpoint", "pad" };
@@ -1410,7 +1410,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         GdkKeymap *keymap = gdk_display_get_keymap (display);
         GdkModifierType consumed, state;
 
-        GDK_NOTE (EVENTS,
+        GDK_DISPLAY_NOTE (display, EVENTS,
                   g_message ("key %s:\twindow %ld\n"
                              "\tdevice:%u\n"
                              "\tsource device:%u\n"
@@ -1470,7 +1470,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
       {
         XIDeviceEvent *xev = (XIDeviceEvent *) ev;
 
-        GDK_NOTE (EVENTS,
+        GDK_DISPLAY_NOTE (display, EVENTS,
                   g_message ("button %s:\twindow %ld\n"
                              "\tdevice:%u\n"
                              "\tsource device:%u\n"
@@ -1607,7 +1607,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             if (delta_x == 0.0 && delta_y == 0.0)
               event->scroll.is_stop = TRUE;
 
-            GDK_NOTE(EVENTS,
+            GDK_DISPLAY_NOTE (display, EVENTS,
                      g_message ("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));
@@ -1667,7 +1667,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
       {
         XIDeviceEvent *xev = (XIDeviceEvent *) ev;
 
-        GDK_NOTE(EVENTS,
+        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,
@@ -1734,7 +1734,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
       {
         XIDeviceEvent *xev = (XIDeviceEvent *) ev;
 
-        GDK_NOTE(EVENTS,
+        GDK_DISPLAY_NOTE (display, EVENTS,
                  g_message ("touch update:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %s",
                             xev->event,
                             xev->detail,
@@ -1788,7 +1788,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
       {
         XIEnterEvent *xev = (XIEnterEvent *) ev;
 
-        GDK_NOTE (EVENTS,
+        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",
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 8fc1688..edf18ab 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -703,15 +703,14 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
   switch (xevent->type)
     {
     case KeymapNotify:
-      GDK_NOTE (EVENTS,
-               g_message ("keymap notify"));
+      GDK_DISPLAY_NOTE (display, EVENTS, g_message ("keymap notify"));
 
       /* Not currently handled */
       return_val = FALSE;
       break;
 
     case Expose:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("expose:\t\twindow: %ld  %d  x,y: %d %d  w,h: %d %d%s",
                           xevent->xexpose.window, xevent->xexpose.count,
                           xevent->xexpose.x, xevent->xexpose.y,
@@ -748,7 +747,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
        GdkRectangle expose_rect;
         int x2, y2;
 
-        GDK_NOTE (EVENTS,
+        GDK_DISPLAY_NOTE (display, EVENTS,
                  g_message ("graphics expose:\tdrawable: %ld",
                             xevent->xgraphicsexpose.drawable));
 
@@ -774,7 +773,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
 
     case VisibilityNotify:
 #ifdef G_ENABLE_DEBUG
-      if (GDK_DEBUG_CHECK (EVENTS))
+      if (GDK_DISPLAY_DEBUG_CHECK (display, EVENTS))
        switch (xevent->xvisibility.state)
          {
          case VisibilityFullyObscured:
@@ -798,7 +797,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case CreateNotify:
-      GDK_NOTE (EVENTS,
+      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,
@@ -812,7 +811,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case DestroyNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("destroy notify:\twindow: %ld",
                           xevent->xdestroywindow.window));
 
@@ -832,7 +831,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case UnmapNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("unmap notify:\t\twindow: %ld",
                           xevent->xmap.window));
 
@@ -876,7 +875,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case MapNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("map notify:\t\twindow: %ld",
                           xevent->xmap.window));
 
@@ -898,7 +897,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case ReparentNotify:
-      GDK_NOTE (EVENTS,
+      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,
@@ -911,7 +910,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case ConfigureNotify:
-      GDK_NOTE (EVENTS,
+      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,
@@ -1008,7 +1007,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case PropertyNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s",
                           xevent->xproperty.window,
                           xevent->xproperty.atom,
@@ -1042,7 +1041,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case ColormapNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("colormap notify:\twindow: %ld",
                           xevent->xcolormap.window));
 
@@ -1051,7 +1050,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case ClientMessage:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                 g_message ("client message:\twindow: %ld",
                            xevent->xclient.window));
 
@@ -1060,7 +1059,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     case MappingNotify:
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("mapping notify"));
 
       /* Let XLib know that there is a new keyboard mapping.
@@ -1272,7 +1271,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
 
               timings->complete = TRUE;
 #ifdef G_ENABLE_DEBUG
-              if (GDK_DEBUG_CHECK (FRAMES))
+              if (GDK_DISPLAY_DEBUG_CHECK (display, FRAMES))
                 _gdk_frame_clock_debug_print_timings (clock, timings);
 #endif /* G_ENABLE_DEBUG */
             }
@@ -1294,7 +1293,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
    *  the event is passed along to the program,
    *  which should then destroy the window.
    */
-      GDK_NOTE (EVENTS,
+      GDK_DISPLAY_NOTE (display, EVENTS,
                g_message ("delete window:\t\twindow: %ld",
                           xevent->xclient.window));
 
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index bb83933..86f9c85 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -266,7 +266,7 @@ gdk_x11_drag_context_read_got_stream (GObject      *source,
         {
           GdkDragContext *context = GDK_DRAG_CONTEXT (g_task_get_source_object (task));
 
-          GDK_NOTE (DND, g_printerr ("reading %s failed, trying %s next\n",
+          GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_printerr ("reading %s failed, 
trying %s next\n",
                                      (char *) targets->data, (char *) next->data));
           targets->next = NULL;
           g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free);
@@ -296,7 +296,7 @@ gdk_x11_drag_context_read_got_stream (GObject      *source,
             {
               g_assert (special_targets[i].mime_type != NULL);
 
-              GDK_NOTE(CLIPBOARD, g_printerr ("%s: reading with converter from %s to %s\n",
+              GDK_DISPLAY_NOTE (CLIPBOARD, g_printerr ("%s: reading with converter from %s to %s\n",
                                               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);
@@ -306,7 +306,7 @@ gdk_x11_drag_context_read_got_stream (GObject      *source,
         }
 #endif
 
-      GDK_NOTE(DND, g_printerr ("reading DND as %s now\n",
+      GDK_NOTE (DND, g_printerr ("reading DND as %s now\n",
                                 mime_type));
       g_task_return_pointer (task, stream, g_object_unref);
     }
@@ -338,7 +338,7 @@ gdk_x11_drag_context_read_async (GdkDragContext      *context,
       return;
     }
 
-  GDK_NOTE(DND, g_printerr ("new read for %s (%u other options)\n",
+  GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_printerr ("new read for %s (%u other 
options)\n",
                             (char *) targets->data, g_slist_length (targets->next)));
   gdk_x11_selection_input_stream_new_async (gdk_drag_context_get_display (context),
                                             "XdndSelection",
@@ -1057,13 +1057,13 @@ xdnd_status_filter (GdkXEvent *xev,
       gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
     return GDK_FILTER_CONTINUE;                 /* Not for us */
 
-  GDK_NOTE (DND,
-            g_message ("XdndStatus: dest_window: %#x  action: %ld",
-                       dest_window, action));
-
   display = gdk_window_get_display (event->any.window);
   context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window);
 
+  GDK_DISPLAY_NOTE (display, DND,
+            g_message ("XdndStatus: dest_window: %#x  action: %ld",
+                       dest_window, action));
+
   if (context)
     {
       GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
@@ -1072,7 +1072,7 @@ xdnd_status_filter (GdkXEvent *xev,
 
       if (!(action != 0) != !(flags & 1))
         {
-          GDK_NOTE (DND,
+          GDK_DISPLAY_NOTE (display, DND,
                     g_warning ("Received status event with flags not corresponding to action!"));
           action = 0;
         }
@@ -1104,12 +1104,12 @@ xdnd_finished_filter (GdkXEvent *xev,
       gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
     return GDK_FILTER_CONTINUE;                 /* Not for us */
 
-  GDK_NOTE (DND,
-            g_message ("XdndFinished: dest_window: %#x", dest_window));
-
   display = gdk_window_get_display (event->any.window);
   context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window);
 
+  GDK_DISPLAY_NOTE (display, DND,
+            g_message ("XdndFinished: dest_window: %#x", dest_window));
+
   if (context)
     {
       g_object_ref (context);
@@ -1205,7 +1205,7 @@ send_client_message_async_cb (Window   window,
                               gpointer data)
 {
   GdkDragContext *context = data;
-  GDK_NOTE (DND,
+  GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND,
             g_message ("Got async callback for #%lx, success = %d",
                        window, success));
 
@@ -1320,7 +1320,7 @@ xdnd_send_enter (GdkX11DragContext *context_x11)
   xev.xclient.data.l[3] = 0;
   xev.xclient.data.l[4] = 0;
 
-  GDK_NOTE(DND,
+  GDK_DISPLAY_NOTE (display, DND,
            g_message ("Sending enter source window %#lx XDND protocol version %d\n",
                       GDK_WINDOW_XID (context_x11->ipc_window), context_x11->version));
   atoms = gdk_content_formats_get_mime_types (context->formats, &n_atoms);
@@ -1341,7 +1341,7 @@ xdnd_send_enter (GdkX11DragContext *context_x11)
 
   if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev))
     {
-      GDK_NOTE (DND,
+      GDK_DISPLAY_NOTE (display, DND,
                 g_message ("Send event to %lx failed",
                            GDK_WINDOW_XID (context->dest_window)));
       g_object_unref (context->dest_window);
@@ -1370,7 +1370,7 @@ xdnd_send_leave (GdkX11DragContext *context_x11)
 
   if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev))
     {
-      GDK_NOTE (DND,
+      GDK_DISPLAY_NOTE (display, DND,
                 g_message ("Send event to %lx failed",
                            GDK_WINDOW_XID (context->dest_window)));
       g_object_unref (context->dest_window);
@@ -1400,7 +1400,7 @@ xdnd_send_drop (GdkX11DragContext *context_x11,
 
   if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev))
     {
-      GDK_NOTE (DND,
+      GDK_DISPLAY_NOTE (display, DND,
                 g_message ("Send event to %lx failed",
                            GDK_WINDOW_XID (context->dest_window)));
       g_object_unref (context->dest_window);
@@ -1433,7 +1433,7 @@ xdnd_send_motion (GdkX11DragContext *context_x11,
 
   if (!xdnd_send_xevent (context_x11, context->dest_window, FALSE, &xev))
     {
-      GDK_NOTE (DND,
+      GDK_DISPLAY_NOTE (display, DND,
                 g_message ("Send event to %lx failed",
                            GDK_WINDOW_XID (context->dest_window)));
       g_object_unref (context->dest_window);
@@ -1477,7 +1477,7 @@ xdnd_check_dest (GdkDisplay *display,
             }
           else
             {
-              GDK_NOTE (DND,
+              GDK_DISPLAY_NOTE (display, DND,
                         g_warning ("Invalid XdndProxy property on window %ld", win));
             }
 
@@ -1502,7 +1502,7 @@ xdnd_check_dest (GdkDisplay *display,
             }
           else
             {
-              GDK_NOTE (DND,
+              GDK_DISPLAY_NOTE (display, DND,
                         g_warning ("Invalid XdndAware property on window %ld", win));
             }
 
@@ -1554,7 +1554,7 @@ xdnd_read_actions (GdkX11DragContext *context_x11)
           context_x11->xdnd_have_actions = TRUE;
 
 #ifdef G_ENABLE_DEBUG
-          if (GDK_DEBUG_CHECK (DND))
+          if (GDK_DISPLAY_DEBUG_CHECK (display, DND))
             {
               GString *action_str = g_string_new (NULL);
               if (context->actions & GDK_ACTION_MOVE)
@@ -1742,14 +1742,14 @@ xdnd_enter_filter (GdkXEvent *xev,
 
   xdnd_precache_atoms (display);
 
-  GDK_NOTE (DND,
+  GDK_DISPLAY_NOTE (display, DND,
             g_message ("XdndEnter: source_window: %#x, version: %#x",
                        source_window, version));
 
   if (version < 3)
     {
       /* Old source ignore */
-      GDK_NOTE (DND, g_message ("Ignored old XdndEnter message"));
+      GDK_DISPLAY_NOTE (display, DND, g_message ("Ignored old XdndEnter message"));
       return GDK_FILTER_REMOVE;
     }
 
@@ -1820,7 +1820,7 @@ xdnd_enter_filter (GdkXEvent *xev,
   g_ptr_array_unref (formats);
 
 #ifdef G_ENABLE_DEBUG
-  if (GDK_DEBUG_CHECK (DND))
+  if (GDK_DISPLAY_DEBUG_CHECK (display, DND))
     print_target_list (context->formats);
 #endif /* G_ENABLE_DEBUG */
 
@@ -1851,13 +1851,13 @@ xdnd_leave_filter (GdkXEvent *xev,
       gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
     return GDK_FILTER_CONTINUE;                 /* Not for us */
 
-  GDK_NOTE (DND,
-            g_message ("XdndLeave: source_window: %#x",
-                       source_window));
-
   display = GDK_WINDOW_DISPLAY (event->any.window);
   display_x11 = GDK_X11_DISPLAY (display);
 
+  GDK_DISPLAY_NOTE (display, DND,
+            g_message ("XdndLeave: source_window: %#x",
+                       source_window));
+
   xdnd_precache_atoms (display);
 
   if ((display_x11->current_dest_drag != NULL) &&
@@ -1898,13 +1898,13 @@ xdnd_position_filter (GdkXEvent *xev,
        gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
      return GDK_FILTER_CONTINUE;                        /* Not for us */
 
-  GDK_NOTE (DND,
-            g_message ("XdndPosition: source_window: %#x position: (%d, %d)  time: %d  action: %ld",
-                       source_window, x_root, y_root, time, action));
-
   display = GDK_WINDOW_DISPLAY (event->any.window);
   display_x11 = GDK_X11_DISPLAY (display);
 
+  GDK_DISPLAY_NOTE (display, DND,
+            g_message ("XdndPosition: source_window: %#x position: (%d, %d)  time: %d  action: %ld",
+                       source_window, x_root, y_root, time, action));
+
   xdnd_precache_atoms (display);
 
   context = display_x11->current_dest_drag;
@@ -1958,13 +1958,13 @@ xdnd_drop_filter (GdkXEvent *xev,
       gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
     return GDK_FILTER_CONTINUE;                 /* Not for us */
 
-  GDK_NOTE (DND,
-            g_message ("XdndDrop: source_window: %#x  time: %d",
-                       source_window, time));
-
   display = GDK_WINDOW_DISPLAY (event->any.window);
   display_x11 = GDK_X11_DISPLAY (display);
 
+  GDK_DISPLAY_NOTE (display, DND,
+            g_message ("XdndDrop: source_window: %#x  time: %d",
+                       source_window, time));
+
   xdnd_precache_atoms (display);
 
   context = display_x11->current_dest_drag;
@@ -2084,13 +2084,13 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay      *display,
           *protocol = GDK_DRAG_PROTO_XDND;
           *version = 5;
           xdnd_precache_atoms (display);
-          GDK_NOTE (DND, g_message ("Entering local Xdnd window %#x\n", (guint) xid));
+          GDK_DISPLAY_NOTE (display, DND, g_message ("Entering local Xdnd window %#x\n", (guint) xid));
           return xid;
         }
       else if (_gdk_x11_display_is_root_window (display, xid))
         {
           *protocol = GDK_DRAG_PROTO_ROOTWIN;
-          GDK_NOTE (DND, g_message ("Entering root window\n"));
+          GDK_DISPLAY_NOTE (display, DND, g_message ("Entering root window\n"));
           return xid;
         }
     }
@@ -2098,7 +2098,7 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay      *display,
     {
       *protocol = GDK_DRAG_PROTO_XDND;
       xdnd_precache_atoms (display);
-      GDK_NOTE (DND, g_message ("Entering Xdnd window %#x\n", (guint) xid));
+      GDK_DISPLAY_NOTE (display, DND, g_message ("Entering Xdnd window %#x\n", (guint) xid));
       return retval;
     }
   else
@@ -2111,7 +2111,7 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay      *display,
 
       if (rootwin)
         {
-          GDK_NOTE (DND, g_message ("Entering root window\n"));
+          GDK_DISPLAY_NOTE (display, DND, g_message ("Entering root window\n"));
           *protocol = GDK_DRAG_PROTO_ROOTWIN;
           return xid;
         }
@@ -2451,7 +2451,7 @@ gdk_x11_drag_context_drag_status (GdkDragContext *context,
       xev.xclient.data.l[4] = xdnd_action_to_atom (display, action);
       if (!xdnd_send_xevent (context_x11, context->source_window, FALSE, &xev))
         {
-          GDK_NOTE (DND,
+          GDK_DISPLAY_NOTE (display, DND,
                     g_message ("Send event to %lx failed",
                                GDK_WINDOW_XID (context->source_window)));
         }
@@ -2510,7 +2510,7 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context,
 
       if (!xdnd_send_xevent (GDK_X11_DRAG_CONTEXT (context), context->source_window, FALSE, &xev))
         {
-          GDK_NOTE (DND,
+          GDK_DISPLAY_NOTE (display, DND,
                     g_message ("Send event to %lx failed",
                                GDK_WINDOW_XID (context->source_window)));
         }
@@ -2580,7 +2580,7 @@ gdk_x11_drag_context_default_output_done (GObject      *context,
 
   if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (context), result, &error))
     {
-      GDK_NOTE(DND, g_printerr ("failed to write stream: %s\n", error->message));
+      GDK_DISPLAY_NOTE (gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context)), DND, g_printerr ("failed 
to write stream: %s\n", error->message));
       g_error_free (error);
     }
 }
@@ -2624,12 +2624,12 @@ gdk_x11_drag_context_xevent (GdkDisplay   *display,
 
       if (xevent->xselectionclear.time < x11_context->timestamp)
         {
-          GDK_NOTE(CLIPBOARD, g_printerr ("ignoring SelectionClear with too old timestamp (%lu vs %lu)\n",
+          GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("ignoring SelectionClear with too old timestamp 
(%lu vs %lu)\n",
                                           xevent->xselectionclear.time, x11_context->timestamp));
           return FALSE;
         }
 
-      GDK_NOTE(CLIPBOARD, g_printerr ("got SelectionClear, aborting DND\n"));
+      GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionClear, aborting DND\n"));
       gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
       return TRUE;
 
@@ -2648,12 +2648,12 @@ gdk_x11_drag_context_xevent (GdkDisplay   *display,
 
         if (xevent->xselectionrequest.requestor == None)
           {
-            GDK_NOTE(CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s with NULL window, ignoring\n",
+            GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s with NULL 
window, ignoring\n",
                                             target, property));
             return TRUE;
           }
         
-        GDK_NOTE(CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s\n",
+        GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionRequest for %s @ %s\n",
                                         target, property));
 
         gdk_x11_selection_output_streams_create (display,
@@ -3011,7 +3011,7 @@ _gdk_x11_window_drag_begin (GdkWindow          *window,
                       x11_context->timestamp);
   if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_WINDOW_XID 
(x11_context->ipc_window))
     {
-      GDK_NOTE(DND, g_printerr ("failed XSetSelectionOwner() on \"XdndSelection\", aborting DND\n"));
+      GDK_DISPLAY_NOTE (display, DND, g_printerr ("failed XSetSelectionOwner() on \"XdndSelection\", 
aborting DND\n"));
       g_object_unref (context);
       return NULL;
     }
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 853274f..5924946 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -143,7 +143,7 @@ gdk_x11_gl_context_end_frame (GdkDrawContext *draw_context,
 
   drawable = context_x11->attached_drawable;
 
-  GDK_NOTE (OPENGL,
+  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_window_get_xid (window),
@@ -398,7 +398,7 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
   if (glx_pixmap == NULL)
     return FALSE;
 
-  GDK_NOTE (OPENGL, g_message ("Using GLX_EXT_texture_from_pixmap to draw surface"));
+  GDK_DISPLAY_NOTE (GDK_DISPLAY (display_x11), OPENGL, g_message ("Using GLX_EXT_texture_from_pixmap to draw 
surface"));
 
   window = gdk_gl_context_get_window (paint_context)->impl_window;
   window_scale = gdk_window_get_scale_factor (window);
@@ -582,9 +582,9 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
   compat_bit = gdk_gl_context_get_forward_compatible (context);
 
   /* If there is no glXCreateContextAttribsARB() then we default to legacy */
-  legacy_bit = !display_x11->has_glx_create_context || GDK_DEBUG_CHECK (GL_LEGACY);
+  legacy_bit = !display_x11->has_glx_create_context || GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY);
 
-  es_bit = (GDK_DEBUG_CHECK (GL_GLES) || (share != NULL && gdk_gl_context_get_use_es (share))) &&
+  es_bit = (GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) || (share != NULL && gdk_gl_context_get_use_es 
(share))) &&
            (display_x11->has_glx_create_context && display_x11->has_glx_create_es2_context);
 
   /* We cannot share legacy contexts with core profile ones, so the
@@ -600,7 +600,7 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
   if (compat_bit)
     flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
 
-  GDK_NOTE (OPENGL,
+  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",
@@ -614,7 +614,7 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
    */
   if (legacy_bit && !GDK_X11_DISPLAY (display)->has_glx_create_context)
     {
-      GDK_NOTE (OPENGL, g_message ("Creating legacy GL context on request"));
+      GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating legacy GL context on request"));
       context_x11->glx_context = create_legacy_context (display, context_x11->glx_config, share);
     }
   else
@@ -637,7 +637,7 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
           minor = 0;
         }
 
-      GDK_NOTE (OPENGL, g_message ("Creating GL3 context"));
+      GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 context"));
       context_x11->glx_context = create_gl3_context (display,
                                                      context_x11->glx_config,
                                                      share,
@@ -646,7 +646,7 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
       /* Fall back to legacy in case the GL3 context creation failed */
       if (context_x11->glx_context == NULL)
         {
-          GDK_NOTE (OPENGL, g_message ("Creating fallback legacy context"));
+          GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating fallback legacy context"));
           context_x11->glx_context = create_legacy_context (display, context_x11->glx_config, share);
           legacy_bit = TRUE;
           es_bit = FALSE;
@@ -727,7 +727,7 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
 
   context_x11->is_direct = glXIsDirect (dpy, context_x11->glx_context);
 
-  GDK_NOTE (OPENGL,
+  GDK_DISPLAY_NOTE (display, OPENGL,
             g_message ("Realized GLX context[%p], %s",
                        context_x11->glx_context,
                        context_x11->is_direct ? "direct" : "indirect"));
@@ -749,7 +749,7 @@ gdk_x11_gl_context_dispose (GObject *gobject)
       if (glXGetCurrentContext () == context_x11->glx_context)
         glXMakeContextCurrent (dpy, None, None, NULL);
 
-      GDK_NOTE (OPENGL, g_message ("Destroying GLX context"));
+      GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying GLX context"));
       glXDestroyContext (dpy, context_x11->glx_context);
       context_x11->glx_context = NULL;
     }
@@ -791,7 +791,7 @@ gdk_x11_screen_init_gl (GdkX11Screen *screen)
   if (display_x11->have_glx)
     return TRUE;
 
-  if (GDK_DEBUG_CHECK (GL_DISABLE))
+  if (GDK_DISPLAY_DEBUG_CHECK (display, GL_DISABLE))
     return FALSE;
 
   dpy = gdk_x11_display_get_xdisplay (display);
@@ -829,7 +829,7 @@ gdk_x11_screen_init_gl (GdkX11Screen *screen)
   display_x11->has_glx_visual_rating =
     epoxy_has_glx_extension (dpy, screen_num, "GLX_EXT_visual_rating");
 
-  GDK_NOTE (OPENGL,
+  GDK_DISPLAY_NOTE (display, OPENGL,
             g_message ("GLX version %d.%d found\n"
                        " - Vendor: %s\n"
                        " - Checked extensions:\n"
@@ -1254,14 +1254,14 @@ gdk_x11_display_make_gl_context_current (GdkDisplay   *display,
   else
     drawable = context_x11->unattached_drawable;
 
-  GDK_NOTE (OPENGL,
+  GDK_DISPLAY_NOTE (display, OPENGL,
             g_message ("Making GLX context %p current to drawable %lu",
                        context, (unsigned long) drawable));
 
   if (!glXMakeContextCurrent (dpy, drawable, drawable,
                               context_x11->glx_context))
     {
-      GDK_NOTE (OPENGL,
+      GDK_DISPLAY_NOTE (display, OPENGL,
                 g_message ("Making GLX context current failed"));
       return FALSE;
     }
diff --git a/gdk/x11/gdkselectioninputstream-x11.c b/gdk/x11/gdkselectioninputstream-x11.c
index 4a6f501..d006ab6 100644
--- a/gdk/x11/gdkselectioninputstream-x11.c
+++ b/gdk/x11/gdkselectioninputstream-x11.c
@@ -135,7 +135,7 @@ 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",
+  GDK_NOTE (SELECTION, g_printerr ("%s:%s: finishing read of %zd/%zu bytes\n",
                                   priv->selection, priv->target,
                                   written, priv->pending_size));
   g_task_return_int (priv->pending_task, written);
@@ -153,7 +153,7 @@ gdk_x11_selection_input_stream_complete (GdkX11SelectionInputStream *stream)
   if (priv->complete)
     return;
 
-  GDK_NOTE(SELECTION, g_printerr ("%s:%s: transfer complete\n",
+  GDK_NOTE (SELECTION, g_printerr ("%s:%s: transfer complete\n",
                                   priv->selection, priv->target));
   priv->complete = TRUE;
 
@@ -181,11 +181,11 @@ 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",
+  GDK_NOTE (SELECTION, g_printerr ("%s:%s: starting sync read of %zu bytes\n",
                                   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",
+  GDK_NOTE (SELECTION, g_printerr ("%s:%s: finishing sync read of %zd/%zu bytes\n",
                                   priv->selection, priv->target,
                                   written, count));
   return written;
@@ -221,7 +221,7 @@ 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",
+      GDK_NOTE (SELECTION, g_printerr ("%s:%s: async read of %zd/%zu bytes\n",
                                       priv->selection, priv->target,
                                       size, count));
       g_task_return_int (task, size);
@@ -231,7 +231,7 @@ 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",
+      GDK_NOTE (SELECTION, g_printerr ("%s:%s: async read of %zu bytes pending\n",
                                       priv->selection, priv->target,
                                       count));
     }
@@ -409,21 +409,21 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay   *display,
       bytes = get_selection_property (xdisplay, xwindow, xevent->xproperty.atom, &type, &format);
       if (bytes == NULL)
         { 
-          GDK_NOTE(SELECTION, g_printerr ("%s:%s: got PropertyNotify erroring out of INCR\n",
+          GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify erroring out of 
INCR\n",
                                           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_NOTE(SELECTION, g_printerr ("%s:%s: got PropertyNotify ending INCR\n",
+          GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify ending INCR\n",
                                           priv->selection, priv->target));
           g_bytes_unref (bytes);
           gdk_x11_selection_input_stream_complete (stream);
         }
       else
         {
-          GDK_NOTE(SELECTION, g_printerr ("%s:%s: got PropertyNotify during INCR with %zu bytes\n",
+          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)));
           g_async_queue_push (priv->chunks, bytes);
@@ -448,7 +448,7 @@ 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_NOTE(SELECTION, g_printerr ("%s:%s: got SelectionNotify\n", priv->selection, priv->target));
+        GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got SelectionNotify\n", priv->selection, 
priv->target));
 
         task = priv->pending_task;
         priv->pending_task = NULL;
@@ -478,13 +478,13 @@ gdk_x11_selection_input_stream_xevent (GdkDisplay   *display,
                   {
                     /* The remainder of the selection will come through PropertyNotify
                        events on xwindow */
-                    GDK_NOTE(SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n", priv->selection, 
priv->target));
+                    GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n", 
priv->selection, priv->target));
                     priv->incr = TRUE;
                     gdk_x11_selection_input_stream_flush (stream);
                   }
                 else
                   {
-                    GDK_NOTE(SELECTION, g_printerr ("%s:%s: reading %zu bytes\n",
+                    GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: reading %zu bytes\n",
                                                     priv->selection, priv->target,
                                                     g_bytes_get_size (bytes)));
                     g_async_queue_push (priv->chunks, bytes);
diff --git a/gdk/x11/gdkselectionoutputstream-x11.c b/gdk/x11/gdkselectionoutputstream-x11.c
index 405a49d..3587b95 100644
--- a/gdk/x11/gdkselectionoutputstream-x11.c
+++ b/gdk/x11/gdkselectionoutputstream-x11.c
@@ -111,14 +111,14 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify,
   notify->n_pending--;
   if (notify->n_pending)
     {
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: not sending SelectionNotify yet, %zu streams still pending\n",
+      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));
       return;
     }
 
-  GDK_NOTE(SELECTION, g_printerr ("%s:%s: sending SelectionNotify reporting %s\n",
+  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"));
@@ -131,7 +131,7 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify,
 
   if (XSendEvent (xdisplay, notify->xevent.requestor, False, NoEventMask, (XEvent*) &notify->xevent) == 0)
     {
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: failed to XSendEvent()\n",
+      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)));
     }
@@ -140,7 +140,7 @@ gdk_x11_pending_selection_notify_send (GdkX11PendingSelectionNotify *notify,
   error = gdk_x11_display_error_trap_pop (display);
   if (error != Success)
     {
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: X error during write: %d\n",
+      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));
@@ -241,7 +241,7 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre
       XWindowAttributes attrs;
 
       priv->incr = TRUE;
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n",
+      GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: initiating INCR transfer\n",
                                       priv->selection, priv->target));
 
       XGetWindowAttributes (xdisplay,
@@ -271,7 +271,7 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre
                        PropModeReplace,
                        priv->data->data,
                        n_elements);
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: wrote %zu/%u bytes\n",
+      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));
       g_byte_array_remove_range (priv->data, 0, n_elements * element_size);
       if (priv->data->len < element_size)
@@ -292,7 +292,7 @@ gdk_x11_selection_output_stream_perform_flush (GdkX11SelectionOutputStream *stre
   error = gdk_x11_display_error_trap_pop (priv->display);
   if (error != Success)
     {
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: X error during write: %d\n",
+      GDK_DISPLAY_NOTE (priv->display, SELECTION, g_printerr ("%s:%s: X error during write: %d\n",
                                       priv->selection, priv->target, error));
     }
 
@@ -328,7 +328,7 @@ 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",
+  GDK_NOTE (SELECTION, g_printerr ("%s:%s: wrote %zu bytes, %u total now\n",
                                   priv->selection, priv->target, count, priv->data->len));
   g_mutex_unlock (&priv->mutex);
 
@@ -361,7 +361,7 @@ 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",
+  GDK_NOTE (SELECTION, g_printerr ("%s:%s: async wrote %zu bytes, %u total now\n",
                                   priv->selection, priv->target, count, priv->data->len));
   g_mutex_unlock (&priv->mutex);
 
@@ -412,8 +412,8 @@ 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_NOTE (SELECTION, g_printerr ("%s:%s: requested flush%s\n",
+                                  priv->selection, priv->target, needs_flush ?"" : ", but not needed"));
   return needs_flush;
 }
 
@@ -612,7 +612,7 @@ gdk_x11_selection_output_stream_xevent (GdkDisplay   *display,
           xevent->xproperty.state != PropertyDelete)
         return FALSE;
 
-      GDK_NOTE(SELECTION, g_printerr ("%s:%s: got PropertyNotify Delete during INCR\n",
+      GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s:%s: got PropertyNotify Delete during INCR\n",
                                       priv->selection, priv->target));
       priv->delete_pending = FALSE;
       if (gdk_x11_selection_output_stream_needs_flush (stream) &&
@@ -672,7 +672,7 @@ print_atoms (GdkDisplay *display,
              const Atom *atoms,
              gsize       n_atoms)
 {
-  GDK_NOTE(CLIPBOARD,
+  GDK_DISPLAY_NOTE (display, CLIPBOARD,
            gsize i;
             
            g_printerr ("%s: %s [ ", selection, prefix);
@@ -694,7 +694,7 @@ 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",
+      GDK_NOTE (CLIPBOARD, g_printerr ("---: failed to send targets after %zu bytes: %s\n",
                                       bytes_written, error->message));
       g_error_free (error);
     }
@@ -741,7 +741,7 @@ 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",
+      GDK_NOTE (CLIPBOARD, g_printerr ("---: failed to send timestamp after %zu bytes: %s\n",
                                       bytes_written, error->message));
       g_error_free (error);
     }
@@ -905,13 +905,13 @@ gdk_x11_selection_output_streams_request (GdkDisplay                   *display,
                                   &n_atoms, &nbytes, (guchar **) &atoms);
       if (error != Success)
         {
-          GDK_NOTE(SELECTION, g_printerr ("%s: XGetProperty() during MULTIPLE failed with %d\n",
+          GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: XGetProperty() during MULTIPLE failed with 
%d\n",
                                           selection, error));
         }
       else if (prop_format != 32 ||
                prop_type != gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR"))
         {
-          GDK_NOTE(SELECTION, g_printerr ("%s: XGetProperty() type/format should be ATOM_PAIR/32 but is 
%s/%d\n",
+          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));
         }
       else if (n_atoms < 2)
@@ -925,7 +925,7 @@ gdk_x11_selection_output_streams_request (GdkDisplay                   *display,
           print_atoms (display, selection, "MULTIPLE request", atoms, n_atoms);
           if (n_atoms % 2)
             {
-              GDK_NOTE(SELECTION, g_printerr ("%s: Number of atoms is uneven at %lu, ignoring last 
element\n",
+              GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: Number of atoms is uneven at %lu, 
ignoring last element\n",
                                               selection, n_atoms));
               n_atoms &= ~1;
             }
@@ -939,14 +939,14 @@ gdk_x11_selection_output_streams_request (GdkDisplay                   *display,
               if (atoms[2 * i] == None || atoms[2 * i + 1] == None)
                 {
                   success = FALSE;
-                  GDK_NOTE(SELECTION, g_printerr ("%s: None not allowed as atom in MULTIPLE request\n",
+                  GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: None not allowed as atom in 
MULTIPLE request\n",
                                                   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_NOTE(SELECTION, g_printerr ("%s: MULTIPLE as target in MULTIPLE request would cause 
recursion\n",
+                  GDK_DISPLAY_NOTE (display, SELECTION, g_printerr ("%s: MULTIPLE as target in MULTIPLE 
request would cause recursion\n",
                                                   selection));
                   gdk_x11_pending_selection_notify_send (notify, display, FALSE);
                 }
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
index 9b32ab7..be7718f 100644
--- a/gdk/x11/gdkvisual-x11.c
+++ b/gdk/x11/gdkvisual-x11.c
@@ -196,7 +196,7 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen,
     }
 
 #ifdef G_ENABLE_DEBUG
-  if (GDK_DEBUG_CHECK (MISC))
+  if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), MISC))
     {
       static const gchar *const visual_names[] =
       {
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 9300fed..83f8dea 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -410,8 +410,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
 
   if (impl->toplevel->current_counter_value % 2 == 1)
     {
-#ifdef G_ENABLE_DEBUG
-      if (GDK_DEBUG_CHECK (FRAMES))
+      if (GDK_DISPLAY_DEBUG_CHECK (gdk_window_get_display (window), FRAMES))
         {
           XImage *image = XGetImage (GDK_WINDOW_XDISPLAY (window),
                                      GDK_WINDOW_XID (window),
@@ -420,7 +419,6 @@ gdk_x11_window_end_frame (GdkWindow *window)
                                      ZPixmap);
           XDestroyImage (image);
         }
-#endif /* G_ENABLE_DEBUG */
 
       /* An increment of 3 means that the frame was not drawn as fast as possible,
        * but rather at a particular time. This can trigger different handling from
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c
index 888cb50..0b378e4 100644
--- a/gdk/x11/xsettings-client.c
+++ b/gdk/x11/xsettings-client.c
@@ -272,7 +272,7 @@ parse_settings (unsigned char *data,
       !fetch_card32 (&buffer, &n_entries))
     goto out;
 
-  GDK_NOTE(SETTINGS, g_message ("reading %u settings (serial %u byte order %u)", n_entries, serial, 
buffer.byte_order));
+  GDK_NOTE (SETTINGS, g_message ("reading %u settings (serial %u byte order %u)", n_entries, 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_NOTE (SETTINGS, g_message ("  %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_NOTE (SETTINGS, g_message ("  %s = \"%s\"", x_name, s));
           }
          break;
        case XSETTINGS_TYPE_COLOR:
@@ -340,12 +340,12 @@ parse_settings (unsigned char *data,
             g_value_init (value, G_TYPE_STRING);
             g_value_set_boxed (value, &rgba);
 
-            GDK_NOTE(SETTINGS, g_message ("  %s = #%02X%02X%02X%02X", x_name, alpha,red, green, blue));
+            GDK_NOTE (SETTINGS, g_message ("  %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_NOTE (SETTINGS, g_message ("  %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_NOTE (SETTINGS, g_message ("    ==> unknown to GTK"));
           free_value (value);
         }
       else
         {
-          GDK_NOTE(SETTINGS, g_message ("    ==> storing as '%s'", gdk_name));
+          GDK_NOTE (SETTINGS, g_message ("    ==> storing as '%s'", gdk_name));
 
           if (settings == NULL)
             settings = g_hash_table_new_full (g_str_hash, g_str_equal,
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 655b360..7c887bf 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -51,6 +51,8 @@
 #include "gtkmodulesprivate.h"
 #include "gtkwindow.h"
 #include "gtkwindowgroup.h"
+#include "gtkprivate.h"
+#include "gdk-private.h"
 
 G_DEFINE_TYPE (GtkInspectorWindow, gtk_inspector_window, GTK_TYPE_WINDOW)
 
@@ -321,6 +323,9 @@ get_inspector_display (void)
 
       g_object_set_data_full (G_OBJECT (display), "gsk-renderer",
                               g_strdup (name), g_free);
+
+      gdk_display_set_debug_flags (display, 0);
+      gtk_set_display_debug_flags (display, 0);
     }
 
   if (!display)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]