[gtk+] wayland: Load cursor theme using new Wayland cursor library
- From: Rob Bradford <rbradford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Load cursor theme using new Wayland cursor library
- Date: Thu, 12 Jul 2012 14:59:50 +0000 (UTC)
commit b1a5b19b4ab2c8761f223f35a21487bc294f5d2c
Author: Rob Bradford <rob linux intel com>
Date: Wed Jul 11 14:18:28 2012 +0100
wayland: Load cursor theme using new Wayland cursor library
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 | 22 ++++++++++++++++++++++
gdk/wayland/gdkdisplay-wayland.h | 4 ++++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 479db8b..89c5349 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -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);
+}
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 3c8866a..c614e9c 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]