use Area as arg for client_resize
This commit is contained in:
parent
163acc8624
commit
70a3114dba
109
client.c
109
client.c
|
@ -437,8 +437,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
* \param volatile_coords register coords in rx/ry/rw/rh
|
* \param volatile_coords register coords in rx/ry/rw/rh
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
client_resize(Client *c, int x, int y, int w, int h,
|
client_resize(Client *c, Area geometry, Bool sizehints, Bool volatile_coords)
|
||||||
Bool sizehints, Bool volatile_coords)
|
|
||||||
{
|
{
|
||||||
double dx, dy, max, min, ratio;
|
double dx, dy, max, min, ratio;
|
||||||
Area area;
|
Area area;
|
||||||
|
@ -446,10 +445,11 @@ client_resize(Client *c, int x, int y, int w, int h,
|
||||||
|
|
||||||
if(sizehints)
|
if(sizehints)
|
||||||
{
|
{
|
||||||
if(c->minay > 0 && c->maxay > 0 && (h - c->baseh) > 0 && (w - c->basew) > 0)
|
if(c->minay > 0 && c->maxay > 0 && (geometry.height - c->baseh) > 0
|
||||||
|
&& (geometry.width - c->basew) > 0)
|
||||||
{
|
{
|
||||||
dx = (double) (w - c->basew);
|
dx = (double) (geometry.width - c->basew);
|
||||||
dy = (double) (h - c->baseh);
|
dy = (double) (geometry.height - c->baseh);
|
||||||
min = (double) (c->minax) / (double) (c->minay);
|
min = (double) (c->minax) / (double) (c->minay);
|
||||||
max = (double) (c->maxax) / (double) (c->maxay);
|
max = (double) (c->maxax) / (double) (c->maxay);
|
||||||
ratio = dx / dy;
|
ratio = dx / dy;
|
||||||
|
@ -459,67 +459,69 @@ client_resize(Client *c, int x, int y, int w, int h,
|
||||||
{
|
{
|
||||||
dy = (dx * min + dy) / (min * min + 1);
|
dy = (dx * min + dy) / (min * min + 1);
|
||||||
dx = dy * min;
|
dx = dy * min;
|
||||||
w = (int) dx + c->basew;
|
geometry.width = (int) dx + c->basew;
|
||||||
h = (int) dy + c->baseh;
|
geometry.height = (int) dy + c->baseh;
|
||||||
}
|
}
|
||||||
else if(ratio > max)
|
else if(ratio > max)
|
||||||
{
|
{
|
||||||
dy = (dx * min + dy) / (max * max + 1);
|
dy = (dx * min + dy) / (max * max + 1);
|
||||||
dx = dy * min;
|
dx = dy * min;
|
||||||
w = (int) dx + c->basew;
|
geometry.width = (int) dx + c->basew;
|
||||||
h = (int) dy + c->baseh;
|
geometry.height = (int) dy + c->baseh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(c->minw && w < c->minw)
|
if(c->minw && geometry.width < c->minw)
|
||||||
w = c->minw;
|
geometry.width = c->minw;
|
||||||
if(c->minh && h < c->minh)
|
if(c->minh && geometry.height < c->minh)
|
||||||
h = c->minh;
|
geometry.height = c->minh;
|
||||||
if(c->maxw && w > c->maxw)
|
if(c->maxw && geometry.width > c->maxw)
|
||||||
w = c->maxw;
|
geometry.width = c->maxw;
|
||||||
if(c->maxh && h > c->maxh)
|
if(c->maxh && geometry.height > c->maxh)
|
||||||
h = c->maxh;
|
geometry.height = c->maxh;
|
||||||
if(c->incw)
|
if(c->incw)
|
||||||
w -= (w - c->basew) % c->incw;
|
geometry.width -= (geometry.width - c->basew) % c->incw;
|
||||||
if(c->inch)
|
if(c->inch)
|
||||||
h -= (h - c->baseh) % c->inch;
|
geometry.height -= (geometry.height - c->baseh) % c->inch;
|
||||||
}
|
}
|
||||||
if(w <= 0 || h <= 0)
|
if(geometry.width <= 0 || geometry.height <= 0)
|
||||||
return;
|
return;
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
area = get_display_area(get_phys_screen(c->screen),
|
area = get_display_area(get_phys_screen(c->screen),
|
||||||
NULL,
|
NULL,
|
||||||
&globalconf.screens[c->screen].padding);
|
&globalconf.screens[c->screen].padding);
|
||||||
if(x > area.width)
|
if(geometry.x > area.width)
|
||||||
x = area.width - w - 2 * c->border;
|
geometry.x = area.width - geometry.width - 2 * c->border;
|
||||||
if(y > area.height)
|
if(geometry.y > area.height)
|
||||||
y = area.height - h - 2 * c->border;
|
geometry.y = area.height - geometry.height - 2 * c->border;
|
||||||
if(x + w + 2 * c->border < 0)
|
if(geometry.x + geometry.width + 2 * c->border < 0)
|
||||||
x = 0;
|
geometry.x = 0;
|
||||||
if(y + h + 2 * c->border < 0)
|
if(geometry.y + geometry.height + 2 * c->border < 0)
|
||||||
y = 0;
|
geometry.y = 0;
|
||||||
if(c->geometry.x != x || c->geometry.y != y
|
if(c->geometry.x != geometry.x || c->geometry.y != geometry.y
|
||||||
|| c->geometry.width != w || c->geometry.height != h)
|
|| c->geometry.width != geometry.width || c->geometry.height != geometry.height)
|
||||||
{
|
{
|
||||||
c->geometry.x = x;
|
c->geometry.x = geometry.x;
|
||||||
c->geometry.y = y;
|
c->geometry.y = geometry.y;
|
||||||
c->geometry.width = w;
|
c->geometry.width = geometry.width;
|
||||||
c->geometry.height = h;
|
c->geometry.height = geometry.height;
|
||||||
curtags = get_current_tags(c->screen);
|
curtags = get_current_tags(c->screen);
|
||||||
if(!volatile_coords && (c->isfloating
|
if(!volatile_coords && (c->isfloating
|
||||||
|| curtags[0]->layout->arrange == layout_floating))
|
|| curtags[0]->layout->arrange == layout_floating))
|
||||||
{
|
{
|
||||||
c->f_geometry.x = x;
|
c->f_geometry.x = geometry.x;
|
||||||
c->f_geometry.y = y;
|
c->f_geometry.y = geometry.y;
|
||||||
c->f_geometry.width = w;
|
c->f_geometry.width = geometry.width;
|
||||||
c->f_geometry.height = h;
|
c->f_geometry.height = geometry.height;
|
||||||
}
|
}
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
XMoveResizeWindow(globalconf.display, c->win, x, y, w, h);
|
XMoveResizeWindow(globalconf.display, c->win, geometry.x, geometry.y,
|
||||||
window_configure(c->win, x, y, w, h, c->border);
|
geometry.width, geometry.height);
|
||||||
|
window_configure(c->win, geometry.x, geometry.y,
|
||||||
|
geometry.width, geometry.height, c->border);
|
||||||
if(XineramaIsActive(globalconf.display))
|
if(XineramaIsActive(globalconf.display))
|
||||||
{
|
{
|
||||||
int new_screen = get_screen_bycoord(x, y);
|
int new_screen = get_screen_bycoord(geometry.x, geometry.y);
|
||||||
if(c->screen != new_screen)
|
if(c->screen != new_screen)
|
||||||
move_client_to_screen(c, new_screen, False);
|
move_client_to_screen(c, new_screen, False);
|
||||||
}
|
}
|
||||||
|
@ -787,11 +789,12 @@ uicb_client_swapprev(int screen, char *arg __attribute__ ((unused)))
|
||||||
void
|
void
|
||||||
uicb_client_moveresize(int screen, char *arg)
|
uicb_client_moveresize(int screen, char *arg)
|
||||||
{
|
{
|
||||||
int nx, ny, nw, nh, ox, oy, ow, oh;
|
int ox, oy, ow, oh;
|
||||||
char x[8], y[8], w[8], h[8];
|
char x[8], y[8], w[8], h[8];
|
||||||
int mx, my, dx, dy, nmx, nmy;
|
int mx, my, dx, dy, nmx, nmy;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
Window dummy;
|
Window dummy;
|
||||||
|
Area area;
|
||||||
Client *sel = globalconf.focus->client;
|
Client *sel = globalconf.focus->client;
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
|
|
||||||
|
@ -804,10 +807,10 @@ uicb_client_moveresize(int screen, char *arg)
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
|
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
|
||||||
return;
|
return;
|
||||||
nx = (int) compute_new_value_from_arg(x, sel->geometry.x);
|
area.x = (int) compute_new_value_from_arg(x, sel->geometry.x);
|
||||||
ny = (int) compute_new_value_from_arg(y, sel->geometry.y);
|
area.y = (int) compute_new_value_from_arg(y, sel->geometry.y);
|
||||||
nw = (int) compute_new_value_from_arg(w, sel->geometry.width);
|
area.width = (int) compute_new_value_from_arg(w, sel->geometry.width);
|
||||||
nh = (int) compute_new_value_from_arg(h, sel->geometry.height);
|
area.height = (int) compute_new_value_from_arg(h, sel->geometry.height);
|
||||||
|
|
||||||
ox = sel->geometry.x;
|
ox = sel->geometry.x;
|
||||||
oy = sel->geometry.y;
|
oy = sel->geometry.y;
|
||||||
|
@ -818,7 +821,7 @@ uicb_client_moveresize(int screen, char *arg)
|
||||||
RootWindow(globalconf.display,
|
RootWindow(globalconf.display,
|
||||||
get_phys_screen(screen)),
|
get_phys_screen(screen)),
|
||||||
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||||
client_resize(sel, nx, ny, nw, nh, True, False);
|
client_resize(sel, area, True, False);
|
||||||
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
||||||
{
|
{
|
||||||
nmx = mx - ox + sel->geometry.width - ow - 1 < 0 ? 0 : mx - ox + sel->geometry.width - ow - 1;
|
nmx = mx - ox + sel->geometry.width - ow - 1 < 0 ? 0 : mx - ox + sel->geometry.width - ow - 1;
|
||||||
|
@ -866,6 +869,13 @@ uicb_client_kill(int screen __attribute__ ((unused)), char *arg __attribute__ ((
|
||||||
void
|
void
|
||||||
client_maximize(Client *c, int x, int y, int w, int h, Bool borders)
|
client_maximize(Client *c, int x, int y, int w, int h, Bool borders)
|
||||||
{
|
{
|
||||||
|
Area area;
|
||||||
|
|
||||||
|
area.x = x;
|
||||||
|
area.y = y;
|
||||||
|
area.width = w;
|
||||||
|
area.height = h;
|
||||||
|
|
||||||
if((c->ismax = !c->ismax))
|
if((c->ismax = !c->ismax))
|
||||||
{
|
{
|
||||||
if(borders)
|
if(borders)
|
||||||
|
@ -875,11 +885,10 @@ client_maximize(Client *c, int x, int y, int w, int h, Bool borders)
|
||||||
}
|
}
|
||||||
c->wasfloating = c->isfloating;
|
c->wasfloating = c->isfloating;
|
||||||
c->isfloating = True;
|
c->isfloating = True;
|
||||||
client_resize(c, x, y, w, h, False, True);
|
client_resize(c, area, False, True);
|
||||||
}
|
}
|
||||||
else if(c->wasfloating)
|
else if(c->wasfloating)
|
||||||
client_resize(c, c->f_geometry.x, c->f_geometry.y,
|
client_resize(c, c->f_geometry, True, False);
|
||||||
c->f_geometry.width, c->f_geometry.height, True, False);
|
|
||||||
else
|
else
|
||||||
c->isfloating = False;
|
c->isfloating = False;
|
||||||
|
|
||||||
|
|
2
client.h
2
client.h
|
@ -32,7 +32,7 @@ void client_detach(Client *);
|
||||||
void client_ban(Client *);
|
void client_ban(Client *);
|
||||||
void focus(Client *, Bool, int);
|
void focus(Client *, Bool, int);
|
||||||
void client_manage(Window, XWindowAttributes *, int);
|
void client_manage(Window, XWindowAttributes *, int);
|
||||||
void client_resize(Client *, int, int, int, int, Bool, Bool);
|
void client_resize(Client *, Area, Bool, Bool);
|
||||||
void client_unban(Client *);
|
void client_unban(Client *);
|
||||||
void client_unmanage(Client *, long);
|
void client_unmanage(Client *, long);
|
||||||
void client_updatewmhints(Client *);
|
void client_updatewmhints(Client *);
|
||||||
|
|
|
@ -30,16 +30,12 @@ extern AwesomeConf globalconf;
|
||||||
static void
|
static void
|
||||||
layout_fibonacci(int screen, int shape)
|
layout_fibonacci(int screen, int shape)
|
||||||
{
|
{
|
||||||
int n = 0, i = 0, nx, ny, nw, nh;
|
int n = 0, i = 0;
|
||||||
Client *c;
|
Client *c;
|
||||||
Area area = get_screen_area(screen,
|
Area geometry, area;
|
||||||
globalconf.screens[screen].statusbar,
|
geometry = area = get_screen_area(screen,
|
||||||
&globalconf.screens[screen].padding);
|
globalconf.screens[screen].statusbar,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
nx = area.x;
|
|
||||||
ny = area.y;
|
|
||||||
nw = area.width;
|
|
||||||
nh = area.height;
|
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
|
@ -48,44 +44,45 @@ layout_fibonacci(int screen, int shape)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
{
|
{
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
if((i % 2 && nh / 2 > 2 * c->border)
|
if((i % 2 && geometry.height / 2 > 2 * c->border)
|
||||||
|| (!(i % 2) && nw / 2 > 2 * c->border))
|
|| (!(i % 2) && geometry.width / 2 > 2 * c->border))
|
||||||
{
|
{
|
||||||
if(i < n - 1)
|
if(i < n - 1)
|
||||||
{
|
{
|
||||||
if(i % 2)
|
if(i % 2)
|
||||||
nh /= 2;
|
geometry.height /= 2;
|
||||||
else
|
else
|
||||||
nw /= 2;
|
geometry.width /= 2;
|
||||||
if((i % 4) == 2 && !shape)
|
if((i % 4) == 2 && !shape)
|
||||||
nx += nw;
|
geometry.x += geometry.width;
|
||||||
else if((i % 4) == 3 && !shape)
|
else if((i % 4) == 3 && !shape)
|
||||||
ny += nh;
|
geometry.y += geometry.height;
|
||||||
}
|
}
|
||||||
if((i % 4) == 0)
|
if((i % 4) == 0)
|
||||||
{
|
{
|
||||||
if(shape)
|
if(shape)
|
||||||
ny += nh;
|
geometry.y += geometry.height;
|
||||||
else
|
else
|
||||||
ny -= nh;
|
geometry.y -= geometry.height;
|
||||||
}
|
}
|
||||||
else if((i % 4) == 1)
|
else if((i % 4) == 1)
|
||||||
nx += nw;
|
geometry.x += geometry.width;
|
||||||
else if((i % 4) == 2)
|
else if((i % 4) == 2)
|
||||||
ny += nh;
|
geometry.y += geometry.height;
|
||||||
else if((i % 4) == 3)
|
else if((i % 4) == 3)
|
||||||
{
|
{
|
||||||
if(shape)
|
if(shape)
|
||||||
nx += nw;
|
geometry.x += geometry.width;
|
||||||
else
|
else
|
||||||
nx -= nw;
|
geometry.x -= geometry.width;
|
||||||
}
|
}
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
ny = area.y;
|
geometry.y = area.y;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
client_resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border,
|
geometry.width -= 2 * c->border;
|
||||||
globalconf.screens[screen].resize_hints, False);
|
geometry.height -= 2 * c->border;
|
||||||
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints, False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +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.x, c->f_geometry.y,
|
client_resize(c, c->f_geometry, True, False);
|
||||||
c->f_geometry.width, c->f_geometry.height, True, 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
|
||||||
|
|
|
@ -37,8 +37,12 @@ layout_max(int screen)
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
client_resize(c, area.x, area.y,
|
{
|
||||||
area.width - 2 * c->border,
|
area.width -= 2 * c->border;
|
||||||
area.height - 2 * c->border, globalconf.screens[screen].resize_hints, False);
|
area.height -= 2 * c->border;
|
||||||
|
client_resize(c, area, globalconf.screens[screen].resize_hints, False);
|
||||||
|
area.width += 2 * c->border;
|
||||||
|
area.height += 2 * c->border;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 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
|
||||||
|
|
|
@ -100,12 +100,11 @@ _tile(int screen, const Bool right)
|
||||||
/* windows area geometry */
|
/* windows area geometry */
|
||||||
int wah = 0, waw = 0, wax = 0, way = 0;
|
int wah = 0, waw = 0, wax = 0, way = 0;
|
||||||
/* new coordinates */
|
/* new coordinates */
|
||||||
unsigned int nx, ny, nw, nh;
|
|
||||||
/* master size */
|
/* master size */
|
||||||
unsigned int mw = 0, mh = 0;
|
unsigned int mw = 0, mh = 0;
|
||||||
int n, i, masterwin = 0, otherwin = 0;
|
int n, i, masterwin = 0, otherwin = 0;
|
||||||
int real_ncol = 1, win_by_col = 1, current_col = 0;
|
int real_ncol = 1, win_by_col = 1, current_col = 0;
|
||||||
Area area;
|
Area area, geometry;
|
||||||
Client *c;
|
Client *c;
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
|
|
||||||
|
@ -147,9 +146,11 @@ _tile(int screen, const Bool right)
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
if(i < curtags[0]->nmaster)
|
if(i < curtags[0]->nmaster)
|
||||||
{ /* master */
|
{ /* master */
|
||||||
ny = way + i * mh;
|
geometry.y = way + i * mh;
|
||||||
nx = wax + (right ? 0 : waw - mw);
|
geometry.x = wax + (right ? 0 : waw - mw);
|
||||||
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, globalconf.screens[screen].resize_hints, False);
|
geometry.width = mw - 2 * c->border;
|
||||||
|
geometry.height = mh - 2 * c->border;
|
||||||
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints, False);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* tile window */
|
{ /* tile window */
|
||||||
|
@ -163,19 +164,19 @@ _tile(int screen, const Bool right)
|
||||||
win_by_col += otherwin % real_ncol;
|
win_by_col += otherwin % real_ncol;
|
||||||
|
|
||||||
if(otherwin <= real_ncol)
|
if(otherwin <= real_ncol)
|
||||||
nh = wah - 2 * c->border;
|
geometry.height = wah - 2 * c->border;
|
||||||
else
|
else
|
||||||
nh = (wah / win_by_col) - 2 * c->border;
|
geometry.height = (wah / win_by_col) - 2 * c->border;
|
||||||
|
|
||||||
nw = (waw - mw) / real_ncol - 2 * c->border;
|
geometry.width = (waw - mw) / real_ncol - 2 * c->border;
|
||||||
|
|
||||||
if(i == curtags[0]->nmaster || otherwin <= real_ncol || (i - curtags[0]->nmaster) % win_by_col == 0)
|
if(i == curtags[0]->nmaster || otherwin <= real_ncol || (i - curtags[0]->nmaster) % win_by_col == 0)
|
||||||
ny = way;
|
geometry.y = way;
|
||||||
else
|
else
|
||||||
ny = way + ((i - curtags[0]->nmaster) % win_by_col) * (nh + 2 * c->border);
|
geometry.y = way + ((i - curtags[0]->nmaster) % win_by_col) * (geometry.height + 2 * c->border);
|
||||||
|
|
||||||
nx = wax + current_col * (nw + 2 * c->border) + (right ? mw : 0);
|
geometry.x = wax + current_col * (geometry.width + 2 * c->border) + (right ? mw : 0);
|
||||||
client_resize(c, nx, ny, nw, nh, globalconf.screens[screen].resize_hints, False);
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints, False);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
48
mouse.c
48
mouse.c
|
@ -43,11 +43,11 @@ extern AwesomeConf globalconf;
|
||||||
void
|
void
|
||||||
uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
int x1, y, ocx, ocy, di, nx, ny, phys_screen;
|
int x1, y, ocx, ocy, di, phys_screen;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
Window dummy;
|
Window dummy;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Area area;
|
Area area, geometry;
|
||||||
Client *c = globalconf.focus->client;
|
Client *c = globalconf.focus->client;
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
globalconf.screens[screen].statusbar,
|
globalconf.screens[screen].statusbar,
|
||||||
&globalconf.screens[screen].padding);
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
ocx = nx = c->geometry.x;
|
ocx = geometry.x = c->geometry.x;
|
||||||
ocy = ny = c->geometry.y;
|
ocy = geometry.y = c->geometry.y;
|
||||||
phys_screen = get_phys_screen(c->screen);
|
phys_screen = get_phys_screen(c->screen);
|
||||||
if(XGrabPointer(globalconf.display,
|
if(XGrabPointer(globalconf.display,
|
||||||
RootWindow(globalconf.display, phys_screen),
|
RootWindow(globalconf.display, phys_screen),
|
||||||
|
@ -97,17 +97,19 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
handle_event_maprequest(&ev);
|
handle_event_maprequest(&ev);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
nx = ocx + (ev.xmotion.x - x1);
|
geometry.x = ocx + (ev.xmotion.x - x1);
|
||||||
ny = ocy + (ev.xmotion.y - y);
|
geometry.y = ocy + (ev.xmotion.y - y);
|
||||||
if(abs(nx) < globalconf.screens[screen].snap + area.x && nx > area.x)
|
if(abs(geometry.x) < globalconf.screens[screen].snap + area.x && geometry.x > area.x)
|
||||||
nx = area.x;
|
geometry.x = area.x;
|
||||||
else if(abs((area.x + area.width) - (nx + c->geometry.width + 2 * c->border)) < globalconf.screens[screen].snap)
|
else if(abs((area.x + area.width) - (geometry.x + c->geometry.width + 2 * c->border)) < globalconf.screens[screen].snap)
|
||||||
nx = area.x + area.width - c->geometry.width - 2 * c->border;
|
geometry.x = area.x + area.width - c->geometry.width - 2 * c->border;
|
||||||
if(abs(ny) < globalconf.screens[screen].snap + area.y && ny > area.y)
|
if(abs(geometry.y) < globalconf.screens[screen].snap + area.y && geometry.y > area.y)
|
||||||
ny = area.y;
|
geometry.y = area.y;
|
||||||
else if(abs((area.y + area.height) - (ny + c->geometry.height + 2 * c->border)) < globalconf.screens[screen].snap)
|
else if(abs((area.y + area.height) - (geometry.y + c->geometry.height + 2 * c->border)) < globalconf.screens[screen].snap)
|
||||||
ny = area.y + area.height - c->geometry.height - 2 * c->border;
|
geometry.y = area.y + area.height - c->geometry.height - 2 * c->border;
|
||||||
client_resize(c, nx, ny, c->geometry.width, c->geometry.height, False, False);
|
geometry.width = c->geometry.width;
|
||||||
|
geometry.height = c->geometry.height;
|
||||||
|
client_resize(c, geometry, False, False);
|
||||||
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
|
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -122,11 +124,11 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
void
|
void
|
||||||
uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
int ocx = 0, ocy = 0, nw, nh, n;
|
int ocx = 0, ocy = 0, n;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Client *c = globalconf.focus->client;
|
Client *c = globalconf.focus->client;
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
Area area = { 0, 0, 0, 0 };
|
Area area = { 0, 0, 0, 0 }, geometry;
|
||||||
double mwfact;
|
double mwfact;
|
||||||
|
|
||||||
/* only handle floating and tiled layouts */
|
/* only handle floating and tiled layouts */
|
||||||
|
@ -191,11 +193,13 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
if(curtags[0]->layout->arrange == layout_floating || c->isfloating)
|
if(curtags[0]->layout->arrange == layout_floating || c->isfloating)
|
||||||
{
|
{
|
||||||
if((nw = ev.xmotion.x - ocx - 2 * c->border + 1) <= 0)
|
if((geometry.width = ev.xmotion.x - ocx - 2 * c->border + 1) <= 0)
|
||||||
nw = 1;
|
geometry.width = 1;
|
||||||
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
if((geometry.height = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
||||||
nh = 1;
|
geometry.height = 1;
|
||||||
client_resize(c, c->geometry.x, c->geometry.y, nw, nh, True, False);
|
geometry.x = c->geometry.x;
|
||||||
|
geometry.y = c->geometry.y;
|
||||||
|
client_resize(c, geometry, True, False);
|
||||||
}
|
}
|
||||||
else if(curtags[0]->layout->arrange == layout_tile
|
else if(curtags[0]->layout->arrange == layout_tile
|
||||||
|| curtags[0]->layout->arrange == layout_tileleft)
|
|| curtags[0]->layout->arrange == layout_tileleft)
|
||||||
|
|
3
screen.c
3
screen.c
|
@ -221,8 +221,7 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize)
|
||||||
if(c->f_geometry.y + c->f_geometry.height >= to.y + to.height)
|
if(c->f_geometry.y + c->f_geometry.height >= to.y + to.height)
|
||||||
c->f_geometry.y = to.y + to.height - c->f_geometry.height - 2 * c->border;
|
c->f_geometry.y = to.y + to.height - c->f_geometry.height - 2 * c->border;
|
||||||
|
|
||||||
client_resize(c, c->f_geometry.x, c->f_geometry.y,
|
client_resize(c, c->f_geometry, True, False);
|
||||||
c->f_geometry.width, c->f_geometry.height, True, False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
focus(c, True, c->screen);
|
focus(c, True, c->screen);
|
||||||
|
|
6
tag.c
6
tag.c
|
@ -216,11 +216,9 @@ uicb_client_togglefloating(int screen, char *arg __attribute__ ((unused)))
|
||||||
sel->isfloating = !sel->isfloating;
|
sel->isfloating = !sel->isfloating;
|
||||||
|
|
||||||
if (arg == NULL)
|
if (arg == NULL)
|
||||||
client_resize(sel, sel->f_geometry.x, sel->f_geometry.y,
|
client_resize(sel, sel->f_geometry, True, False);
|
||||||
sel->f_geometry.width, sel->f_geometry.height, True, False);
|
|
||||||
else
|
else
|
||||||
client_resize(sel, sel->geometry.x, sel->geometry.y,
|
client_resize(sel, sel->geometry, True, True);
|
||||||
sel->geometry.width, sel->geometry.height, True, True);
|
|
||||||
|
|
||||||
client_saveprops(sel);
|
client_saveprops(sel);
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
|
|
Loading…
Reference in New Issue