From 214b5a4a31936c398b83b340ef56ebab632c1c2a Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 26 Mar 2008 10:57:06 +0100 Subject: [PATCH] [titlebar] Fix resize_hints usage with titlebar - titlebar_update_geometry() give now void - we call titlebar_update_geometry_floating() to reset correctly the titlebar position for right/bottom, so they will be stucked to the window Signed-off-by: Julien Danjou --- client.c | 15 ++++++++++++--- titlebar.c | 8 +++----- titlebar.h | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client.c b/client.c index 3dbfcef8..7b105d81 100644 --- a/client.c +++ b/client.c @@ -500,12 +500,15 @@ client_resize(Client *c, area_t geometry, Bool hints) XWindowChanges wc; Layout *layout = layout_get_current(c->screen); + if(!c->ismoving && !c->isfloating && layout->arrange != layout_floating) + { + titlebar_update_geometry(c, geometry); + geometry = titlebar_geometry_remove(&c->titlebar, geometry); + } + if(hints) geometry = client_geometry_hints(c, geometry); - if(!c->ismoving && !c->isfloating && layout->arrange != layout_floating) - geometry = titlebar_update_geometry(c, geometry); - if(geometry.width <= 0 || geometry.height <= 0) return False; @@ -543,6 +546,12 @@ client_resize(Client *c, area_t geometry, Bool hints) c->f_geometry = geometry; titlebar_update_geometry_floating(c); } + /* call it again like it was floating, + * because for right or bottom titlebar, + * we want it to be sticked to the window */ + else if(!c->ismoving && !c->isfloating && layout->arrange != layout_floating + && (c->titlebar.position == Right || c->titlebar.position == Bottom)) + titlebar_update_geometry_floating(c); XConfigureWindow(globalconf.display, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); diff --git a/titlebar.c b/titlebar.c index 0732f726..3733c2e0 100644 --- a/titlebar.c +++ b/titlebar.c @@ -336,18 +336,18 @@ titlebar_update_geometry_floating(Client *c) titlebar_update(c); } -area_t +void titlebar_update_geometry(Client *c, area_t geometry) { int width, x_offset = 0 , y_offset = 0; if(!c->titlebar.sw) - return geometry; + return; switch(c->titlebar.position) { default: - return geometry; + return; case Top: if(!c->titlebar.width) width = geometry.width + 2 * c->border; @@ -441,8 +441,6 @@ titlebar_update_geometry(Client *c, area_t geometry) } titlebar_update(c); - - return titlebar_geometry_remove(&c->titlebar, geometry); } /** Toggle window titlebar visibility diff --git a/titlebar.h b/titlebar.h index fdd39d13..247981c2 100644 --- a/titlebar.h +++ b/titlebar.h @@ -27,7 +27,7 @@ void titlebar_init(Client *); void titlebar_update(Client *); void titlebar_update_geometry_floating(Client *); -area_t titlebar_update_geometry(Client *, area_t); +void titlebar_update_geometry(Client *, area_t); area_t titlebar_geometry_add(Titlebar *, area_t); area_t titlebar_geometry_remove(Titlebar *, area_t);