tUse wm_teleport() to place newly created windows - glazier - window management experiments
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit 1e0105946562c0933f2a57d7d0d805ff7aa215da
(DIR) parent 309eeffbd388bf4e609ac2a97255833324351ed7
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Sun, 27 Oct 2019 08:10:41 +0100
Use wm_teleport() to place newly created windows
wm_move() is a wrapper around wm_teleport() that prevent moving it
outside the screen.
This wrapper also performs different checks, and won't move a window that
is not mapped on screen (which is exactly what we're trying to do here).
Using wm_teleport() directly bypasses this limitation.
Diffstat:
M glazier.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/glazier.c b/glazier.c
t@@ -113,11 +113,14 @@ adopt(xcb_window_t wid)
{
int x, y, w, h;
+ if (wm_is_ignored(wid))
+ return -1;
+
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);
- wm_move(wid, ABSOLUTE, x - w/2, y - h/2);
+ wm_teleport(wid, MAX(0, x - w/2), MAX(0, y - h/2), w, h);
}
wm_reg_window_event(wid, XCB_EVENT_MASK_ENTER_WINDOW