From b237fa0b22d36e52fc0be7fe785e02ea1d2456f7 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 31 Mar 2018 00:13:26 -0400 Subject: Set xwayland cursor --- include/sway/server.h | 1 + sway/input/seat.c | 4 ++-- 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 { struct wl_listener xdg_shell_v6_surface; struct wlr_xwayland *xwayland; + struct wlr_xcursor_manager *xcursor_manager; struct wl_listener xwayland_surface; struct wl_listener xwayland_ready; 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, void sway_seat_configure_xcursor(struct sway_seat *seat) { // TODO configure theme and size - const char *cursor_theme = "default"; + const char *cursor_theme = NULL; if (!seat->cursor->xcursor_manager) { seat->cursor->xcursor_manager = - wlr_xcursor_manager_create("default", 24); + wlr_xcursor_manager_create(cursor_theme, 24); if (sway_assert(seat->cursor->xcursor_manager, "Cannot create XCursor manager for theme %s", 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 @@ #include #include #include +#include #include // TODO WLR: make Xwayland optional #include @@ -78,6 +79,18 @@ bool server_init(struct sway_server *server) { // TODO: call server_ready now if xwayland is not enabled server->xwayland_ready.notify = server_ready; + // TODO: configurable cursor theme and size + server->xcursor_manager = wlr_xcursor_manager_create(NULL, 24); + wlr_xcursor_manager_load(server->xcursor_manager, 1); + struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor( + server->xcursor_manager, "left_ptr", 1); + if (xcursor != NULL) { + struct wlr_xcursor_image *image = xcursor->images[0]; + wlr_xwayland_set_cursor(server->xwayland, image->buffer, + image->width * 4, image->width, image->height, image->hotspot_x, + image->hotspot_y); + } + server->wl_shell = wlr_wl_shell_create(server->wl_display); wl_signal_add(&server->wl_shell->events.new_surface, &server->wl_shell_surface); -- cgit v1.2.3-54-g00ecf