commit: 4eac48b7072882cdd5b0513442f0ac35e6080ea6
parent 95ba44890a51bffb1516ebe043f7ebb51f7c1bca
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 3 Mar 2022 21:36:16 +0100
wlroots 0.15 compatibility
Diffstat:
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/inaban.c b/inaban.c
@@ -60,10 +60,8 @@ keyboard_handle_key(struct wl_listener *listener, void *data)
if(server->locked == true)
{
- if(
- (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) &&
- (keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12)
- )
+ if((event->state == WL_KEYBOARD_KEY_STATE_PRESSED) &&
+ (keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12))
{
struct wlr_session *session = wlr_backend_get_session(server->backend);
if(session)
@@ -532,7 +530,10 @@ output_frame(struct wl_listener *listener, void *data)
clock_gettime(CLOCK_MONOTONIC, &now);
/* wlr_output_attach_render makes the OpenGL context current. */
- if(!wlr_output_attach_render(output->wlr_output, NULL)) return;
+ if(!wlr_output_attach_render(output->wlr_output, NULL))
+ {
+ return;
+ }
/* The "effective" resolution can change if you rotate your outputs. */
int width, height;
wlr_output_effective_resolution(output->wlr_output, &width, &height);
@@ -583,7 +584,8 @@ output_frame(struct wl_listener *listener, void *data)
static void
handle_output_mode(struct wl_listener *listener, void *data)
{
- struct inaban_output *output = wl_container_of(listener, output, mode);
+ (void)data;
+ struct inaban_output *output = wl_container_of(listener, output, mode);
struct wlr_output *wlr_output = output->wlr_output;
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
@@ -605,7 +607,8 @@ server_new_output(struct wl_listener *listener, void *data)
/* Allocates and configures our state for this output */
struct inaban_output *output = calloc(1, sizeof(struct inaban_output));
- if(output == NULL) {
+ if(output == NULL)
+ {
wlr_log_errno(WLR_ERROR, "Unable to allocate inaban output");
return;
}
@@ -616,8 +619,10 @@ server_new_output(struct wl_listener *listener, void *data)
wlr_output_set_mode(wlr_output, mode);
}
- output->wlr_output = wlr_output;
- output->server = server;
+ wlr_output_init_render(wlr_output, server->allocator, server->renderer);
+
+ output->wlr_output = wlr_output;
+ output->server = server;
/* Sets up a listener for the frame notify event. */
output->frame.notify = output_frame;
wl_signal_add(&wlr_output->events.frame, &output->frame);
@@ -825,7 +830,16 @@ main(int argc, char *argv[])
/* 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. */
- server.renderer = wlr_backend_get_renderer(server.backend);
+ server.renderer = wlr_renderer_autocreate(server.backend);
+ if(!server.renderer)
+ {
+ wlr_log(WLR_ERROR, "Failed to create renderer");
+ ret = 1;
+ goto end;
+ }
+
+ server.allocator = wlr_allocator_autocreate(server.backend, server.renderer);
+
wlr_renderer_init_wl_display(server.renderer, server.wl_display);
/* This creates some hands-off wlroots interfaces. The compositor is
diff --git a/inaban.h b/inaban.h
@@ -14,6 +14,7 @@
// unstable wlroots interfaces
#define WLR_USE_UNSTABLE
#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>
@@ -51,6 +52,7 @@ struct inaban_server
struct wl_display *wl_display;
struct wlr_backend *backend;
struct wlr_renderer *renderer;
+ struct wlr_allocator *allocator;
struct wlr_xdg_shell *xdg_shell;
struct wl_listener new_xdg_surface;