aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sway/server.h1
-rw-r--r--sway/input/seat.c4
-rw-r--r--sway/server.c13
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 <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_screenshooter.h>
#include <wlr/types/wlr_wl_shell.h>
+#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/util/log.h>
// TODO WLR: make Xwayland optional
#include <wlr/xwayland.h>
@@ -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);