summaryrefslogtreecommitdiff
path: root/schewm.c
diff options
context:
space:
mode:
authorSamuel Fadel <samuel@nihil.ws>2022-12-05 18:08:29 +0100
committerSamuel Fadel <samuel@nihil.ws>2022-12-05 18:08:29 +0100
commitd392ddc266251bca30a7df1a4060f5dbda3a4cf6 (patch)
tree83a5e7e9232eb9a8d7602607882e564e0cb4b151 /schewm.c
parentbe35a3e1a5f4e7c4212f6132f088fbfc8cf3e381 (diff)
Refactor logic to ignore certain clients.
* schewm.c: Extract client-ignoring logic into the dpy_should_ignore_window function.
Diffstat (limited to 'schewm.c')
-rw-r--r--schewm.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/schewm.c b/schewm.c
index 8a03fd7..87cfbab 100644
--- a/schewm.c
+++ b/schewm.c
@@ -1351,8 +1351,8 @@ dpy_fetch_cursor_position(struct Point *p) {
return true;
}
-struct Client *
-dpy_make_client(xcb_window_t window) {
+static bool
+dpy_should_ignore_window(xcb_window_t window) {
xcb_ewmh_get_atoms_reply_t window_type;
xcb_get_property_cookie_t cookie =
xcb_ewmh_get_wm_window_type(dpy.ewmh, window);
@@ -1361,9 +1361,9 @@ dpy_make_client(xcb_window_t window) {
cookie,
&window_type,
NULL);
+ bool should_ignore = false;
if (reply) {
// Figure out from window type if we should ignore it
- bool should_ignore = false;
for (uint32_t i = 0; i < window_type.atoms_len; i++) {
xcb_atom_t atom = window_type.atoms[i];
if (atom == dpy.ewmh->_NET_WM_WINDOW_TYPE_TOOLBAR
@@ -1375,9 +1375,14 @@ dpy_make_client(xcb_window_t window) {
}
}
xcb_ewmh_get_atoms_reply_wipe(&window_type);
- if (should_ignore) {
- return NULL;
- }
+ }
+ return should_ignore;
+}
+
+struct Client *
+dpy_make_client(xcb_window_t window) {
+ if (dpy_should_ignore_window(window)) {
+ return NULL;
}
uint32_t event_mask[] = { XCB_EVENT_MASK_ENTER_WINDOW, XCB_NONE };