From b6fc47474e6ccab5c468419dd988b060c0f957c4 Mon Sep 17 00:00:00 2001 From: coast Date: Thu, 29 May 2025 22:44:19 +0200 Subject: [PATCH] Upload files to ".suckless/patch" --- .suckless/patch/layout_tile.h | 2 ++ .suckless/patch/moveresize.c | 65 +++++++++++++++++++++++++++++++++++ .suckless/patch/moveresize.h | 2 ++ .suckless/patch/movestack.c | 51 +++++++++++++++++++++++++++ .suckless/patch/movestack.h | 2 ++ 5 files changed, 122 insertions(+) create mode 100644 .suckless/patch/layout_tile.h create mode 100644 .suckless/patch/moveresize.c create mode 100644 .suckless/patch/moveresize.h create mode 100644 .suckless/patch/movestack.c create mode 100644 .suckless/patch/movestack.h diff --git a/.suckless/patch/layout_tile.h b/.suckless/patch/layout_tile.h new file mode 100644 index 0000000..78cafc8 --- /dev/null +++ b/.suckless/patch/layout_tile.h @@ -0,0 +1,2 @@ +static void tile(Monitor *); + diff --git a/.suckless/patch/moveresize.c b/.suckless/patch/moveresize.c new file mode 100644 index 0000000..75d58e2 --- /dev/null +++ b/.suckless/patch/moveresize.c @@ -0,0 +1,65 @@ +void +moveresize(const Arg *arg) { + /* only floating windows can be moved */ + Client *c; + c = selmon->sel; + int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh; + char xAbs, yAbs, wAbs, hAbs; + int msx, msy, dx, dy, nmx, nmy; + unsigned int dui; + Window dummy; + + if (!c || !arg) + return; + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) + return; + if (sscanf((char *)arg->v, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8) + return; + + /* compute new window position; prevent window from be positioned outside the current monitor */ + nw = c->w + w; + if (wAbs == 'W') + nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw; + + nh = c->h + h; + if (hAbs == 'H') + nh = h < selmon->mh - 2 * c->bw ? h : selmon->mh - 2 * c->bw; + + nx = c->x + x; + if (xAbs == 'X') { + if (x < selmon->mx) + nx = selmon->mx; + else if (x > selmon->mx + selmon->mw) + nx = selmon->mx + selmon->mw - nw - 2 * c->bw; + else + nx = x; + } + + ny = c->y + y; + if (yAbs == 'Y') { + if (y < selmon->my) + ny = selmon->my; + else if (y > selmon->my + selmon->mh) + ny = selmon->my + selmon->mh - nh - 2 * c->bw; + else + ny = y; + } + + ox = c->x; + oy = c->y; + ow = c->w; + oh = c->h; + + XRaiseWindow(dpy, c->win); + Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &msx, &msy, &dx, &dy, &dui); + resize(c, nx, ny, nw, nh, True); + + /* move cursor along with the window to avoid problems caused by the sloppy focus */ + if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy) + { + nmx = c->x - ox + c->w - ow; + nmy = c->y - oy + c->h - oh; + XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); + } +} + diff --git a/.suckless/patch/moveresize.h b/.suckless/patch/moveresize.h new file mode 100644 index 0000000..919ebad --- /dev/null +++ b/.suckless/patch/moveresize.h @@ -0,0 +1,2 @@ +static void moveresize(const Arg *arg); + diff --git a/.suckless/patch/movestack.c b/.suckless/patch/movestack.c new file mode 100644 index 0000000..fe97f1d --- /dev/null +++ b/.suckless/patch/movestack.c @@ -0,0 +1,51 @@ +void +movestack(const Arg *arg) +{ + Client *c = NULL, *p = NULL, *pc = NULL, *i; + if (arg->i > 0) { + if (!selmon->sel) + return; + /* find the client after selmon->sel */ + for (c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next); + if (!c) + for (c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next); + } + else { + /* find the client before selmon->sel */ + for (i = selmon->clients; i != selmon->sel; i = i->next) + if(ISVISIBLE(i) && !i->isfloating) + c = i; + if (!c) + for (; i; i = i->next) + if (ISVISIBLE(i) && !i->isfloating) + c = i; + } + + /* find the client before selmon->sel and c */ + for (i = selmon->clients; i && (!p || !pc); i = i->next) { + if (i->next == selmon->sel) + p = i; + if (i->next == c) + pc = i; + } + + /* swap c and selmon->sel selmon->clients in the selmon->clients list */ + if (c && c != selmon->sel) { + Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next; + selmon->sel->next = c->next==selmon->sel?c:c->next; + c->next = temp; + + if (p && p != c) + p->next = c; + if (pc && pc != selmon->sel) + pc->next = selmon->sel; + + if (selmon->sel == selmon->clients) + selmon->clients = c; + else if (c == selmon->clients) + selmon->clients = selmon->sel; + + arrange(selmon); + } +} + diff --git a/.suckless/patch/movestack.h b/.suckless/patch/movestack.h new file mode 100644 index 0000000..25f198f --- /dev/null +++ b/.suckless/patch/movestack.h @@ -0,0 +1,2 @@ +static void movestack(const Arg *arg); +