Remove resize_hints args to client_resize(), force usage of client_geometry_hints()
This commit is contained in:
parent
ea88e324a0
commit
3c3015fd76
36
client.c
36
client.c
|
@ -465,8 +465,8 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
ewmh_update_net_client_list(phys_screen);
|
||||
}
|
||||
|
||||
static area_t
|
||||
client_geometry_sizehint(Client *c, area_t geometry)
|
||||
area_t
|
||||
client_geometry_hints(Client *c, area_t geometry)
|
||||
{
|
||||
double dx, dy, max, min, ratio;
|
||||
|
||||
|
@ -515,11 +515,10 @@ client_geometry_sizehint(Client *c, area_t geometry)
|
|||
/** Resize client window
|
||||
* \param c client to resize
|
||||
* \param geometry new window geometry
|
||||
* \param sizehints respect size hints
|
||||
* \param return True if resize has been done
|
||||
*/
|
||||
Bool
|
||||
client_resize(Client *c, area_t geometry, Bool sizehints)
|
||||
client_resize(Client *c, area_t geometry)
|
||||
{
|
||||
int new_screen;
|
||||
area_t area;
|
||||
|
@ -531,9 +530,6 @@ client_resize(Client *c, area_t geometry, Bool sizehints)
|
|||
geometry.height -= c->titlebar->geometry.height;
|
||||
}
|
||||
|
||||
if(sizehints)
|
||||
geometry = client_geometry_sizehint(c, geometry);
|
||||
|
||||
if(geometry.width <= 0 || geometry.height <= 0)
|
||||
return False;
|
||||
|
||||
|
@ -579,8 +575,6 @@ client_resize(Client *c, area_t geometry, Bool sizehints)
|
|||
layout_get_current(new_screen)->arrange == layout_floating) && !c->ismax)
|
||||
c->f_geometry = geometry;
|
||||
|
||||
printf("moving client %s to %d\n", c->name, c->geometry.y);
|
||||
|
||||
XConfigureWindow(globalconf.display, c->win,
|
||||
CWX | CWY | CWWidth | CWHeight, &wc);
|
||||
window_configure(c->win, geometry, c->border);
|
||||
|
@ -600,7 +594,7 @@ client_setfloating(Client *c, Bool floating)
|
|||
{
|
||||
if((c->isfloating = floating))
|
||||
{
|
||||
client_resize(c, c->f_geometry, False);
|
||||
client_resize(c, c->f_geometry);
|
||||
XRaiseWindow(globalconf.display, c->win);
|
||||
}
|
||||
else
|
||||
|
@ -609,7 +603,7 @@ client_setfloating(Client *c, Bool floating)
|
|||
if(c->ismax)
|
||||
{
|
||||
c->ismax = False;
|
||||
client_resize(c, c->m_geometry, False);
|
||||
client_resize(c, c->m_geometry);
|
||||
}
|
||||
}
|
||||
if(client_isvisible(c, c->screen))
|
||||
|
@ -918,7 +912,7 @@ uicb_client_moveresize(int screen, char *arg)
|
|||
int mx, my, dx, dy, nmx, nmy;
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
area_t area;
|
||||
area_t geometry;
|
||||
Client *sel = globalconf.focus->client;
|
||||
Layout *curlay = layout_get_current(screen);
|
||||
|
||||
|
@ -929,10 +923,10 @@ uicb_client_moveresize(int screen, char *arg)
|
|||
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
|
||||
return;
|
||||
|
||||
area.x = (int) compute_new_value_from_arg(x, sel->geometry.x);
|
||||
area.y = (int) compute_new_value_from_arg(y, sel->geometry.y);
|
||||
area.width = (int) compute_new_value_from_arg(w, sel->geometry.width);
|
||||
area.height = (int) compute_new_value_from_arg(h, sel->geometry.height);
|
||||
geometry.x = (int) compute_new_value_from_arg(x, sel->geometry.x);
|
||||
geometry.y = (int) compute_new_value_from_arg(y, sel->geometry.y);
|
||||
geometry.width = (int) compute_new_value_from_arg(w, sel->geometry.width);
|
||||
geometry.height = (int) compute_new_value_from_arg(h, sel->geometry.height);
|
||||
|
||||
ox = sel->geometry.x;
|
||||
oy = sel->geometry.y;
|
||||
|
@ -943,7 +937,9 @@ uicb_client_moveresize(int screen, char *arg)
|
|||
RootWindow(globalconf.display,
|
||||
get_phys_screen(screen)),
|
||||
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
client_resize(sel, area, globalconf.screens[sel->screen].resize_hints);
|
||||
if(globalconf.screens[sel->screen].resize_hints)
|
||||
geometry = client_geometry_hints(sel, geometry);
|
||||
client_resize(sel, geometry);
|
||||
if (xqp && ox <= mx && (ox + 2 * sel->border + ow) >= mx &&
|
||||
oy <= my && (oy + 2 * sel->border + oh) >= my)
|
||||
{
|
||||
|
@ -1005,18 +1001,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, False);
|
||||
client_resize(c, geometry);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
}
|
||||
else if(c->wasfloating)
|
||||
{
|
||||
client_setfloating(c, True);
|
||||
client_resize(c, c->m_geometry, False);
|
||||
client_resize(c, c->m_geometry);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
}
|
||||
else if(layout_get_current(c->screen)->arrange == layout_floating)
|
||||
{
|
||||
client_resize(c, c->m_geometry, False);
|
||||
client_resize(c, c->m_geometry);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
}
|
||||
else
|
||||
|
|
3
client.h
3
client.h
|
@ -31,7 +31,8 @@ void client_focus(Client *, int, Bool);
|
|||
void client_ban(Client *);
|
||||
void client_unban(Client *);
|
||||
void client_manage(Window, XWindowAttributes *, int);
|
||||
Bool client_resize(Client *, area_t, Bool);
|
||||
area_t client_geometry_hints(Client *, area_t);
|
||||
Bool client_resize(Client *, area_t);
|
||||
void client_unmanage(Client *);
|
||||
void client_updatewmhints(Client *);
|
||||
long client_updatesizehints(Client *);
|
||||
|
|
2
event.c
2
event.c
|
@ -181,7 +181,7 @@ event_handle_configurerequest(XEvent * e)
|
|||
{
|
||||
old_screen = c->screen;
|
||||
|
||||
client_resize(c, geometry, False);
|
||||
client_resize(c, geometry);
|
||||
|
||||
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);
|
||||
}
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
client_resize(c, geometry, False);
|
||||
client_resize(c, geometry);
|
||||
XRaiseWindow(globalconf.display, c->win);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,10 @@ layout_fibonacci(int screen, int shape)
|
|||
}
|
||||
geometry.width -= 2 * c->border;
|
||||
geometry.height -= 2 * c->border;
|
||||
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
||||
if(globalconf.screens[screen].resize_hints)
|
||||
client_resize(c, client_geometry_hints(c, geometry));
|
||||
else
|
||||
client_resize(c, geometry);
|
||||
geometry.width += 2 * c->border;
|
||||
geometry.height += 2 * c->border;
|
||||
}
|
||||
|
|
|
@ -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, True);
|
||||
client_resize(c, c->f_geometry);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -40,7 +40,10 @@ layout_max(int screen)
|
|||
{
|
||||
area.width -= 2 * c->border;
|
||||
area.height -= 2 * c->border;
|
||||
client_resize(c, area, globalconf.screens[screen].resize_hints);
|
||||
if(globalconf.screens[screen].resize_hints)
|
||||
client_resize(c, client_geometry_hints(c, area));
|
||||
else
|
||||
client_resize(c, area);
|
||||
area.width += 2 * c->border;
|
||||
area.height += 2 * c->border;
|
||||
}
|
||||
|
|
|
@ -205,7 +205,9 @@ _tile(int screen, const Position position)
|
|||
}
|
||||
geometry.width = mw - 2 * c->border;
|
||||
geometry.height = mh - 2 * c->border;
|
||||
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
|
||||
{
|
||||
|
@ -256,7 +258,9 @@ _tile(int screen, const Position position)
|
|||
if(position == Bottom)
|
||||
geometry.y += mh;
|
||||
}
|
||||
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);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
4
mouse.c
4
mouse.c
|
@ -109,7 +109,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
|||
geometry.y = area.y + area.height - c->geometry.height - 2 * c->border;
|
||||
geometry.width = c->geometry.width;
|
||||
geometry.height = c->geometry.height;
|
||||
client_resize(c, geometry, False);
|
||||
client_resize(c, geometry);
|
||||
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
|
||||
}
|
||||
else
|
||||
|
@ -224,7 +224,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, geometry, True);
|
||||
client_resize(c, client_geometry_hints(c, geometry));
|
||||
}
|
||||
else if(layout->arrange == layout_tile || layout->arrange == layout_tileleft
|
||||
|| 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)
|
||||
c->m_geometry.y = to.y + to.height - c->m_geometry.height - 2 * c->border;
|
||||
|
||||
client_resize(c, new_geometry, False);
|
||||
client_resize(c, new_geometry);
|
||||
}
|
||||
/* if floating, move to this new coords */
|
||||
else if(c->isfloating)
|
||||
client_resize(c, new_f_geometry, False);
|
||||
client_resize(c, new_f_geometry);
|
||||
/* otherwise just register them */
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue