aboutsummaryrefslogtreecommitdiffstats
path: root/sway/server.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-10-17 21:10:30 +0200
committerLibravatar emersion <contact@emersion.fr>2018-10-17 21:10:30 +0200
commitfd9198a3a4f50b62a66f65780985ddf0a5cdf895 (patch)
treefc6b9ec4e101ad9ab271a0f9485b840d88d42272 /sway/server.c
parentMerge pull request #2858 from RyanDwyer/fix-move-to-floating-ws (diff)
downloadsway-fd9198a3a4f50b62a66f65780985ddf0a5cdf895.tar.gz
sway-fd9198a3a4f50b62a66f65780985ddf0a5cdf895.tar.zst
sway-fd9198a3a4f50b62a66f65780985ddf0a5cdf895.zip
Export XCURSOR_SIZE and XCURSOR_THEME
These can be used by toolkits (currently Qt, libxcursor, glfw) to choose a default cursor theme and size. This backports this rootston commit: https://github.com/swaywm/wlroots/pull/1294/commits/3a181ab430997aaf03a75cbe3b79b0fc56ec96c3
Diffstat (limited to 'sway/server.c')
-rw-r--r--sway/server.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sway/server.c b/sway/server.c
index 63bfa7e1..1fd7b7fa 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -83,6 +83,17 @@ bool server_init(struct sway_server *server) {
83 &server->xdg_shell_surface); 83 &server->xdg_shell_surface);
84 server->xdg_shell_surface.notify = handle_xdg_shell_surface; 84 server->xdg_shell_surface.notify = handle_xdg_shell_surface;
85 85
86 // TODO: configurable cursor theme and size
87 int cursor_size = 24;
88 const char *cursor_theme = NULL;
89
90 char cursor_size_fmt[16];
91 snprintf(cursor_size_fmt, sizeof(cursor_size_fmt), "%d", cursor_size);
92 setenv("XCURSOR_SIZE", cursor_size_fmt, 1);
93 if (cursor_theme != NULL) {
94 setenv("XCURSOR_THEME", cursor_theme, 1);
95 }
96
86#ifdef HAVE_XWAYLAND 97#ifdef HAVE_XWAYLAND
87 server->xwayland.wlr_xwayland = 98 server->xwayland.wlr_xwayland =
88 wlr_xwayland_create(server->wl_display, server->compositor, true); 99 wlr_xwayland_create(server->wl_display, server->compositor, true);
@@ -93,8 +104,8 @@ bool server_init(struct sway_server *server) {
93 &server->xwayland_ready); 104 &server->xwayland_ready);
94 server->xwayland_ready.notify = handle_xwayland_ready; 105 server->xwayland_ready.notify = handle_xwayland_ready;
95 106
96 // TODO: configurable cursor theme and size 107 server->xwayland.xcursor_manager =
97 server->xwayland.xcursor_manager = wlr_xcursor_manager_create(NULL, 24); 108 wlr_xcursor_manager_create(cursor_theme, cursor_size);
98 wlr_xcursor_manager_load(server->xwayland.xcursor_manager, 1); 109 wlr_xcursor_manager_load(server->xwayland.xcursor_manager, 1);
99 struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor( 110 struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
100 server->xwayland.xcursor_manager, "left_ptr", 1); 111 server->xwayland.xcursor_manager, "left_ptr", 1);