diff options
-rw-r--r-- | swaylock/main.c | 6 | ||||
-rw-r--r-- | wayland/window.c | 26 |
2 files changed, 21 insertions, 11 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index f0fe1d00..020ff036 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -283,6 +283,12 @@ int main(int argc, char **argv) { | |||
283 | sway_abort("swaylock requires the compositor to support the swaylock extension."); | 283 | sway_abort("swaylock requires the compositor to support the swaylock extension."); |
284 | } | 284 | } |
285 | 285 | ||
286 | if (registry->pointer) { | ||
287 | // We don't want swaylock to have a pointer | ||
288 | wl_pointer_destroy(registry->pointer); | ||
289 | registry->pointer = NULL; | ||
290 | } | ||
291 | |||
286 | int i; | 292 | int i; |
287 | for (i = 0; i < registry->outputs->length; ++i) { | 293 | for (i = 0; i < registry->outputs->length; ++i) { |
288 | struct output_state *output = registry->outputs->items[i]; | 294 | struct output_state *output = registry->outputs->items[i]; |
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 @@ | |||
18 | static void pointer_handle_enter(void *data, struct wl_pointer *pointer, | 18 | static 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 | ||
25 | static void pointer_handle_leave(void *data, struct wl_pointer *pointer, | 27 | static 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 | } |