[gtk+] wayland: Use on globals closure for loading cursor themes
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Use on globals closure for loading cursor themes
- Date: Wed, 20 May 2015 03:50:50 +0000 (UTC)
commit 7fef713224583ab906d0875eedcf7a76534eff0f
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon May 18 16:38:34 2015 +0800
wayland: Use on globals closure for loading cursor themes
Instead of putting a 'load cursor themes' call when receiving an wl_shm
global, make it a closure that is prepared during initialization.
https://bugzilla.gnome.org/show_bug.cgi?id=719819
gdk/wayland/gdkdisplay-wayland.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 9918c6d..a0a5d0c 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -299,9 +299,6 @@ gdk_registry_handle_global (void *data,
{
display_wayland->shm =
wl_registry_bind (display_wayland->wl_registry, id, &wl_shm_interface, 1);
-
- /* SHM interface is prerequisite */
- _gdk_wayland_display_load_cursor_theme (display_wayland);
}
else if (strcmp (interface, "xdg_shell") == 0)
{
@@ -398,6 +395,27 @@ log_handler (const char *format, va_list args)
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
}
+static void
+load_cursor_theme_closure_run (GdkWaylandDisplay *display_wayland,
+ OnHasGlobalsClosure *closure)
+{
+ _gdk_wayland_display_load_cursor_theme (display_wayland);
+}
+
+static void
+_gdk_wayland_display_prepare_cursor_themes (GdkWaylandDisplay *display_wayland)
+{
+ OnHasGlobalsClosure *closure;
+ static const char *required_cursor_theme_globals[] = {
+ "wl_shm",
+ };
+
+ closure = g_new0 (OnHasGlobalsClosure, 1);
+ closure->handler = load_cursor_theme_closure_run;
+ closure->required_globals = required_cursor_theme_globals;
+ postpone_on_globals_closure (display_wayland, closure);
+}
+
GdkDisplay *
_gdk_wayland_display_open (const gchar *display_name)
{
@@ -432,6 +450,7 @@ _gdk_wayland_display_open (const gchar *display_name)
g_hash_table_new_full (NULL, NULL, NULL, g_free);
_gdk_wayland_display_init_cursors (display_wayland);
+ _gdk_wayland_display_prepare_cursor_themes (display_wayland);
display_wayland->wl_registry = wl_display_get_registry (display_wayland->wl_display);
wl_registry_add_listener (display_wayland->wl_registry, ®istry_listener, display_wayland);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]