summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xwindow.c29
-rw-r--r--src/xwindow.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/src/xwindow.c b/src/xwindow.c
index 18ebf5f..a682e9f 100644
--- a/src/xwindow.c
+++ b/src/xwindow.c
@@ -109,6 +109,35 @@ void vwm_xwin_setup_chart(vwm_t *vwm, vwm_xwindow_t *xwin)
}
}
+/* override_redirect windows typically should not be managed, and it'd be nice if we could
+ * just blindly respect that, but X is a dumpster fire and for multiple reasons I'm going
+ * to use some heuristics to only not manage override_redirect windows when they're substantially
+ * smaller than the size of the display (popup/popover type shit).
+ *
+ * When any old X client can create a fullscreen override_redirect window it not only makes
+ * fullscreen games and shit not explicitly focusable/managable from a vwm perspective, it
+ * also creates a real potential security issue.
+ */
+int vwm_xwin_should_manage(vwm_t *vwm, vwm_xwindow_t *xwin)
+{
+ const vwm_screen_t *scr;
+
+ if (!xwin->attrs.override_redirect)
+ return 1;
+
+ scr = vwm_screen_find(vwm, VWM_SCREEN_REL_XWIN, xwin);
+ if (!scr)
+ return 1;
+
+ /* TODO: for now just using an exact fullscreen heuristic, but should really
+ * trigger for > XX% coverage. This suffices for managing annoying
+ * override_redirect fullscreen windows.
+ */
+ if (xwin->attrs.width == scr->width && xwin->attrs.height == scr->height)
+ return 1;
+
+ return 0;
+}
/* creates and potentially manages a new window (called in response to CreateNotify events, and during startup for all existing windows) */
/* if the window is already mapped and not an override_redirect window, it becomes managed here. */
diff --git a/src/xwindow.h b/src/xwindow.h
index 1318421..65d0725 100644
--- a/src/xwindow.h
+++ b/src/xwindow.h
@@ -41,6 +41,7 @@ void vwm_xwin_message(vwm_t *vwm, vwm_xwindow_t *xwin, Atom type, long foo);
vwm_xwindow_t * vwm_xwin_lookup(vwm_t *vwm, Window win);
int vwm_xwin_is_mapped(vwm_t *vwm, vwm_xwindow_t *xwin);
void vwm_xwin_monitor(vwm_t *vwm, vwm_xwindow_t *xwin);
+int vwm_xwin_should_manage(vwm_t *vwm, vwm_xwindow_t *xwin);
vwm_xwindow_t * vwm_xwin_create(vwm_t *vwm, Window win, vwm_grab_mode_t grabbed);
void vwm_xwin_destroy(vwm_t *vwm, vwm_xwindow_t *xwin);
void vwm_xwin_restack(vwm_t *vwm, vwm_xwindow_t *xwin, Window new_above);
© All Rights Reserved