]> Pileus Git - ~andy/gtk/commitdiff
wayland: Load cursor theme using new Wayland cursor library
authorRob Bradford <rob@linux.intel.com>
Wed, 11 Jul 2012 13:18:28 +0000 (14:18 +0100)
committerRob Bradford <rob@linux.intel.com>
Thu, 12 Jul 2012 14:58:38 +0000 (15:58 +0100)
This requires the SHM object be initialised - therefore this is the most
logical (if slightly ugly place.)

We also need to make sure that we do something clever to load the correct
cursor theme.

gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdkdisplay-wayland.h

index 479db8be4fb2abde5f818178d465855ee931fb8a..89c534950276684f21720e269f7ea3b59a4ac576 100644 (file)
@@ -38,6 +38,8 @@
 #include "gdkkeysprivate.h"
 #include "gdkprivate-wayland.h"
 
+static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display);
+
 G_DEFINE_TYPE (GdkWaylandDisplay, _gdk_wayland_display, GDK_TYPE_DISPLAY)
 
 static void
@@ -129,6 +131,9 @@ gdk_display_handle_global(struct wl_display *display, uint32_t id,
       wl_display_bind(display, id, &wl_compositor_interface);
   } else if (strcmp(interface, "wl_shm") == 0) {
     display_wayland->shm = wl_display_bind(display, id, &wl_shm_interface);
+
+    /* SHM interface is prerequisite */
+    _gdk_wayland_display_load_cursor_theme(display_wayland);
   } else if (strcmp(interface, "wl_shell") == 0) {
     display_wayland->shell = wl_display_bind(display, id, &wl_shell_interface);
   } else if (strcmp(interface, "wl_output") == 0) {
@@ -615,3 +620,20 @@ _gdk_wayland_display_init (GdkWaylandDisplay *display)
   _gdk_wayland_display_manager_add_display (gdk_display_manager_get (),
                                            GDK_DISPLAY (display));
 }
+
+static void
+_gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display)
+{
+  guint w, h;
+  gchar *theme_name = NULL; /* FIXME: Do something here */
+
+  g_assert (wayland_display);
+  g_assert (wayland_display->shm);
+
+  _gdk_wayland_display_get_default_cursor_size (GDK_DISPLAY (wayland_display),
+                                                &w, &h);
+
+  wayland_display->cursor_theme = wl_cursor_theme_load (theme_name,
+                                                        w,
+                                                        wayland_display->shm);
+}
index 3c8866a9aacba9bb4004c96d4525a9584aec2b0e..c614e9c8f35ba4f8553254fa6417999b83bb2fc5 100644 (file)
@@ -25,6 +25,7 @@
 #include <config.h>
 #include <stdint.h>
 #include <wayland-client.h>
+#include <wayland-cursor.h>
 
 #ifdef GDK_WAYLAND_USE_EGL
 #include <wayland-egl.h>
@@ -80,6 +81,9 @@ struct _GdkWaylandDisplay
   struct wl_output *output;
   struct wl_input_device *input_device;
   struct wl_data_device_manager *data_device_manager;
+
+  struct wl_cursor_theme *cursor_theme;
+
   GSource *event_source;
 
 #ifdef GDK_WAYLAND_USE_EGL