From b79744e7b0963a28ddfe0928ad8c089e836442a9 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Mon, 14 Feb 2022 20:20:16 +0000 Subject: [PATCH] Chase wlroots master We need it for wlr_scene_layer_surface_v1_create() --- include/labwc.h | 1 + include/layers.h | 1 - meson.build | 2 +- src/output.c | 12 ++++++------ src/server.c | 1 + src/xdg-popup.c | 13 +++++++------ src/xdg.c | 29 ++++++++++++----------------- subprojects/wlroots.wrap | 2 +- 8 files changed, 29 insertions(+), 32 deletions(-) diff --git a/include/labwc.h b/include/labwc.h index c0b9d47b..6586fc55 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/include/layers.h b/include/layers.h index 35b41090..1613020b 100644 --- a/include/layers.h +++ b/include/layers.h @@ -2,7 +2,6 @@ #ifndef __LABWC_LAYERS_H #define __LABWC_LAYERS_H #include -#include #include struct server; diff --git a/meson.build b/meson.build index 09f6f0b2..e0da463e 100644 --- a/meson.build +++ b/meson.build @@ -37,7 +37,7 @@ if git.found() endif add_project_arguments('-DLABWC_VERSION=@0@'.format(version), language: 'c') -wlroots_version = ['>=0.15.0', '<0.16.0'] +wlroots_version = ['>=0.16.0', '<0.17.0'] wlroots_proj = subproject( 'wlroots', default_options: ['default_library=static', 'examples=false'], diff --git a/src/output.c b/src/output.c index fc69a294..297e4260 100644 --- a/src/output.c +++ b/src/output.c @@ -287,12 +287,12 @@ wlr_output_configuration_v1 *create_output_config(struct server *server) wlr_output_configuration_v1_destroy(config); return NULL; } - struct wlr_box *box = - wlr_output_layout_get_box(server->output_layout, - output->wlr_output); - if (box) { - head->state.x = box->x; - head->state.y = box->y; + struct wlr_box box; + wlr_output_layout_get_box(server->output_layout, + output->wlr_output, &box); + if (!wlr_box_empty(&box)) { + head->state.x = box.x; + head->state.y = box.y; } else { wlr_log(WLR_ERROR, "failed to get output layout box"); } diff --git a/src/server.c b/src/server.c index fd59599a..171ec6dd 100644 --- a/src/server.c +++ b/src/server.c @@ -240,6 +240,7 @@ server_init(struct server *server) wlr_log(WLR_ERROR, "unable to create the wlroots compositor"); exit(EXIT_FAILURE); } + wlr_subcompositor_create(server->wl_display); struct wlr_data_device_manager *device_manager = NULL; device_manager = wlr_data_device_manager_create(server->wl_display); diff --git a/src/xdg-popup.c b/src/xdg-popup.c index 731967f2..7a466536 100644 --- a/src/xdg-popup.c +++ b/src/xdg-popup.c @@ -17,14 +17,15 @@ popup_unconstrain(struct view *view, struct wlr_xdg_popup *popup) struct wlr_output_layout *output_layout = server->output_layout; struct wlr_output *wlr_output = wlr_output_layout_output_at( output_layout, view->x + popup_box->x, view->y + popup_box->y); - struct wlr_box *output_box = wlr_output_layout_get_box( - output_layout, wlr_output); + + struct wlr_box output_box; + wlr_output_layout_get_box(output_layout, wlr_output, &output_box); struct wlr_box output_toplevel_box = { - .x = output_box->x - view->x, - .y = output_box->y - view->y, - .width = output_box->width, - .height = output_box->height, + .x = output_box.x - view->x, + .y = output_box.y - view->y, + .width = output_box.width, + .height = output_box.height, }; wlr_xdg_popup_unconstrain_from_box(popup, &output_toplevel_box); } diff --git a/src/xdg.c b/src/xdg.c index 9920d3e5..a820eacf 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -127,29 +127,23 @@ static void handle_request_minimize(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, request_minimize); - struct wlr_xdg_surface *surface = data; - if (view) { - view_minimize(view, surface->toplevel->requested.minimized); - } + view_minimize(view, view->xdg_surface->toplevel->requested.minimized); } static void handle_request_maximize(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, request_maximize); - struct wlr_xdg_surface *surface = data; - if (view) { - view_maximize(view, surface->toplevel->requested.maximized); - } - + view_maximize(view, view->xdg_surface->toplevel->requested.maximized); } static void handle_request_fullscreen(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, request_fullscreen); - struct wlr_xdg_toplevel_set_fullscreen_event *e = data; - view_set_fullscreen(view, e->fullscreen, e->output); + view_set_fullscreen(view, + view->xdg_surface->toplevel->requested.fullscreen, + view->xdg_surface->toplevel->requested.fullscreen_output); } static void @@ -182,7 +176,7 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo) view->pending_move_resize.width = MAX(geo.width, min_width); view->pending_move_resize.height = MAX(geo.height, min_height); - uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_surface, + uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_surface->toplevel, (uint32_t)geo.width, (uint32_t)geo.height); if (serial > 0) { view->pending_move_resize.configure_serial = serial; @@ -207,7 +201,7 @@ xdg_toplevel_view_move(struct view *view, double x, double y) static void xdg_toplevel_view_close(struct view *view) { - wlr_xdg_toplevel_send_close(view->xdg_surface); + wlr_xdg_toplevel_send_close(view->xdg_surface->toplevel); } static void @@ -222,7 +216,7 @@ update_padding(struct view *view) static void xdg_toplevel_view_maximize(struct view *view, bool maximized) { - wlr_xdg_toplevel_set_maximized(view->xdg_surface, maximized); + wlr_xdg_toplevel_set_maximized(view->xdg_surface->toplevel, maximized); } static void @@ -230,14 +224,14 @@ xdg_toplevel_view_set_activated(struct view *view, bool activated) { struct wlr_xdg_surface *surface = view->xdg_surface; if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { - wlr_xdg_toplevel_set_activated(surface, activated); + wlr_xdg_toplevel_set_activated(surface->toplevel, activated); } } static void xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen) { - wlr_xdg_toplevel_set_fullscreen(view->xdg_surface, fullscreen); + wlr_xdg_toplevel_set_fullscreen(view->xdg_surface->toplevel, fullscreen); } static bool @@ -251,7 +245,8 @@ parent_of(struct view *view) { struct view *p; wl_list_for_each (p, &view->server->views, link) { - if (p->xdg_surface == view->xdg_surface->toplevel->parent) { + if (p->xdg_surface->toplevel + == view->xdg_surface->toplevel->parent) { return p; } } diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index 314d2c36..3c65aaac 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,3 +1,3 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = 0.15.1 +revision = master