From 45aab7c7b438698cfd6ca588116a12c5b54540f0 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 26 May 2016 19:07:24 +0200 Subject: [PATCH] client: Make sure we use pre-ICCCM fields Bug: 12587 If the client doesn't place its window on map but provides a size/position, we might use that. Signed-off-by: Olivier Fourdan --- src/client.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/client.c b/src/client.c index 652a75e..2f4bfc1 100644 --- a/src/client.c +++ b/src/client.c @@ -1124,6 +1124,20 @@ clientGetWMNormalHints (Client *c, gboolean update) wc.width = c->width; wc.height = c->height; + if (c->size->flags & (PPosition | USPosition)) + { + c->size->flags &= ~(PPosition | USPosition); + wc.x = c->size->x; + wc.y = c->size->y; + } + + if (c->size->flags & USSize) + { + c->size->flags &= ~USSize; + wc.width = c->size->width; + wc.height = c->size->height; + } + if (!(c->size->flags & PMaxSize)) { c->size->max_width = G_MAXINT; @@ -1229,6 +1243,11 @@ clientGetWMNormalHints (Client *c, gboolean update) wc.height = c->size->min_height; } + c->size->x = wc.x; + c->size->y = wc.y; + c->size->width = wc.width; + c->size->height = wc.height; + if ((c->size->min_width < c->size->max_width) || (c->size->min_height < c->size->max_height)) { @@ -1252,6 +1271,8 @@ clientGetWMNormalHints (Client *c, gboolean update) } else { + c->x = wc.x; + c->y = wc.y; c->width = wc.width; c->height = wc.height; } @@ -1682,10 +1703,6 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture) clientGetWMNormalHints (c, FALSE); clientGetMWMHints (c); - c->size->x = c->x; - c->size->y = c->y; - c->size->width = c->width; - c->size->height = c->height; c->previous_width = -1; c->previous_height = -1; c->border_width = attr.border_width; @@ -2040,6 +2057,7 @@ clientUnframe (Client *c, gboolean remap) clientUngrabButtons (c); XUnmapWindow (display_info->dpy, c->frame); clientCoordGravitate (c, c->gravity, REMOVE, &c->x, &c->y); + XSetWMNormalHints(display_info->dpy, c->window, c->size); XSelectInput (display_info->dpy, c->window, NoEventMask); XChangeSaveSet(display_info->dpy, c->window, SetModeDelete); -- 2.7.4