Revert "nuke CSDs, hopefully for good!"

The compositor must respond to the client requesting a change to the decoration
mode, it does not matter if the compositor chooses a different mode.

This reverts commit 9071ce6c84.
This commit is contained in:
Leonardo Hernández Hernández 2023-12-08 12:52:46 -06:00
parent a71b368483
commit 396840cdf2
Failed to generate hash of commit

30
dwl.c
View file

@ -264,12 +264,14 @@ static void destroylocksurface(struct wl_listener *listener, void *data);
static void destroynotify(struct wl_listener *listener, void *data); static void destroynotify(struct wl_listener *listener, void *data);
static void destroysessionlock(struct wl_listener *listener, void *data); static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionmgr(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data);
static void destroyxdeco(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir); static Monitor *dirtomon(enum wlr_direction dir);
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
static Client *focustop(Monitor *m); static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data); static void fullscreennotify(struct wl_listener *listener, void *data);
static void getxdecomode(struct wl_listener *listener, void *data);
static void handlesig(int signo); static void handlesig(int signo);
static void incnmaster(const Arg *arg); static void incnmaster(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
@ -741,8 +743,13 @@ commitnotify(struct wl_listener *listener, void *data)
void void
createdecoration(struct wl_listener *listener, void *data) createdecoration(struct wl_listener *listener, void *data)
{ {
struct wlr_xdg_toplevel_decoration_v1 *dec = data; struct wlr_xdg_toplevel_decoration_v1 *wlr_deco = data;
wlr_xdg_toplevel_decoration_v1_set_mode(dec, WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); Decoration *d = wlr_deco->data = calloc(1, sizeof(*d));
LISTEN(&wlr_deco->events.request_mode, &d->request_mode, getxdecomode);
LISTEN(&wlr_deco->events.destroy, &d->destroy, destroyxdeco);
getxdecomode(&d->request_mode, wlr_deco);
} }
void void
@ -1124,6 +1131,17 @@ destroysessionmgr(struct wl_listener *listener, void *data)
wl_list_remove(&listener->link); wl_list_remove(&listener->link);
} }
void
destroyxdeco(struct wl_listener *listener, void *data)
{
struct wlr_xdg_toplevel_decoration_v1 *wlr_deco = data;
Decoration *d = wlr_deco->data;
wl_list_remove(&d->destroy.link);
wl_list_remove(&d->request_mode.link);
free(d);
}
Monitor * Monitor *
dirtomon(enum wlr_direction dir) dirtomon(enum wlr_direction dir)
{ {
@ -1274,6 +1292,14 @@ fullscreennotify(struct wl_listener *listener, void *data)
setfullscreen(c, client_wants_fullscreen(c)); setfullscreen(c, client_wants_fullscreen(c));
} }
void
getxdecomode(struct wl_listener *listener, void *data)
{
struct wlr_xdg_toplevel_decoration_v1 *wlr_deco = data;
wlr_xdg_toplevel_decoration_v1_set_mode(wlr_deco,
WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
void void
handlesig(int signo) handlesig(int signo)
{ {