From fa3688d1a217877634bc8270fdb1f718d7c57614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 13 Jun 2024 15:03:47 -0600 Subject: [PATCH] revive push patch --- _STALE_PATCHES/push.md | 8 --- patches/push/README.md | 10 ++++ patches/push/push.patch | 128 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 8 deletions(-) delete mode 100644 _STALE_PATCHES/push.md create mode 100644 patches/push/README.md create mode 100644 patches/push/push.patch diff --git a/_STALE_PATCHES/push.md b/_STALE_PATCHES/push.md deleted file mode 100644 index 2d29b00..0000000 --- a/_STALE_PATCHES/push.md +++ /dev/null @@ -1,8 +0,0 @@ -### Description -Adds functions `pushup` and `pushdown` to move windows within the tiling order. - -### Download -- [2022-12-05](https://github.com/djpohly/dwl/compare/wlroots-next...djpohly:push.patch) - -### Authors -- [Devin J. Pohly](https://github.com/djpohly) \ No newline at end of file diff --git a/patches/push/README.md b/patches/push/README.md new file mode 100644 index 0000000..a3e9372 --- /dev/null +++ b/patches/push/README.md @@ -0,0 +1,10 @@ +### Description +Adds functions `pushup` and `pushdown` to move windows within the tiling order. + +### Download +- [git branch](https://codeberg.org/sevz/dwl/src/branch/push) +- [2024-06-13](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/push/push.patch) + +### Authors +- [sevz](https://codeberg.org/sevz) +- [Devin J. Pohly](https://github.com/djpohly) diff --git a/patches/push/push.patch b/patches/push/push.patch new file mode 100644 index 0000000..981ad7d --- /dev/null +++ b/patches/push/push.patch @@ -0,0 +1,128 @@ +From 74ba3dcaa28fd7eb1fca48851d640ec322093de2 Mon Sep 17 00:00:00 2001 +From: "Devin J. Pohly" +Date: Thu, 4 Mar 2021 00:45:50 -0600 +Subject: [PATCH] port dwm "push" patch to dwl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Leonardo Hernández Hernández +--- + Makefile | 3 +-- + dwl.c | 2 ++ + push.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + push.h | 4 ++++ + 4 files changed, 70 insertions(+), 2 deletions(-) + create mode 100644 push.c + create mode 100644 push.h + +diff --git a/Makefile b/Makefile +index e3e64262..447191e8 100644 +--- a/Makefile ++++ b/Makefile +@@ -16,8 +16,7 @@ LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) + all: dwl + dwl: dwl.o util.o + $(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ +-dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h +-util.o: util.c util.h ++dwl.o: dwl.c push.h client.h config.h config.mk cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h + + # wayland-scanner is a tool which generates C headers and rigging for Wayland + # protocols, which are specified in XML. wlroots requires you to rig these up +diff --git a/dwl.c b/dwl.c +index 6f041a0d..60b65794 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -421,7 +421,9 @@ static xcb_atom_t netatom[NetLast]; + #endif + + /* configuration, allows nested code to access above variables */ ++#include "push.h" + #include "config.h" ++#include "push.c" + + /* attempt to encapsulate suck into one file */ + #include "client.h" +diff --git a/push.c b/push.c +new file mode 100644 +index 00000000..323c317e +--- /dev/null ++++ b/push.c +@@ -0,0 +1,63 @@ ++static Client * ++nexttiled(Client *sel) { ++ Client *c; ++ wl_list_for_each(c, &sel->link, link) { ++ if (&c->link == &clients) ++ break; /* don't wrap */ ++ if (!c->isfloating && VISIBLEON(c, selmon)) ++ return c; ++ } ++ return NULL; ++} ++ ++static Client * ++prevtiled(Client *sel) { ++ Client *c; ++ wl_list_for_each_reverse(c, &sel->link, link) { ++ if (&c->link == &clients) ++ break; /* don't wrap */ ++ if (!c->isfloating && VISIBLEON(c, selmon)) ++ return c; ++ } ++ return NULL; ++} ++ ++static void ++pushup(const Arg *arg) { ++ Client *sel = focustop(selmon); ++ Client *c; ++ ++ if(!sel || sel->isfloating) ++ return; ++ if((c = prevtiled(sel))) { ++ /* attach before c */ ++ wl_list_remove(&sel->link); ++ wl_list_insert(c->link.prev, &sel->link); ++ } else { ++ /* move to the end */ ++ wl_list_remove(&sel->link); ++ wl_list_insert(clients.prev, &sel->link); ++ } ++ focusclient(sel, 1); ++ arrange(selmon); ++} ++ ++static void ++pushdown(const Arg *arg) { ++ Client *sel = focustop(selmon); ++ Client *c; ++ ++ if(!sel || sel->isfloating) ++ return; ++ if((c = nexttiled(sel))) { ++ /* attach after c */ ++ wl_list_remove(&sel->link); ++ wl_list_insert(&c->link, &sel->link); ++ } else { ++ /* move to the front */ ++ wl_list_remove(&sel->link); ++ wl_list_insert(&clients, &sel->link); ++ } ++ focusclient(sel, 1); ++ arrange(selmon); ++} +diff --git a/push.h b/push.h +new file mode 100644 +index 00000000..59c0f80e +--- /dev/null ++++ b/push.h +@@ -0,0 +1,4 @@ ++static Client *nexttiled(Client *sel); ++static Client *prevtiled(Client *sel); ++static void pushdown(const Arg *arg); ++static void pushup(const Arg *arg); +-- +2.45.2 +