mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
Disable CSD
This commit is contained in:
parent
7a5ebbe402
commit
fdc7b4f1f3
3 changed files with 73 additions and 1 deletions
47
xdg.c
47
xdg.c
|
|
@ -1,5 +1,52 @@
|
|||
#include "labwc.h"
|
||||
|
||||
struct xdg_deco {
|
||||
struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration;
|
||||
struct server *server;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener request_mode;
|
||||
};
|
||||
|
||||
static void xdg_deco_destroy(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct xdg_deco *xdg_deco =
|
||||
wl_container_of(listener, xdg_deco, destroy);
|
||||
|
||||
wl_list_remove(&xdg_deco->destroy.link);
|
||||
wl_list_remove(&xdg_deco->request_mode.link);
|
||||
free(xdg_deco);
|
||||
}
|
||||
|
||||
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 (LAB_DISABLE_CSD)
|
||||
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||
else
|
||||
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
|
||||
wlr_xdg_toplevel_decoration_v1_set_mode(xdg_deco->wlr_decoration, mode);
|
||||
}
|
||||
|
||||
void xdg_toplevel_decoration(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct server *server =
|
||||
wl_container_of(listener, server, xdg_toplevel_decoration);
|
||||
struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration = data;
|
||||
struct xdg_deco *xdg_deco = calloc(1, sizeof(struct xdg_deco));
|
||||
if (!xdg_deco)
|
||||
return;
|
||||
xdg_deco->wlr_decoration = wlr_decoration;
|
||||
xdg_deco->server = server;
|
||||
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);
|
||||
}
|
||||
|
||||
void xdg_surface_map(struct wl_listener *listener, void *data)
|
||||
{
|
||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue