Change the way to do resize
Go back to old school Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
403d7e89f9
commit
e22d57a0ca
27
client.c
27
client.c
|
@ -475,7 +475,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
ewmh_update_net_client_list(phys_screen);
|
ewmh_update_net_client_list(phys_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
area_t
|
static area_t
|
||||||
client_geometry_hints(Client *c, area_t geometry)
|
client_geometry_hints(Client *c, area_t geometry)
|
||||||
{
|
{
|
||||||
double dx, dy, max, min, ratio;
|
double dx, dy, max, min, ratio;
|
||||||
|
@ -525,14 +525,22 @@ client_geometry_hints(Client *c, area_t geometry)
|
||||||
/** Resize client window
|
/** Resize client window
|
||||||
* \param c client to resize
|
* \param c client to resize
|
||||||
* \param geometry new window geometry
|
* \param geometry new window geometry
|
||||||
|
* \param hints use resize hints
|
||||||
* \param return True if resize has been done
|
* \param return True if resize has been done
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
client_resize(Client *c, area_t geometry)
|
client_resize(Client *c, area_t geometry, Bool hints)
|
||||||
{
|
{
|
||||||
int new_screen;
|
int new_screen;
|
||||||
area_t area;
|
area_t area;
|
||||||
XWindowChanges wc;
|
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)
|
if(geometry.width <= 0 || geometry.height <= 0)
|
||||||
return False;
|
return False;
|
||||||
|
@ -553,7 +561,8 @@ client_resize(Client *c, area_t geometry)
|
||||||
if(c->geometry.x != geometry.x || c->geometry.y != geometry.y
|
if(c->geometry.x != geometry.x || c->geometry.y != geometry.y
|
||||||
|| c->geometry.width != geometry.width || c->geometry.height != geometry.height)
|
|| 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.x = wc.x = geometry.x;
|
||||||
c->geometry.width = wc.width = geometry.width;
|
c->geometry.width = wc.width = geometry.width;
|
||||||
|
@ -590,7 +599,7 @@ client_setfloating(Client *c, Bool floating)
|
||||||
{
|
{
|
||||||
if((c->isfloating = floating))
|
if((c->isfloating = floating))
|
||||||
{
|
{
|
||||||
client_resize(c, c->f_geometry);
|
client_resize(c, c->f_geometry, False);
|
||||||
XRaiseWindow(globalconf.display, c->win);
|
XRaiseWindow(globalconf.display, c->win);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -599,7 +608,7 @@ client_setfloating(Client *c, Bool floating)
|
||||||
if(c->ismax)
|
if(c->ismax)
|
||||||
{
|
{
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
client_resize(c, c->m_geometry);
|
client_resize(c, c->m_geometry, False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(client_isvisible(c, c->screen))
|
if(client_isvisible(c, c->screen))
|
||||||
|
@ -935,7 +944,7 @@ uicb_client_moveresize(int screen, char *arg)
|
||||||
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||||
if(globalconf.screens[sel->screen].resize_hints)
|
if(globalconf.screens[sel->screen].resize_hints)
|
||||||
geometry = client_geometry_hints(sel, geometry);
|
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 &&
|
if (xqp && ox <= mx && (ox + 2 * sel->border + ow) >= mx &&
|
||||||
oy <= my && (oy + 2 * sel->border + oh) >= my)
|
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)
|
if(layout_get_current(c->screen)->arrange != layout_floating)
|
||||||
client_setfloating(c, True);
|
client_setfloating(c, True);
|
||||||
client_focus(c, c->screen, True);
|
client_focus(c, c->screen, True);
|
||||||
client_resize(c, geometry);
|
client_resize(c, geometry, False);
|
||||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||||
}
|
}
|
||||||
else if(c->wasfloating)
|
else if(c->wasfloating)
|
||||||
{
|
{
|
||||||
client_setfloating(c, True);
|
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);
|
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||||
}
|
}
|
||||||
else if(layout_get_current(c->screen)->arrange == layout_floating)
|
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);
|
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
3
client.h
3
client.h
|
@ -31,8 +31,7 @@ void client_focus(Client *, int, Bool);
|
||||||
void client_ban(Client *);
|
void client_ban(Client *);
|
||||||
void client_unban(Client *);
|
void client_unban(Client *);
|
||||||
void client_manage(Window, XWindowAttributes *, int);
|
void client_manage(Window, XWindowAttributes *, int);
|
||||||
area_t client_geometry_hints(Client *, area_t);
|
Bool client_resize(Client *, area_t, Bool);
|
||||||
Bool client_resize(Client *, area_t);
|
|
||||||
void client_unmanage(Client *);
|
void client_unmanage(Client *);
|
||||||
void client_updatewmhints(Client *);
|
void client_updatewmhints(Client *);
|
||||||
long client_updatesizehints(Client *);
|
long client_updatesizehints(Client *);
|
||||||
|
|
2
event.c
2
event.c
|
@ -182,7 +182,7 @@ event_handle_configurerequest(XEvent * e)
|
||||||
{
|
{
|
||||||
old_screen = c->screen;
|
old_screen = c->screen;
|
||||||
|
|
||||||
client_resize(c, geometry);
|
client_resize(c, geometry, False);
|
||||||
|
|
||||||
tag_client_with_rule(c, rule_matching_client(c));
|
tag_client_with_rule(c, rule_matching_client(c));
|
||||||
|
|
||||||
|
|
2
ewmh.c
2
ewmh.c
|
@ -272,7 +272,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
|
||||||
client_setfloating(c, True);
|
client_setfloating(c, True);
|
||||||
}
|
}
|
||||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||||
client_resize(c, geometry);
|
client_resize(c, geometry, False);
|
||||||
XRaiseWindow(globalconf.display, c->win);
|
XRaiseWindow(globalconf.display, c->win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,13 +83,7 @@ layout_fibonacci(int screen, int shape)
|
||||||
}
|
}
|
||||||
geometry.width -= 2 * c->border;
|
geometry.width -= 2 * c->border;
|
||||||
geometry.height -= 2 * c->border;
|
geometry.height -= 2 * c->border;
|
||||||
if(globalconf.screens[screen].resize_hints)
|
client_resize(c, geometry, 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));
|
|
||||||
geometry.width += 2 * c->border;
|
geometry.width += 2 * c->border;
|
||||||
geometry.height += 2 * c->border;
|
geometry.height += 2 * c->border;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,6 @@ layout_floating(int screen)
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(client_isvisible(c, screen) && !c->ismax)
|
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
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
|
@ -41,13 +41,7 @@ layout_max(int screen)
|
||||||
{
|
{
|
||||||
area.width -= 2 * c->border;
|
area.width -= 2 * c->border;
|
||||||
area.height -= 2 * c->border;
|
area.height -= 2 * c->border;
|
||||||
if(globalconf.screens[screen].resize_hints)
|
client_resize(c, area, False);
|
||||||
client_resize(c,
|
|
||||||
client_geometry_hints(c,
|
|
||||||
titlebar_update_geometry(c,
|
|
||||||
area)));
|
|
||||||
else
|
|
||||||
client_resize(c, titlebar_update_geometry(c, area));
|
|
||||||
area.width += 2 * c->border;
|
area.width += 2 * c->border;
|
||||||
area.height += 2 * c->border;
|
area.height += 2 * c->border;
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,11 +208,7 @@ _tile(int screen, const Position position)
|
||||||
geometry.width = mw - 2 * c->border;
|
geometry.width = mw - 2 * c->border;
|
||||||
geometry.height = mh - 2 * c->border;
|
geometry.height = mh - 2 * c->border;
|
||||||
|
|
||||||
geometry = titlebar_update_geometry(c, geometry);
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
||||||
|
|
||||||
if(globalconf.screens[screen].resize_hints)
|
|
||||||
geometry = client_geometry_hints(c, geometry);
|
|
||||||
client_resize(c, geometry);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -263,12 +259,7 @@ _tile(int screen, const Position position)
|
||||||
if(position == Bottom)
|
if(position == Bottom)
|
||||||
geometry.y += mh;
|
geometry.y += mh;
|
||||||
}
|
}
|
||||||
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
||||||
geometry = titlebar_update_geometry(c, geometry);
|
|
||||||
|
|
||||||
if(globalconf.screens[screen].resize_hints)
|
|
||||||
geometry = client_geometry_hints(c, geometry);
|
|
||||||
client_resize(c, geometry);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
6
mouse.c
6
mouse.c
|
@ -113,9 +113,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
geometry.width = c->geometry.width;
|
geometry.width = c->geometry.width;
|
||||||
geometry.height = c->geometry.height;
|
geometry.height = c->geometry.height;
|
||||||
|
|
||||||
client_resize(c, geometry);
|
client_resize(c, geometry, False);
|
||||||
|
|
||||||
titlebar_update_geometry_floating(c);
|
|
||||||
|
|
||||||
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
|
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
|
||||||
}
|
}
|
||||||
|
@ -231,7 +229,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
geometry.height = 1;
|
geometry.height = 1;
|
||||||
geometry.x = c->geometry.x;
|
geometry.x = c->geometry.x;
|
||||||
geometry.y = c->geometry.y;
|
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
|
else if(layout->arrange == layout_tile || layout->arrange == layout_tileleft
|
||||||
|| layout->arrange == layout_tiletop || layout->arrange == layout_tilebottom)
|
|| layout->arrange == layout_tiletop || layout->arrange == layout_tilebottom)
|
||||||
|
|
4
screen.c
4
screen.c
|
@ -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)
|
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;
|
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 */
|
/* if floating, move to this new coords */
|
||||||
else if(c->isfloating)
|
else if(c->isfloating)
|
||||||
client_resize(c, new_f_geometry);
|
client_resize(c, new_f_geometry, False);
|
||||||
/* otherwise just register them */
|
/* otherwise just register them */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue