mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
xdg-deco: Respect decoration requests properly
Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
parent
60547cffe6
commit
89f09567f5
3 changed files with 25 additions and 8 deletions
|
|
@ -4,6 +4,7 @@
|
|||
struct xdg_deco {
|
||||
struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration;
|
||||
struct server *server;
|
||||
struct view *view;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener request_mode;
|
||||
};
|
||||
|
|
@ -21,15 +22,19 @@ xdg_deco_destroy(struct wl_listener *listener, void *data)
|
|||
static void
|
||||
xdg_deco_request_mode(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct xdg_deco *xdg_deco;
|
||||
xdg_deco = wl_container_of(listener, xdg_deco, request_mode);
|
||||
enum wlr_xdg_toplevel_decoration_v1_mode mode;
|
||||
if (rc.xdg_shell_server_side_deco) {
|
||||
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||
} else {
|
||||
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
|
||||
struct xdg_deco *xdg_deco = wl_container_of(listener, xdg_deco, request_mode);
|
||||
enum wlr_xdg_toplevel_decoration_v1_mode client_mode =
|
||||
xdg_deco->wlr_decoration->requested_mode;
|
||||
|
||||
if (client_mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_NONE) {
|
||||
client_mode = rc.xdg_shell_server_side_deco
|
||||
? WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
|
||||
: WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
|
||||
}
|
||||
wlr_xdg_toplevel_decoration_v1_set_mode(xdg_deco->wlr_decoration, mode);
|
||||
|
||||
wlr_xdg_toplevel_decoration_v1_set_mode(xdg_deco->wlr_decoration, client_mode);
|
||||
view_set_decorations(xdg_deco->view,
|
||||
client_mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -44,10 +49,12 @@ xdg_toplevel_decoration(struct wl_listener *listener, void *data)
|
|||
}
|
||||
xdg_deco->wlr_decoration = wlr_decoration;
|
||||
xdg_deco->server = server;
|
||||
xdg_deco->view = wlr_decoration->surface->data;
|
||||
xdg_deco->destroy.notify = xdg_deco_destroy;
|
||||
wl_signal_add(&wlr_decoration->events.destroy, &xdg_deco->destroy);
|
||||
xdg_deco->request_mode.notify = xdg_deco_request_mode;
|
||||
wl_signal_add(&wlr_decoration->events.request_mode,
|
||||
&xdg_deco->request_mode);
|
||||
|
||||
xdg_deco_request_mode(&xdg_deco->request_mode, wlr_decoration);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue