summaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/dwl.c b/dwl.c
index d3c93dd..d2ca5fd 100644
--- a/dwl.c
+++ b/dwl.c
@@ -13,6 +13,7 @@
#include <libinput.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
+#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
@@ -304,6 +305,7 @@ static struct wlr_backend *backend;
static struct wlr_scene *scene;
static struct wlr_scene_node *layers[NUM_LAYERS];
static struct wlr_renderer *drw;
+static struct wlr_allocator *alloc;
static struct wlr_compositor *compositor;
static struct wlr_xdg_shell *xdg_shell;
@@ -319,10 +321,6 @@ static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
static struct wlr_cursor *cursor;
static struct wlr_xcursor_manager *cursor_mgr;
-#ifdef XWAYLAND
-static struct wlr_xcursor *xcursor;
-static struct wlr_xcursor_manager *xcursor_mgr;
-#endif
static struct wlr_seat *seat;
static struct wl_list keyboards;
@@ -824,6 +822,8 @@ createmon(struct wl_listener *listener, void *data)
Monitor *m = wlr_output->data = calloc(1, sizeof(*m));
m->wlr_output = wlr_output;
+ wlr_output_init_render(wlr_output, alloc, drw);
+
/* Initialize monitor state using configured rules */
for (size_t i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -1850,12 +1850,15 @@ setup(void)
layers[LyrTop] = &wlr_scene_tree_create(&scene->node)->node;
layers[LyrOverlay] = &wlr_scene_tree_create(&scene->node)->node;
- /* If we don't provide a renderer, autocreate makes a GLES2 renderer for us.
- * The renderer is responsible for defining the various pixel formats it
- * supports for shared memory, this configures that for clients. */
- drw = wlr_backend_get_renderer(backend);
+ /* Create a renderer with the default implementation */
+ if (!(drw = wlr_renderer_autocreate(backend)))
+ BARF("couldn't create renderer");
wlr_renderer_init_wl_display(drw, dpy);
+ /* Create a default allocator */
+ if (!(alloc = wlr_allocator_autocreate(backend, drw)))
+ BARF("couldn't create allocator");
+
/* This creates some hands-off wlroots interfaces. The compositor is
* necessary for clients to allocate surfaces and the data device manager
* handles the clipboard. Each of these wlroots interfaces has room for you
@@ -1976,18 +1979,6 @@ setup(void)
wl_signal_add(&xwayland->events.ready, &xwayland_ready);
wl_signal_add(&xwayland->events.new_surface, &new_xwayland_surface);
- /*
- * Create the XWayland cursor manager at scale 1, setting its default
- * pointer to match the rest of dwl.
- */
- xcursor_mgr = wlr_xcursor_manager_create(NULL, 24);
- wlr_xcursor_manager_load(xcursor_mgr, 1);
- if ((xcursor = wlr_xcursor_manager_get_xcursor(xcursor_mgr, "left_ptr", 1)))
- wlr_xwayland_set_cursor(xwayland,
- xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
- xcursor->images[0]->width, xcursor->images[0]->height,
- xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
-
setenv("DISPLAY", xwayland->display_name, 1);
} else {
fprintf(stderr, "failed to setup XWayland X server, continuing without it\n");