[mutter/bilelmoussaoui/gdk-x11-only: 1/6] core: Add a copy of GDK_PRIORITY_EVENTS




commit c992feb74ade77370b035a5b738677a1aecc773c
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Mon May 9 11:48:57 2022 +0200

    core: Add a copy of GDK_PRIORITY_EVENTS
    
    Quoting Carlos:
    The META_PRIORITY_EVENTS ± 1 happening below are in order to set these idles
    and timeouts in a priority that is relative to the literal GDK event priority,
    making those diverge is a likely way to sneakily break things.
    But that's unlikely to happen, and decoupling mutter from GTK further
    should make it moot, so perhaps it's alright after all.

 src/core/events.h          | 8 ++++++++
 src/tests/meson.build      | 3 +++
 src/tests/test-client.c    | 4 +++-
 src/wayland/meta-wayland.c | 3 ++-
 4 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/core/events.h b/src/core/events.h
index 6338119ae7..5b48d3905d 100644
--- a/src/core/events.h
+++ b/src/core/events.h
@@ -25,6 +25,14 @@
 
 #include "meta/display.h"
 
+/**
+ * META_PRIORITY_EVENTS: (value 0)
+ *
+ * This is the priority that events from the X server are given in the main loop.
+ */
+#define META_PRIORITY_EVENTS    (G_PRIORITY_DEFAULT)
+
+
 void meta_display_init_events (MetaDisplay *display);
 void meta_display_free_events (MetaDisplay *display);
 
diff --git a/src/tests/meson.build b/src/tests/meson.build
index cada89d722..d08bd02228 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -116,6 +116,9 @@ test_client = executable('mutter-test-client',
     gio_unix_dep,
     x11_dep,
     xext_dep,
+    graphene_dep,
+    json_glib_dep,
+    gsettings_desktop_schemas_dep,
   ],
   install: have_installed_tests,
   install_dir: mutter_installed_tests_libexecdir,
diff --git a/src/tests/test-client.c b/src/tests/test-client.c
index 0007d61ea2..4c7479ae6f 100644
--- a/src/tests/test-client.c
+++ b/src/tests/test-client.c
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <X11/extensions/sync.h>
 
+#include "core/events.h"
+
 const char *client_id = "0";
 static gboolean wayland;
 GHashTable *windows;
@@ -156,7 +158,7 @@ ensure_xsource_handler (GdkDisplay *gdkdisplay)
   x_source->event_poll_fd.events = G_IO_IN;
   g_source_add_poll (source, &x_source->event_poll_fd);
 
-  g_source_set_priority (source, GDK_PRIORITY_EVENTS - 1);
+  g_source_set_priority (source, META_PRIORITY_EVENTS - 1);
   g_source_set_can_recurse (source, TRUE);
   g_source_attach (source, NULL);
 
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index afea5e875c..883b17d963 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -31,6 +31,7 @@
 #include "clutter/clutter.h"
 #include "cogl/cogl-egl.h"
 #include "compositor/meta-surface-actor-wayland.h"
+#include "core/events.h"
 #include "core/meta-context-private.h"
 #include "wayland/meta-wayland-activation.h"
 #include "wayland/meta-wayland-buffer.h"
@@ -584,7 +585,7 @@ meta_wayland_compositor_new (MetaContext *context)
    * relating to X clients when we don't know what's happened to them
    * according to the X protocol.
    */
-  g_source_set_priority (wayland_event_source, GDK_PRIORITY_EVENTS + 1);
+  g_source_set_priority (wayland_event_source, META_PRIORITY_EVENTS + 1);
   g_source_attach (wayland_event_source, NULL);
   compositor->source = wayland_event_source;
   g_source_unref (wayland_event_source);


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