tAllow adoption of unmapped window that are not at 0,0 - glazier - window management experiments
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit 4c4ef91cd4ea38c34a3c3aff3a13821dc6c481ea
(DIR) parent 68bc59b3e941b1684c8c27847aef013b65a8b50b
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Wed, 27 Nov 2019 13:46:04 +0100
Allow adoption of unmapped window that are not at 0,0
Diffstat:
M glazier.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/glazier.c b/glazier.c
t@@ -125,10 +125,16 @@ adopt(xcb_window_t wid)
x = wm_get_attribute(wid, ATTR_X);
y = wm_get_attribute(wid, ATTR_Y);
- if (!wm_is_mapped(wid) && !x && !y) {
+
+ if (!wm_is_mapped(wid)) {
w = wm_get_attribute(wid, ATTR_W);
h = wm_get_attribute(wid, ATTR_H);
- wm_get_cursor(0, scrn->root, &x, &y);
+
+ if (!x && !y) {
+ wm_get_cursor(0, scrn->root, &x, &y);
+ x = MAX(0, x - w/2);
+ y = MAX(0, y - h/2);
+ }
/* prevent windows to pop outside of the screen */
sw = wm_get_attribute(scrn->root, ATTR_W);
t@@ -136,7 +142,7 @@ adopt(xcb_window_t wid)
if ((x + w) > sw) x = sw - w/2;
if ((y + h) > sh) y = sh - h/2;
- wm_teleport(wid, MAX(0, x - w/2), MAX(0, y - h/2), w, h);
+ wm_teleport(wid, MAX(0, x), MAX(0, y), w, h);
}
return wm_reg_window_event(wid, XCB_EVENT_MASK_ENTER_WINDOW