add patch files
This commit is contained in:
parent
73cef0ffb0
commit
947657dacf
|
@ -0,0 +1,228 @@
|
|||
diff --git a/Makefile b/Makefile
|
||||
index 1f56cd4..4e295ac 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -20,7 +20,7 @@ CPPFLAGS+= `${PKG_CONFIG} --cflags x11 xft xrandr`
|
||||
|
||||
CFLAGS?= -Wall -O2 -g -D_GNU_SOURCE
|
||||
|
||||
-LDFLAGS+= `${PKG_CONFIG} --libs x11 xft xrandr`
|
||||
+LDFLAGS+= `${PKG_CONFIG} --libs x11 xft xrandr` -lm
|
||||
|
||||
MANPREFIX?= ${PREFIX}/share/man
|
||||
|
||||
diff --git a/calmwm.h b/calmwm.h
|
||||
index b3992c3..42ed9a4 100644
|
||||
--- a/calmwm.h
|
||||
+++ b/calmwm.h
|
||||
@@ -429,6 +429,7 @@ struct client_ctx *client_find(Window);
|
||||
void client_get_sizehints(struct client_ctx *);
|
||||
void client_hide(struct client_ctx *);
|
||||
void client_htile(struct client_ctx *);
|
||||
+void client_hfair(struct client_ctx *);
|
||||
int client_inbound(struct client_ctx *, int, int);
|
||||
struct client_ctx *client_init(Window, struct screen_ctx *);
|
||||
void client_lower(struct client_ctx *);
|
||||
@@ -458,6 +459,7 @@ void client_toggle_vmaximize(struct client_ctx *);
|
||||
void client_transient(struct client_ctx *);
|
||||
void client_urgency(struct client_ctx *);
|
||||
void client_vtile(struct client_ctx *);
|
||||
+void client_vfair(struct client_ctx *);
|
||||
void client_wm_hints(struct client_ctx *);
|
||||
|
||||
void group_assign(struct group_ctx *, struct client_ctx *);
|
||||
@@ -528,7 +530,9 @@ void kbfunc_client_toggle_maximize(void *, struct cargs *);
|
||||
void kbfunc_client_toggle_hmaximize(void *, struct cargs *);
|
||||
void kbfunc_client_toggle_vmaximize(void *, struct cargs *);
|
||||
void kbfunc_client_htile(void *, struct cargs *);
|
||||
+void kbfunc_client_hfair(void *, struct cargs *);
|
||||
void kbfunc_client_vtile(void *, struct cargs *);
|
||||
+void kbfunc_client_vfair(void *, struct cargs *);
|
||||
void kbfunc_client_cycle(void *, struct cargs *);
|
||||
void kbfunc_client_toggle_group(void *, struct cargs *);
|
||||
void kbfunc_client_movetogroup(void *, struct cargs *);
|
||||
diff --git a/client.c b/client.c
|
||||
index 59bc7b0..eba9a37 100644
|
||||
--- a/client.c
|
||||
+++ b/client.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <math.h>
|
||||
|
||||
#include "calmwm.h"
|
||||
|
||||
@@ -1047,3 +1048,117 @@ client_vtile(struct client_ctx *cc)
|
||||
client_resize(ci, 1);
|
||||
}
|
||||
}
|
||||
+
|
||||
+void
|
||||
+client_vfair(struct client_ctx *cc)
|
||||
+{
|
||||
+ struct client_ctx *ci;
|
||||
+ struct screen_ctx *sc = cc->sc;
|
||||
+ struct geom area;
|
||||
+ int i, n, w, h, rows, cols, rh, t;
|
||||
+
|
||||
+ i = n = 0;
|
||||
+ area = screen_area(sc,
|
||||
+ cc->geom.x + cc->geom.w / 2,
|
||||
+ cc->geom.y + cc->geom.h / 2, 1);
|
||||
+
|
||||
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
+ if (ci->gc != cc->gc)
|
||||
+ continue;
|
||||
+ if (ci->flags & CLIENT_HIDDEN ||
|
||||
+ ci->flags & CLIENT_IGNORE ||
|
||||
+ ci->geom.x < area.x ||
|
||||
+ ci->geom.x > (area.x + area.w) ||
|
||||
+ ci->geom.y < area.y ||
|
||||
+ ci->geom.y > (area.y + area.h))
|
||||
+ continue;
|
||||
+ n++;
|
||||
+ }
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
+ rows = (n == 2) ? 1 : ceil(sqrt(n));
|
||||
+ cols = ceil((double)n / rows);
|
||||
+ w = area.w / cols;
|
||||
+ h = area.h / rows;
|
||||
+ rh = area.h / (n % rows == 0 ? rows : n % rows);
|
||||
+ t = rows * (cols - 1);
|
||||
+
|
||||
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
+ if (ci->gc != cc->gc)
|
||||
+ continue;
|
||||
+ if (ci->flags & CLIENT_HIDDEN ||
|
||||
+ ci->flags & CLIENT_IGNORE ||
|
||||
+ ci->geom.x < area.x ||
|
||||
+ ci->geom.x > (area.x + area.w) ||
|
||||
+ ci->geom.y < area.y ||
|
||||
+ ci->geom.y > (area.y + area.h))
|
||||
+ continue;
|
||||
+ ci->bwidth = Conf.bwidth;
|
||||
+ ci->geom.x = area.x + (i / rows) * w;
|
||||
+ ci->geom.y = area.y + (i % rows) * (i < t ? h : rh);
|
||||
+ ci->geom.w = w - (ci->bwidth * 2);
|
||||
+ ci->geom.h = (i < t ? h : rh) - (ci->bwidth * 2);
|
||||
+ i++;
|
||||
+ client_resize(ci, 1);
|
||||
+ }
|
||||
+ client_ptr_warp(cc);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+client_hfair(struct client_ctx *cc)
|
||||
+{
|
||||
+ struct client_ctx *ci;
|
||||
+ struct screen_ctx *sc = cc->sc;
|
||||
+ struct geom area;
|
||||
+ int i, n, w, h, rows, cols, rw, t;
|
||||
+
|
||||
+ i = n = 0;
|
||||
+ area = screen_area(sc,
|
||||
+ cc->geom.x + cc->geom.w / 2,
|
||||
+ cc->geom.y + cc->geom.h / 2, 1);
|
||||
+
|
||||
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
+ if (ci->gc != cc->gc)
|
||||
+ continue;
|
||||
+ if (ci->flags & CLIENT_HIDDEN ||
|
||||
+ ci->flags & CLIENT_IGNORE ||
|
||||
+ ci->geom.x < area.x ||
|
||||
+ ci->geom.x > (area.x + area.w) ||
|
||||
+ ci->geom.y < area.y ||
|
||||
+ ci->geom.y > (area.y + area.h))
|
||||
+ continue;
|
||||
+ n++;
|
||||
+ }
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
+ cols = (n == 2) ? 1 : ceil(sqrt(n));
|
||||
+ rows = ceil((double)n / cols);
|
||||
+ w = area.w / cols;
|
||||
+ h = area.h / rows;
|
||||
+ rw = area.w / (n % cols == 0 ? cols : n % cols);
|
||||
+ t = cols * (rows - 1);
|
||||
+
|
||||
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
+ if (ci->gc != cc->gc)
|
||||
+ continue;
|
||||
+ if (ci->flags & CLIENT_HIDDEN ||
|
||||
+ ci->flags & CLIENT_IGNORE ||
|
||||
+ ci->geom.x < area.x ||
|
||||
+ ci->geom.x > (area.x + area.w) ||
|
||||
+ ci->geom.y < area.y ||
|
||||
+ ci->geom.y > (area.y + area.h))
|
||||
+ continue;
|
||||
+ ci->bwidth = Conf.bwidth;
|
||||
+ ci->geom.y = area.y + (i / cols) * h;
|
||||
+ ci->geom.x = area.x + (i % cols) * (i < t ? w : rw);
|
||||
+ ci->geom.h = h - (ci->bwidth * 2);
|
||||
+ ci->geom.w = (i < t ? w : rw) - (ci->bwidth * 2);
|
||||
+ i++;
|
||||
+ client_resize(ci, 1);
|
||||
+ }
|
||||
+ client_ptr_warp(cc);
|
||||
+}
|
||||
diff --git a/conf.c b/conf.c
|
||||
index 7d3ae6e..dbd9ed0 100644
|
||||
--- a/conf.c
|
||||
+++ b/conf.c
|
||||
@@ -86,6 +86,8 @@ static const struct {
|
||||
{ FUNC_CC(window-delete, client_close, 0) },
|
||||
{ FUNC_CC(window-htile, client_htile, 0) },
|
||||
{ FUNC_CC(window-vtile, client_vtile, 0) },
|
||||
+ { FUNC_CC(window-hfair, client_hfair, 0) },
|
||||
+ { FUNC_CC(window-vfair, client_vfair, 0) },
|
||||
{ FUNC_CC(window-stick, client_toggle_sticky, 0) },
|
||||
{ FUNC_CC(window-fullscreen, client_toggle_fullscreen, 0) },
|
||||
{ FUNC_CC(window-maximize, client_toggle_maximize, 0) },
|
||||
diff --git a/cwmrc.5 b/cwmrc.5
|
||||
index 7075288..4046a97 100644
|
||||
--- a/cwmrc.5
|
||||
+++ b/cwmrc.5
|
||||
@@ -329,6 +329,14 @@ and resized to
|
||||
.Ar vtile
|
||||
(default half) of the horizontal screen space.
|
||||
Other windows in its group share remaining screen space.
|
||||
+.It window-hfair
|
||||
+Current window is placed at the top left of the screen, and all windows
|
||||
+attempt to occupy the screen space fairly, with remainder windows being
|
||||
+distributed evenly along the bottom.
|
||||
+.It window-vfair
|
||||
+Current window is placed at the top left of the screen, and all windows
|
||||
+attempt to occupy the screen space fairly, with remainder windows being
|
||||
+distributed evenly along the right side.
|
||||
.It window-move
|
||||
Move current window.
|
||||
.It window-resize
|
||||
diff --git a/kbfunc.c b/kbfunc.c
|
||||
index ed1d7cb..bb12595 100644
|
||||
--- a/kbfunc.c
|
||||
+++ b/kbfunc.c
|
||||
@@ -401,6 +401,18 @@ kbfunc_client_vtile(void *ctx, struct cargs *cargs)
|
||||
client_vtile(ctx);
|
||||
}
|
||||
|
||||
+void
|
||||
+kbfunc_client_vfair(void *ctx, struct cargs *cargs)
|
||||
+{
|
||||
+ client_vfair(ctx);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+kbfunc_client_hfair(void *ctx, struct cargs *cargs)
|
||||
+{
|
||||
+ client_hfair(ctx);
|
||||
+}
|
||||
+
|
||||
void
|
||||
kbfunc_client_cycle(void *ctx, struct cargs *cargs)
|
||||
{
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/client.c b/client.c
|
||||
index 59bc7b0..8fa4f6b 100644
|
||||
--- a/client.c
|
||||
+++ b/client.c
|
||||
@@ -938,11 +938,7 @@ client_htile(struct client_ctx *cc)
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
- if (cc->flags & CLIENT_VMAXIMIZED ||
|
||||
- cc->geom.h + (cc->bwidth * 2) >= area.h)
|
||||
- return;
|
||||
-
|
||||
- cc->flags &= ~CLIENT_HMAXIMIZED;
|
||||
+ cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.y = area.y;
|
||||
cc->geom.w = area.w - (cc->bwidth * 2);
|
||||
@@ -1007,11 +1003,7 @@ client_vtile(struct client_ctx *cc)
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
- if (cc->flags & CLIENT_HMAXIMIZED ||
|
||||
- cc->geom.w + (cc->bwidth * 2) >= area.w)
|
||||
- return;
|
||||
-
|
||||
- cc->flags &= ~CLIENT_VMAXIMIZED;
|
||||
+ cc->flags &= ~CLIENT_MAXIMIZED;
|
||||
cc->geom.x = area.x;
|
||||
cc->geom.y = area.y;
|
||||
if (Conf.vtile > 0)
|
|
@ -0,0 +1,31 @@
|
|||
diff --git a/conf.c b/conf.c
|
||||
index 7d3ae6e..68bf157 100644
|
||||
--- a/conf.c
|
||||
+++ b/conf.c
|
||||
@@ -40,16 +40,16 @@ static const struct {
|
||||
int num;
|
||||
const char *name;
|
||||
} group_binds[] = {
|
||||
- { 0, "nogroup" },
|
||||
- { 1, "one" },
|
||||
- { 2, "two" },
|
||||
- { 3, "three" },
|
||||
- { 4, "four" },
|
||||
- { 5, "five" },
|
||||
- { 6, "six" },
|
||||
- { 7, "seven" },
|
||||
- { 8, "eight" },
|
||||
- { 9, "nine" },
|
||||
+ { 0, "0" },
|
||||
+ { 1, "I" },
|
||||
+ { 2, "II" },
|
||||
+ { 3, "III" },
|
||||
+ { 4, "IV" },
|
||||
+ { 5, "V" },
|
||||
+ { 6, "VI" },
|
||||
+ { 7, "VII" },
|
||||
+ { 8, "VIII" },
|
||||
+ { 9, "IX" },
|
||||
};
|
||||
static int cursor_binds[] = {
|
||||
XC_left_ptr, /* CF_NORMAL */
|
|
@ -0,0 +1,30 @@
|
|||
diff --git a/client.c b/client.c
|
||||
index 59bc7b0..9c04175 100644
|
||||
--- a/client.c
|
||||
+++ b/client.c
|
||||
@@ -652,6 +652,25 @@ client_wm_hints(struct client_ctx *cc)
|
||||
void
|
||||
client_close(struct client_ctx *cc)
|
||||
{
|
||||
+ struct client_ctx *newcc = cc;
|
||||
+ struct screen_ctx *sc = cc->sc;
|
||||
+
|
||||
+ TAILQ_FOREACH(newcc, &sc->clientq, entry) {
|
||||
+ if (newcc->gc != cc->gc)
|
||||
+ continue;
|
||||
+ if (newcc->flags & CLIENT_HIDDEN ||
|
||||
+ newcc->flags & CLIENT_IGNORE || (newcc == cc))
|
||||
+ continue;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (newcc != NULL) {
|
||||
+ if (newcc->ptr.x < 0 || newcc->ptr.x > newcc->geom.w ||
|
||||
+ newcc->ptr.y < 0 || newcc->ptr.y > newcc->geom.h) {
|
||||
+ newcc->ptr.x = newcc->geom.w / 2;
|
||||
+ newcc->ptr.y = newcc->geom.h / 2;
|
||||
+ }
|
||||
+ client_ptr_warp(newcc);
|
||||
+ }
|
||||
if (cc->flags & CLIENT_WM_DELETE_WINDOW)
|
||||
xu_send_clientmsg(cc->win, cwmh[WM_DELETE_WINDOW], CurrentTime);
|
||||
else
|
Loading…
Reference in New Issue