Clean up, unify and accurately calculate edge distance with client move/resize
actions, so as to not lose windows off the edge. inspired by diffs (and feedback) from Vadim Vygonets.
This commit is contained in:
18
client.c
18
client.c
@@ -470,6 +470,24 @@ client_config(struct client_ctx *cc)
|
||||
XSendEvent(X_Dpy, cc->win, False, StructureNotifyMask, (XEvent *)&cn);
|
||||
}
|
||||
|
||||
void
|
||||
client_ptr_inbound(struct client_ctx *cc, int getpos)
|
||||
{
|
||||
if (getpos)
|
||||
xu_ptr_getpos(cc->win, &cc->ptr.x, &cc->ptr.y);
|
||||
|
||||
if (cc->ptr.x < 0)
|
||||
cc->ptr.x = 0;
|
||||
else if (cc->ptr.x > cc->geom.w - 1)
|
||||
cc->ptr.x = cc->geom.w - 1;
|
||||
if (cc->ptr.y < 0)
|
||||
cc->ptr.y = 0;
|
||||
else if (cc->ptr.y > cc->geom.h - 1)
|
||||
cc->ptr.y = cc->geom.h - 1;
|
||||
|
||||
client_ptrwarp(cc);
|
||||
}
|
||||
|
||||
void
|
||||
client_ptrwarp(struct client_ctx *cc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user