tReposition adopted window within the screen boundaries - glazier - window management experiments
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 71849f9ba305db6903b744fb882ea3037c234918
 (DIR) parent 1381df75ab1a023b7fd2b8e082a8822dfe3e700f
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Mon, 15 Jun 2020 13:30:39 +0200
       
       Reposition adopted window within the screen boundaries
       
       Diffstat:
         M glazier.c                           |       3 ++-
       
       1 file changed, 2 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/glazier.c b/glazier.c
       t@@ -144,6 +144,7 @@ adopt(xcb_window_t wid)
        
                x = wm_get_attribute(wid, ATTR_X);
                y = wm_get_attribute(wid, ATTR_Y);
       +        m = monitor(x, y);
        
                if (!wm_is_mapped(wid)) {
                        w = wm_get_attribute(wid, ATTR_W);
       t@@ -156,7 +157,7 @@ adopt(xcb_window_t wid)
                                y = MAX(m->y, y - h/2);
                        }
        
       -                wm_teleport(wid, x, y, w, h);
       +                wm_teleport(wid, MAX(m->x, x), MAX(m->y, y), w, h);
                }
        
                return wm_reg_window_event(wid, XCB_EVENT_MASK_ENTER_WINDOW