Merged warp patch

This commit is contained in:
jon
2019-01-13 18:28:55 -06:00
parent a8d736dab5
commit 8dffa5a1e7
6 changed files with 26 additions and 2306 deletions

BIN
drw.o

Binary file not shown.

BIN
dwm

Binary file not shown.

26
dwm.c
View File

@@ -245,6 +245,7 @@ static void updatewindowtype(Client *c);
static void updatetitle(Client *c); static void updatetitle(Client *c);
static void updatewmhints(Client *c); static void updatewmhints(Client *c);
static void view(const Arg *arg); static void view(const Arg *arg);
static void warp(const Client *c);
static pid_t winpid(Window w); static pid_t winpid(Window w);
static Client *wintoclient(Window w); static Client *wintoclient(Window w);
static Monitor *wintomon(Window w); static Monitor *wintomon(Window w);
@@ -951,6 +952,7 @@ focusmon(const Arg *arg)
in gedit and anjuta */ in gedit and anjuta */
selmon = m; selmon = m;
focus(NULL); focus(NULL);
warp(selmon->sel);
} }
void void
@@ -1525,6 +1527,8 @@ restack(Monitor *m)
} }
XSync(dpy, False); XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if (m == selmon && (m->tagset[m->seltags] & m->sel->tags))
warp(m->sel);
} }
void void
@@ -2384,6 +2388,28 @@ swallowingclient(Window w)
return NULL; return NULL;
} }
void
warp(const Client *c)
{
int x, y;
if (!c) {
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
return;
}
if (!getrootptr(&x, &y) ||
(x > c->x - c->bw &&
y > c->y - c->bw &&
x < c->x + c->w + c->bw*2 &&
y < c->y + c->h + c->bw*2) ||
(y > c->mon->by && y < c->mon->by + bh) ||
(c->mon->topbar && !y))
return;
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
}
Client * Client *
wintoclient(Window w) wintoclient(Window w)
{ {

2306
dwm.c.orig

File diff suppressed because it is too large Load Diff

BIN
dwm.o

Binary file not shown.

BIN
util.o

Binary file not shown.