Change the way to do resize

Go back to old school

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-16 10:01:55 +01:00
parent 403d7e89f9
commit e22d57a0ca
10 changed files with 30 additions and 45 deletions

View File

@ -475,7 +475,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
ewmh_update_net_client_list(phys_screen);
}
area_t
static area_t
client_geometry_hints(Client *c, area_t geometry)
{
double dx, dy, max, min, ratio;
@ -525,14 +525,22 @@ client_geometry_hints(Client *c, area_t geometry)
/** Resize client window
* \param c client to resize
* \param geometry new window geometry
* \param hints use resize hints
* \param return True if resize has been done
*/
Bool
client_resize(Client *c, area_t geometry)
client_resize(Client *c, area_t geometry, Bool hints)
{
int new_screen;
area_t area;
XWindowChanges wc;
Layout *layout = layout_get_current(c->screen);
if(hints)
geometry = client_geometry_hints(c, geometry);
if(!c->isfloating && layout->arrange != layout_floating)
geometry = titlebar_update_geometry(c, geometry);
if(geometry.width <= 0 || geometry.height <= 0)
return False;
@ -553,7 +561,8 @@ client_resize(Client *c, area_t geometry)
if(c->geometry.x != geometry.x || c->geometry.y != geometry.y
|| c->geometry.width != geometry.width || c->geometry.height != geometry.height)
{
new_screen = screen_get_bycoord(globalconf.screens_info, c->screen, geometry.x, geometry.y);
new_screen =
screen_get_bycoord(globalconf.screens_info, c->screen, geometry.x, geometry.y);
c->geometry.x = wc.x = geometry.x;
c->geometry.width = wc.width = geometry.width;
@ -590,7 +599,7 @@ client_setfloating(Client *c, Bool floating)
{
if((c->isfloating = floating))
{
client_resize(c, c->f_geometry);
client_resize(c, c->f_geometry, False);
XRaiseWindow(globalconf.display, c->win);
}
else
@ -599,7 +608,7 @@ client_setfloating(Client *c, Bool floating)
if(c->ismax)
{
c->ismax = False;
client_resize(c, c->m_geometry);
client_resize(c, c->m_geometry, False);
}
}
if(client_isvisible(c, c->screen))
@ -935,7 +944,7 @@ uicb_client_moveresize(int screen, char *arg)
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
if(globalconf.screens[sel->screen].resize_hints)
geometry = client_geometry_hints(sel, geometry);
client_resize(sel, geometry);
client_resize(sel, geometry, False);
if (xqp && ox <= mx && (ox + 2 * sel->border + ow) >= mx &&
oy <= my && (oy + 2 * sel->border + oh) >= my)
{
@ -997,18 +1006,18 @@ client_maximize(Client *c, area_t geometry)
if(layout_get_current(c->screen)->arrange != layout_floating)
client_setfloating(c, True);
client_focus(c, c->screen, True);
client_resize(c, geometry);
client_resize(c, geometry, False);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
}
else if(c->wasfloating)
{
client_setfloating(c, True);
client_resize(c, c->m_geometry);
client_resize(c, c->m_geometry, False);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
}
else if(layout_get_current(c->screen)->arrange == layout_floating)
{
client_resize(c, c->m_geometry);
client_resize(c, c->m_geometry, False);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
}
else

View File

@ -31,8 +31,7 @@ void client_focus(Client *, int, Bool);
void client_ban(Client *);
void client_unban(Client *);
void client_manage(Window, XWindowAttributes *, int);
area_t client_geometry_hints(Client *, area_t);
Bool client_resize(Client *, area_t);
Bool client_resize(Client *, area_t, Bool);
void client_unmanage(Client *);
void client_updatewmhints(Client *);
long client_updatesizehints(Client *);

View File

@ -182,7 +182,7 @@ event_handle_configurerequest(XEvent * e)
{
old_screen = c->screen;
client_resize(c, geometry);
client_resize(c, geometry, False);
tag_client_with_rule(c, rule_matching_client(c));

2
ewmh.c
View File

@ -272,7 +272,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
client_setfloating(c, True);
}
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
client_resize(c, geometry);
client_resize(c, geometry, False);
XRaiseWindow(globalconf.display, c->win);
}
}

View File

@ -83,13 +83,7 @@ layout_fibonacci(int screen, int shape)
}
geometry.width -= 2 * c->border;
geometry.height -= 2 * c->border;
if(globalconf.screens[screen].resize_hints)
client_resize(c,
client_geometry_hints(c,
titlebar_update_geometry(c,
geometry)));
else
client_resize(c, titlebar_update_geometry(c, geometry));
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
geometry.width += 2 * c->border;
geometry.height += 2 * c->border;
}

View File

@ -32,6 +32,6 @@ layout_floating(int screen)
for(c = globalconf.clients; c; c = c->next)
if(client_isvisible(c, screen) && !c->ismax)
client_resize(c, c->f_geometry);
client_resize(c, c->f_geometry, False);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -41,13 +41,7 @@ layout_max(int screen)
{
area.width -= 2 * c->border;
area.height -= 2 * c->border;
if(globalconf.screens[screen].resize_hints)
client_resize(c,
client_geometry_hints(c,
titlebar_update_geometry(c,
area)));
else
client_resize(c, titlebar_update_geometry(c, area));
client_resize(c, area, False);
area.width += 2 * c->border;
area.height += 2 * c->border;
}

View File

@ -208,11 +208,7 @@ _tile(int screen, const Position position)
geometry.width = mw - 2 * c->border;
geometry.height = mh - 2 * c->border;
geometry = titlebar_update_geometry(c, geometry);
if(globalconf.screens[screen].resize_hints)
geometry = client_geometry_hints(c, geometry);
client_resize(c, geometry);
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
}
else
{
@ -263,12 +259,7 @@ _tile(int screen, const Position position)
if(position == Bottom)
geometry.y += mh;
}
geometry = titlebar_update_geometry(c, geometry);
if(globalconf.screens[screen].resize_hints)
geometry = client_geometry_hints(c, geometry);
client_resize(c, geometry);
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
}
i++;
}

View File

@ -113,9 +113,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
geometry.width = c->geometry.width;
geometry.height = c->geometry.height;
client_resize(c, geometry);
titlebar_update_geometry_floating(c);
client_resize(c, geometry, False);
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
}
@ -231,7 +229,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
geometry.height = 1;
geometry.x = c->geometry.x;
geometry.y = c->geometry.y;
client_resize(c, client_geometry_hints(c, geometry));
client_resize(c, geometry, True);
}
else if(layout->arrange == layout_tile || layout->arrange == layout_tileleft
|| layout->arrange == layout_tiletop || layout->arrange == layout_tilebottom)

View File

@ -189,11 +189,11 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize)
if(c->m_geometry.y + c->m_geometry.height >= to.y + to.height)
c->m_geometry.y = to.y + to.height - c->m_geometry.height - 2 * c->border;
client_resize(c, new_geometry);
client_resize(c, new_geometry, False);
}
/* if floating, move to this new coords */
else if(c->isfloating)
client_resize(c, new_f_geometry);
client_resize(c, new_f_geometry, False);
/* otherwise just register them */
else
{