summaryrefslogtreecommitdiff
path: root/x-placement-manager.c
diff options
context:
space:
mode:
authorPatrick Haller <patrick@haller.ws>2011-03-10 21:50:15 +0800
committerPatrick Haller <patrick@haller.ws>2011-03-10 21:50:15 +0800
commitea30e4af52cf4b17aac63135933c4e0d09725eb3 (patch)
treef90a923785414309e59d96d17906b36b97f03dfe /x-placement-manager.c
parent6de9cba0d3daf0795c646dfd98e065a4a67baca8 (diff)
resize when window larger than root, added transient hinting
Diffstat (limited to 'x-placement-manager.c')
-rw-r--r--x-placement-manager.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/x-placement-manager.c b/x-placement-manager.c
index 2cd51b5..06afcd7 100644
--- a/x-placement-manager.c
+++ b/x-placement-manager.c
@@ -19,6 +19,7 @@ place_center(Display *d, XEvent *e) {
static XWindowAttributes r_wa;
static XWindowAttributes c_wa;
Window r = DefaultRootWindow(d);
+ Window trans = None;
XMapRequestEvent *ev = &e->xmaprequest;
int x, y;
@@ -28,13 +29,18 @@ place_center(Display *d, XEvent *e) {
return;
if (c_wa.override_redirect)
return;
+ if(XGetTransientForHint(d, ev->window, &trans))
+ return;
x = r_wa.width/2 - c_wa.width/2;
y = r_wa.height/2 - c_wa.height/2;
if (x < 0)
x = 0;
if (y < 0)
y = 0;
- XMoveWindow(d, ev->window, x, y);
+ XMoveResizeWindow(d, ev->window, x, y,
+ c_wa.width > r_wa.width ? r_wa.width : c_wa.width,
+ c_wa.height > r_wa.height ? r_wa.height : c_wa.height
+ );
}
int