From 16553162022bf17e9291c63b15be3b080deb2e84 Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Tue, 25 Feb 2020 20:13:01 -0500 Subject: [PATCH] Preparing Waybox 0.0.1 --- include/waybox/server.h | 6 ++++++ meson.build | 2 +- waybox/output.c | 10 ++++++++++ waybox/server.c | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/waybox/server.h b/include/waybox/server.h index 3a9b63a..a313f7e 100644 --- a/include/waybox/server.h +++ b/include/waybox/server.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -18,7 +19,12 @@ #include #include #include +#if WLR_VERSION_NUM > 1 +//wlroots 0.2+ #include +#else +#include +#endif #include #include diff --git a/meson.build b/meson.build index 1c728d3..e2a5f80 100644 --- a/meson.build +++ b/meson.build @@ -30,7 +30,7 @@ add_project_arguments('-DWL_HIDE_DEPRECATED', language: 'c') inc_dir = include_directories('include') pixman = dependency('pixman-1') -wlroots = dependency('wlroots', version: '>=0.6.0') +wlroots = dependency('wlroots', version: ['>=0.1.0', '<=0.8.1']) wayland_server = dependency('wayland-server') wayland_client = dependency('wayland-client') wayland_protos = dependency('wayland-protocols', version: '>=1.12') diff --git a/waybox/output.c b/waybox/output.c index b8a4332..04fd325 100644 --- a/waybox/output.c +++ b/waybox/output.c @@ -10,7 +10,12 @@ void output_frame_notify(struct wl_listener *listener, void *data) { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); +#if WLR_VERSION_NUM > 1280 + // wlroots 0.6.0+ wlr_output_attach_render(wlr_output, NULL); +#else + wlr_output_make_current(wlr_output, NULL); +#endif wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); float color[4] = {0.4f, 0.4f, 0.4f, 1.0f}; @@ -35,7 +40,12 @@ void output_frame_notify(struct wl_listener *listener, void *data) { wlr_surface_send_frame_done(surface, &now); } +#if WLR_VERSION_NUM > 1280 + // wlroots 0.6.0+ wlr_output_commit(wlr_output); +#else + wlr_output_swap_buffers(wlr_output, NULL, NULL); +#endif wlr_renderer_end(renderer); output->last_frame = now; } diff --git a/waybox/server.c b/waybox/server.c index 53772f5..ab80ba0 100644 --- a/waybox/server.c +++ b/waybox/server.c @@ -63,7 +63,12 @@ bool start_wb(struct wb_server* server) { wlr_gamma_control_manager_v1_create(server->wl_display); wlr_screencopy_manager_v1_create(server->wl_display); +#if WLR_VERSION_NUM > 1 + // wlroots 0.2+ wlr_gtk_primary_selection_device_manager_create(server->wl_display); +#else + wlr_primary_selection_device_manager_create(server->wl_display); +#endif wlr_idle_create(server->wl_display); server->compositor = wlr_compositor_create(server->wl_display,