fix max() size restore, introduce volatile option to resize()

This commit is contained in:
Julien Danjou 2007-10-29 15:24:10 +01:00
parent 335b2c53ab
commit 14e8c82a8a
10 changed files with 18 additions and 19 deletions

View File

@ -372,7 +372,8 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
}
void
client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf, Bool sizehints)
client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf,
Bool sizehints, Bool volatile_coords)
{
double dx, dy, max, min, ratio;
XWindowChanges wc;
@ -437,7 +438,9 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
c->y = wc.y = y;
c->w = wc.width = w;
c->h = wc.height = h;
if(c->isfloating || get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating)
if(!volatile_coords
&& (c->isfloating
|| get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating))
{
c->rx = c->x;
c->ry = c->y;
@ -710,7 +713,7 @@ uicb_moveresize(awesome_config *awesomeconf,
oh = sel->h;
Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
client_resize(sel, nx, ny, nw, nh, awesomeconf, True);
client_resize(sel, nx, ny, nw, nh, awesomeconf, True, False);
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
{
nmx = mx - ox + sel->w - ow - 1 < 0 ? 0 : mx - ox + sel->w - ow - 1;

View File

@ -31,7 +31,7 @@ void client_reattach_after(Client *, Client *);
void client_ban(Client *);
void focus(Client *, Bool, awesome_config *);
void client_manage(Window, XWindowAttributes *, awesome_config *);
void client_resize(Client *, int, int, int, int, awesome_config *, Bool);
void client_resize(Client *, int, int, int, int, awesome_config *, Bool, Bool);
void client_unban(Client *);
void client_unmanage(Client *, long, awesome_config *);
inline void updatesizehints(Client *);

View File

@ -18,7 +18,7 @@ INCS = -I. -I/usr/include -I${X11INC} `pkg-config --cflags libconfuse xft cairo`
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 `pkg-config --libs libconfuse xft cairo` -lXext -lXrandr -lXinerama
# flags
CFLAGS = -fgnu89-inline -std=gnu99 -ggdb3 -pipe -Wall -Wextra -W -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wsign-compare -Wunused -Wuninitialized -Winit-self -Wpointer-arith -Wredundant-decls -Wno-format-zero-length -Wmissing-prototypes -Wmissing-format-attribute -Wmissing-noreturn -O3 ${INCS} -DVERSION=\"${VERSION}\"
CFLAGS = -fgnu89-inline -std=gnu99 -ggdb3 -pipe -Wall -Wextra -W -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wsign-compare -Wunused -Wuninitialized -Winit-self -Wpointer-arith -Wredundant-decls -Wno-format-zero-length -Wmissing-prototypes -Wmissing-format-attribute -Wmissing-noreturn -O0 ${INCS} -DVERSION=\"${VERSION}\"
LDFLAGS = -ggdb3 ${LIBS}
# compiler and linker

View File

@ -86,7 +86,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
ny = si[c->screen].y_org;
else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < awesomeconf[c->screen].snap)
ny = si[c->screen].y_org + si[c->screen].height - c->h - 2 * c->border;
client_resize(c, nx, ny, c->w, c->h, &awesomeconf[c->screen], False);
client_resize(c, nx, ny, c->w, c->h, &awesomeconf[c->screen], False, False);
break;
}
}
@ -131,7 +131,7 @@ resizemouse(Client * c, awesome_config *awesomeconf)
nw = 1;
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
nh = 1;
client_resize(c, c->x, c->y, nw, nh, &awesomeconf[c->screen], True);
client_resize(c, c->x, c->y, nw, nh, &awesomeconf[c->screen], True, False);
break;
}
}

View File

@ -240,14 +240,10 @@ maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
{
sel->wasfloating = sel->isfloating;
sel->isfloating = True;
sel->rx = sel->x;
sel->ry = sel->y;
sel->rw = sel->w;
sel->rh = sel->h;
client_resize(sel, x, y, w, h, awesomeconf, True);
client_resize(sel, x, y, w, h, awesomeconf, True, True);
}
else if(sel->wasfloating)
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True);
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True, False);
else
sel->isfloating = False;

View File

@ -29,6 +29,6 @@ layout_floating(awesome_config *awesomeconf)
for(c = *awesomeconf->clients; c; c = c->next)
if(isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True);
client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True, False);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

View File

@ -34,7 +34,7 @@ layout_max(awesome_config *awesomeconf)
if(IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
client_resize(c, si[awesomeconf->screen].x_org, si[awesomeconf->screen].y_org,
si[awesomeconf->screen].width - 2 * c->border,
si[awesomeconf->screen].height - 2 * c->border, awesomeconf, awesomeconf->resize_hints);
si[awesomeconf->screen].height - 2 * c->border, awesomeconf, awesomeconf->resize_hints, False);
p_delete(&si);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

View File

@ -138,7 +138,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
{ /* master */
ny = way + i * mh;
nx = wax + (right ? 0 : waw - mw);
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf, awesomeconf->resize_hints);
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf, awesomeconf->resize_hints, False);
}
else
{ /* tile window */
@ -164,7 +164,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
ny = way + ((i - awesomeconf->nmaster) % win_by_col) * (nh + 2 * c->border);
nx = wax + current_col * (nw + 2 * c->border) + (right ? mw : 0);
client_resize(c, nx, ny, nw, nh, awesomeconf, awesomeconf->resize_hints);
client_resize(c, nx, ny, nw, nh, awesomeconf, awesomeconf->resize_hints, False);
}
i++;
}

View File

@ -183,7 +183,7 @@ move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize)
if(c->ry + c->rh >= si[c->screen].y_org + si[c->screen].height)
c->ry = si[c->screen].y_org + si[c->screen].height - c->rh - 2 * c->border;
client_resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True);
client_resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True, False);
p_delete(&si);
p_delete(&si_old);

2
tag.c
View File

@ -177,7 +177,7 @@ uicb_togglefloating(awesome_config * awesomeconf,
sel->isfloating = !sel->isfloating;
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True);
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True, False);
client_untab(sel);
saveprops(sel, awesomeconf->ntags);