aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2023-11-13 21:17:55 +0100
committerFederico Angelilli <code@fedang.net>2023-11-13 21:17:55 +0100
commit2ea9724f7bd0ab2024f6b94dcfdb832b3facded8 (patch)
treee0bbf3256767b537cb32ebf2fadabb0ccecfa816
parentec91f4c1ea7b1ef10d8bbddff5d6993ba165607e (diff)
Configure wm struts
-rw-r--r--x11.c33
1 files changed, 33 insertions, 0 deletions
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)