aboutsummaryrefslogtreecommitdiff
path: root/sway/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/server.c')
-rw-r--r--sway/server.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/sway/server.c b/sway/server.c
index 728e624e..f5cc199c 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -8,9 +8,12 @@
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_gamma_control.h>
+#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_layer_shell.h>
+#include <wlr/types/wlr_primary_selection.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>
@@ -53,6 +56,7 @@ bool server_init(struct sway_server *server) {
wlr_screenshooter_create(server->wl_display);
wlr_gamma_control_manager_create(server->wl_display);
+ wlr_primary_selection_device_manager_create(server->wl_display);
server->new_output.notify = handle_new_output;
wl_signal_add(&server->backend->events.new_output, &server->new_output);
@@ -67,6 +71,11 @@ bool server_init(struct sway_server *server) {
&server->xdg_shell_v6_surface);
server->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface;
+ server->wl_shell = wlr_wl_shell_create(server->wl_display);
+ wl_signal_add(&server->wl_shell->events.new_surface,
+ &server->wl_shell_surface);
+ server->wl_shell_surface.notify = handle_wl_shell_surface;
+
// TODO make xwayland optional
server->xwayland =
wlr_xwayland_create(server->wl_display, server->compositor);
@@ -78,10 +87,20 @@ bool server_init(struct sway_server *server) {
// TODO: call server_ready now if xwayland is not enabled
server->xwayland_ready.notify = server_ready;
- server->wl_shell = wlr_wl_shell_create(server->wl_display);
- wl_signal_add(&server->wl_shell->events.new_surface,
- &server->wl_shell_surface);
- server->wl_shell_surface.notify = handle_wl_shell_surface;
+ // 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);
+ }
+
+ struct wlr_egl *egl = wlr_backend_get_egl(server->backend);
+ wlr_linux_dmabuf_create(server->wl_display, egl);
server->socket = wl_display_add_socket_auto(server->wl_display);
if (!server->socket) {
@@ -91,7 +110,6 @@ bool server_init(struct sway_server *server) {
}
input_manager = sway_input_manager_create(server);
-
return true;
}