diff options
author | Leonardo Hernández Hernández <leohdz172@proton.me> | 2023-12-08 12:52:46 -0600 |
---|---|---|
committer | Leonardo Hernández Hernández <leohdz172@proton.me> | 2023-12-18 12:56:20 -0600 |
commit | 396840cdf215b4affea28ac39f10f0011da94ed9 (patch) | |
tree | a63f839ca422f1a36eae888f81bd556d27dd037c | |
parent | a71b368483909ab030fe3ccbbbf8d320b2d5f2dd (diff) |
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 9071ce6c848ce214939fb84f85ae77de86de88d7.
-rw-r--r-- | dwl.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -264,12 +264,14 @@ static void destroylocksurface(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 destroysessionmgr(struct wl_listener *listener, void *data); +static void destroyxdeco(struct wl_listener *listener, void *data); static Monitor *dirtomon(enum wlr_direction dir); static void focusclient(Client *c, int lift); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); static Client *focustop(Monitor *m); 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 incnmaster(const Arg *arg); static void inputdevice(struct wl_listener *listener, void *data); @@ -741,8 +743,13 @@ commitnotify(struct wl_listener *listener, void *data) void createdecoration(struct wl_listener *listener, void *data) { - struct wlr_xdg_toplevel_decoration_v1 *dec = data; - wlr_xdg_toplevel_decoration_v1_set_mode(dec, WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + struct wlr_xdg_toplevel_decoration_v1 *wlr_deco = data; + 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 @@ -1124,6 +1131,17 @@ destroysessionmgr(struct wl_listener *listener, void *data) 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 * dirtomon(enum wlr_direction dir) { @@ -1275,6 +1293,14 @@ fullscreennotify(struct wl_listener *listener, void *data) } 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 handlesig(int signo) { if (signo == SIGCHLD) { |