Adding sticky and warp patches

This commit is contained in:
bakkeby
2019-09-15 00:43:35 +02:00
parent 713c4e6197
commit 30e0a3b5e4
11 changed files with 83 additions and 5 deletions

View File

@ -58,6 +58,10 @@
#include "setborderpx.c"
#endif
#if STICKY_PATCH
#include "sticky.c"
#endif
#if SYSTRAY_PATCH
#include "systray.c"
#endif
@ -78,6 +82,10 @@
#include "vanitygaps.c"
#endif
#if WARP_PATCH
#include "warp.c"
#endif
#if ZOOMSWAP_PATCH
#include "zoomswap.c"
#endif

View File

@ -54,6 +54,10 @@
#include "setborderpx.h"
#endif
#if STICKY_PATCH
#include "sticky.h"
#endif
#if SYSTRAY_PATCH
#include "systray.h"
#endif

View File

@ -34,7 +34,7 @@ pushup(const Arg *arg)
if (selmon->clients == c)
selmon->clients = sel;
else {
for (c f selmon->clients; c->next != sel->next; c = c->next);
for (c = selmon->clients; c->next != sel->next; c = c->next);
c->next = sel;
}
} else {

8
patch/sticky.c Normal file
View File

@ -0,0 +1,8 @@
void
togglesticky(const Arg *arg)
{
if (!selmon->sel)
return;
selmon->sel->issticky = !selmon->sel->issticky;
arrange(selmon);
}

1
patch/sticky.h Normal file
View File

@ -0,0 +1 @@
static void togglesticky(const Arg *arg);

21
patch/warp.c Normal file
View File

@ -0,0 +1,21 @@
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);
}

1
patch/warp.h Normal file
View File

@ -0,0 +1 @@
static void warp(const Client *c);