[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 <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-26 10:57:06 +01:00
parent 38ad723055
commit 214b5a4a31
3 changed files with 16 additions and 9 deletions

View File

@ -500,12 +500,15 @@ client_resize(Client *c, area_t geometry, Bool hints)
XWindowChanges wc; XWindowChanges wc;
Layout *layout = layout_get_current(c->screen); 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) if(hints)
geometry = client_geometry_hints(c, geometry); 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) if(geometry.width <= 0 || geometry.height <= 0)
return False; return False;
@ -543,6 +546,12 @@ client_resize(Client *c, area_t geometry, Bool hints)
c->f_geometry = geometry; c->f_geometry = geometry;
titlebar_update_geometry_floating(c); 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, XConfigureWindow(globalconf.display, c->win,
CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);

View File

@ -336,18 +336,18 @@ titlebar_update_geometry_floating(Client *c)
titlebar_update(c); titlebar_update(c);
} }
area_t void
titlebar_update_geometry(Client *c, area_t geometry) titlebar_update_geometry(Client *c, area_t geometry)
{ {
int width, x_offset = 0 , y_offset = 0; int width, x_offset = 0 , y_offset = 0;
if(!c->titlebar.sw) if(!c->titlebar.sw)
return geometry; return;
switch(c->titlebar.position) switch(c->titlebar.position)
{ {
default: default:
return geometry; return;
case Top: case Top:
if(!c->titlebar.width) if(!c->titlebar.width)
width = geometry.width + 2 * c->border; width = geometry.width + 2 * c->border;
@ -441,8 +441,6 @@ titlebar_update_geometry(Client *c, area_t geometry)
} }
titlebar_update(c); titlebar_update(c);
return titlebar_geometry_remove(&c->titlebar, geometry);
} }
/** Toggle window titlebar visibility /** Toggle window titlebar visibility

View File

@ -27,7 +27,7 @@
void titlebar_init(Client *); void titlebar_init(Client *);
void titlebar_update(Client *); void titlebar_update(Client *);
void titlebar_update_geometry_floating(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_add(Titlebar *, area_t);
area_t titlebar_geometry_remove(Titlebar *, area_t); area_t titlebar_geometry_remove(Titlebar *, area_t);