From 2ea9724f7bd0ab2024f6b94dcfdb832b3facded8 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Mon, 13 Nov 2023 21:17:55 +0100 Subject: Configure wm struts --- x11.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/x11.c b/x11.c index 36b2f9d..551e7d7 100644 --- a/x11.c +++ b/x11.c @@ -175,6 +175,37 @@ static void wm_set_size(Window *win) log_debug("Xcb icccm updated size hints"); } +static void wm_set_struts(Window *win) +{ + const uint32_t end = MAX(0, win->x + win->width - 1); + + const uint32_t values[12] = { + 0, 0, win->height, 0, // left, right, top, bottom + 0, 0, 0, 0, // left y0, left y1, right y0, right y1 + win->x, end, 0, 0, // top y0, top y1, bottom y0, bottom y1 + }; + + xcb_change_property(win->connection, + XCB_PROP_MODE_REPLACE, + win->window, + win->ewmh._NET_WM_STRUT, + XCB_ATOM_CARDINAL, + 32, + 4, + values); + + xcb_change_property(win->connection, + XCB_PROP_MODE_REPLACE, + win->window, + win->ewmh._NET_WM_STRUT_PARTIAL, + XCB_ATOM_CARDINAL, + 32, + 12, + values); + + log_debug("Xcb ewmh struts updated"); +} + static void wm_setup(Window *win) { const char *title = "comet"; @@ -205,6 +236,8 @@ static void wm_setup(Window *win) xcb_ewmh_set_wm_pid(&win->ewmh, win->window, getpid()); wm_set_size(win); + + wm_set_struts(win); } Window *window_create(void) -- cgit v1.2.3