summaryrefslogtreecommitdiffstats
path: root/wayland
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-01-26 18:38:05 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-01-26 18:38:05 -0500
commitbaa958eaf2a727c1f8e72aa2606b4b975087939f (patch)
treec0aa02c0c2fecd8808c8f3577b21c5422419cbcc /wayland
parentFix returning to sway after swaylock completes (diff)
downloadsway-baa958eaf2a727c1f8e72aa2606b4b975087939f.tar.gz
sway-baa958eaf2a727c1f8e72aa2606b4b975087939f.tar.zst
sway-baa958eaf2a727c1f8e72aa2606b4b975087939f.zip
Remove pointer from swaylock surface
Diffstat (limited to 'wayland')
-rw-r--r--wayland/window.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/wayland/window.c b/wayland/window.c
index 916e3b57..ba64cb60 100644
--- a/wayland/window.c
+++ b/wayland/window.c
@@ -18,8 +18,10 @@
18static void pointer_handle_enter(void *data, struct wl_pointer *pointer, 18static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
19 uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w) { 19 uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w) {
20 struct window *window = data; 20 struct window *window = data;
21 struct wl_cursor_image *image = window->cursor.cursor->images[0]; 21 if (window->registry->pointer) {
22 wl_pointer_set_cursor(pointer, serial, window->cursor.surface, image->hotspot_x, image->hotspot_y); 22 struct wl_cursor_image *image = window->cursor.cursor->images[0];
23 wl_pointer_set_cursor(pointer, serial, window->cursor.surface, image->hotspot_x, image->hotspot_y);
24 }
23} 25}
24 26
25static void pointer_handle_leave(void *data, struct wl_pointer *pointer, 27static void pointer_handle_leave(void *data, struct wl_pointer *pointer,
@@ -77,15 +79,17 @@ struct window *window_setup(struct registry *registry, uint32_t width, uint32_t
77 79
78 get_next_buffer(window); 80 get_next_buffer(window);
79 81
80 window->cursor.cursor_theme = wl_cursor_theme_load("default", 32, registry->shm); // TODO: let you customize this 82 if (registry->pointer) {
81 window->cursor.cursor = wl_cursor_theme_get_cursor(window->cursor.cursor_theme, "left_ptr"); 83 window->cursor.cursor_theme = wl_cursor_theme_load("default", 32, registry->shm); // TODO: let you customize this
82 window->cursor.surface = wl_compositor_create_surface(registry->compositor); 84 window->cursor.cursor = wl_cursor_theme_get_cursor(window->cursor.cursor_theme, "left_ptr");
83 85 window->cursor.surface = wl_compositor_create_surface(registry->compositor);
84 struct wl_cursor_image *image = window->cursor.cursor->images[0]; 86
85 struct wl_buffer *cursor_buf = wl_cursor_image_get_buffer(image); 87 struct wl_cursor_image *image = window->cursor.cursor->images[0];
86 wl_surface_attach(window->cursor.surface, cursor_buf, 0, 0); 88 struct wl_buffer *cursor_buf = wl_cursor_image_get_buffer(image);
87 wl_surface_damage(window->cursor.surface, 0, 0, image->width, image->height); 89 wl_surface_attach(window->cursor.surface, cursor_buf, 0, 0);
88 wl_surface_commit(window->cursor.surface); 90 wl_surface_damage(window->cursor.surface, 0, 0, image->width, image->height);
91 wl_surface_commit(window->cursor.surface);
92 }
89 93
90 return window; 94 return window;
91} 95}