diff options
author | emersion <contact@emersion.fr> | 2018-03-31 00:13:26 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-03-31 00:24:38 -0400 |
commit | b237fa0b22d36e52fc0be7fe785e02ea1d2456f7 (patch) | |
tree | 122d850bff4e052b5f76238d5c8d38346a1291fc | |
parent | Use wlr_surface_point_accepts_input (diff) | |
download | sway-b237fa0b22d36e52fc0be7fe785e02ea1d2456f7.tar.gz sway-b237fa0b22d36e52fc0be7fe785e02ea1d2456f7.tar.zst sway-b237fa0b22d36e52fc0be7fe785e02ea1d2456f7.zip |
Set xwayland cursor
-rw-r--r-- | include/sway/server.h | 1 | ||||
-rw-r--r-- | sway/input/seat.c | 4 | ||||
-rw-r--r-- | sway/server.c | 13 |
3 files changed, 16 insertions, 2 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 61f21cdb..296fbf22 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -33,6 +33,7 @@ struct sway_server { | |||
33 | struct wl_listener xdg_shell_v6_surface; | 33 | struct wl_listener xdg_shell_v6_surface; |
34 | 34 | ||
35 | struct wlr_xwayland *xwayland; | 35 | struct wlr_xwayland *xwayland; |
36 | struct wlr_xcursor_manager *xcursor_manager; | ||
36 | struct wl_listener xwayland_surface; | 37 | struct wl_listener xwayland_surface; |
37 | struct wl_listener xwayland_ready; | 38 | struct wl_listener xwayland_ready; |
38 | 39 | ||
diff --git a/sway/input/seat.c b/sway/input/seat.c index ae536264..f969636a 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -259,11 +259,11 @@ void sway_seat_remove_device(struct sway_seat *seat, | |||
259 | 259 | ||
260 | void sway_seat_configure_xcursor(struct sway_seat *seat) { | 260 | void sway_seat_configure_xcursor(struct sway_seat *seat) { |
261 | // TODO configure theme and size | 261 | // TODO configure theme and size |
262 | const char *cursor_theme = "default"; | 262 | const char *cursor_theme = NULL; |
263 | 263 | ||
264 | if (!seat->cursor->xcursor_manager) { | 264 | if (!seat->cursor->xcursor_manager) { |
265 | seat->cursor->xcursor_manager = | 265 | seat->cursor->xcursor_manager = |
266 | wlr_xcursor_manager_create("default", 24); | 266 | wlr_xcursor_manager_create(cursor_theme, 24); |
267 | if (sway_assert(seat->cursor->xcursor_manager, | 267 | if (sway_assert(seat->cursor->xcursor_manager, |
268 | "Cannot create XCursor manager for theme %s", | 268 | "Cannot create XCursor manager for theme %s", |
269 | cursor_theme)) { | 269 | cursor_theme)) { |
diff --git a/sway/server.c b/sway/server.c index 728e624e..9c1671c3 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <wlr/types/wlr_layer_shell.h> | 11 | #include <wlr/types/wlr_layer_shell.h> |
12 | #include <wlr/types/wlr_screenshooter.h> | 12 | #include <wlr/types/wlr_screenshooter.h> |
13 | #include <wlr/types/wlr_wl_shell.h> | 13 | #include <wlr/types/wlr_wl_shell.h> |
14 | #include <wlr/types/wlr_xcursor_manager.h> | ||
14 | #include <wlr/util/log.h> | 15 | #include <wlr/util/log.h> |
15 | // TODO WLR: make Xwayland optional | 16 | // TODO WLR: make Xwayland optional |
16 | #include <wlr/xwayland.h> | 17 | #include <wlr/xwayland.h> |
@@ -78,6 +79,18 @@ bool server_init(struct sway_server *server) { | |||
78 | // TODO: call server_ready now if xwayland is not enabled | 79 | // TODO: call server_ready now if xwayland is not enabled |
79 | server->xwayland_ready.notify = server_ready; | 80 | server->xwayland_ready.notify = server_ready; |
80 | 81 | ||
82 | // TODO: configurable cursor theme and size | ||
83 | server->xcursor_manager = wlr_xcursor_manager_create(NULL, 24); | ||
84 | wlr_xcursor_manager_load(server->xcursor_manager, 1); | ||
85 | struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor( | ||
86 | server->xcursor_manager, "left_ptr", 1); | ||
87 | if (xcursor != NULL) { | ||
88 | struct wlr_xcursor_image *image = xcursor->images[0]; | ||
89 | wlr_xwayland_set_cursor(server->xwayland, image->buffer, | ||
90 | image->width * 4, image->width, image->height, image->hotspot_x, | ||
91 | image->hotspot_y); | ||
92 | } | ||
93 | |||
81 | server->wl_shell = wlr_wl_shell_create(server->wl_display); | 94 | server->wl_shell = wlr_wl_shell_create(server->wl_display); |
82 | wl_signal_add(&server->wl_shell->events.new_surface, | 95 | wl_signal_add(&server->wl_shell->events.new_surface, |
83 | &server->wl_shell_surface); | 96 | &server->wl_shell_surface); |