tEnsure window pops on the same monitor as mouse pointer - glazier - window management experiments
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 7dbc157ea87332b031f4b9055c86a1b6d885ecc9
DIR parent 2a1185aafa91b236b58db09e727327ffb0f6345c
HTML Author: Willy Goiffon <dev@z3bra.org>
Date: Tue, 9 Jun 2020 21:09:13 +0200
Ensure window pops on the same monitor as mouse pointer
Diffstat:
M glazier.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
DIR diff --git a/glazier.c b/glazier.c
t@@ -137,6 +137,7 @@ int
adopt(xcb_window_t wid)
{
int x, y, w, h;
+ struct geom_t *m;
if (wm_is_ignored(wid))
return -1;
t@@ -150,11 +151,12 @@ adopt(xcb_window_t wid)
if (!x && !y) {
wm_get_cursor(0, scrn->root, &x, &y);
- x = MAX(0, x - w/2);
- y = MAX(0, y - h/2);
+ m = monitor(x, y);
+ x = MAX(m->x, x - w/2);
+ y = MAX(m->y, y - h/2);
}
- wm_teleport(wid, MAX(0, x), MAX(0, y), w, h);
+ wm_teleport(wid, x, y, w, h);
}
return wm_reg_window_event(wid, XCB_EVENT_MASK_ENTER_WINDOW