aboutsummaryrefslogtreecommitdiff
path: root/rootston/desktop.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r--rootston/desktop.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index ef7c9492..1695d007 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -10,11 +10,13 @@
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_wl_shell.h>
+#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/util/log.h>
#include <server-decoration-protocol.h>
#include "rootston/server.h"
#include "rootston/seat.h"
+#include "rootston/xcursor.h"
// TODO replace me with a signal
void view_destroy(struct roots_view *view) {
@@ -335,6 +337,16 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->server = server;
desktop->config = config;
+
+ desktop->xcursor_manager = wlr_xcursor_manager_create(NULL,
+ ROOTS_XCURSOR_SIZE);
+ if (desktop->xcursor_manager == NULL) {
+ wlr_log(L_ERROR, "Cannot create XCursor manager");
+ wlr_list_free(desktop->views);
+ free(desktop);
+ return NULL;
+ }
+
desktop->layout = wlr_output_layout_create();
desktop->compositor = wlr_compositor_create(server->wl_display,
server->renderer);
@@ -356,6 +368,18 @@ struct roots_desktop *desktop_create(struct roots_server *server,
wl_signal_add(&desktop->xwayland->events.new_surface,
&desktop->xwayland_surface);
desktop->xwayland_surface.notify = handle_xwayland_surface;
+
+ if (wlr_xcursor_manager_load(desktop->xcursor_manager, 1)) {
+ wlr_log(L_ERROR, "Cannot load XWayland XCursor theme");
+ }
+ struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
+ desktop->xcursor_manager, ROOTS_XCURSOR_DEFAULT, 1);
+ if (xcursor != NULL) {
+ struct wlr_xcursor_image *image = xcursor->images[0];
+ wlr_xwayland_set_cursor(desktop->xwayland, image->buffer,
+ image->width, image->width, image->height, image->hotspot_x,
+ image->hotspot_y);
+ }
}
#endif