summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2011-05-07 17:15:37 +0000
committerokan <okan>2011-05-07 17:15:37 +0000
commit43450c8fd744b85aaed80da3f6132acfd4dafd8c (patch)
tree1864a34a893025fbdab1db45e6ba5cca50215fda
parent760c6b5522626145662eb423ec77ccf4d19da584 (diff)
downloadcwm-43450c8fd744b85aaed80da3f6132acfd4dafd8c.tar.gz
cwm-43450c8fd744b85aaed80da3f6132acfd4dafd8c.tar.xz
cwm-43450c8fd744b85aaed80da3f6132acfd4dafd8c.zip
introduce a new 'freeze' flag (CMS-f by default) which may be applied to
any window, after which all move/resize requests will be ignored,
essentially freezing the window in place.

there's a possibility to merge this with the 'ignore' concept, pending
on how ignore+freeze should behave (really more ewmh stuff), but punting
for now since ponies are on the line.

requested and tested by thib at k2k11 with ponies, unicorns and rainbows.

'save the unicorns' todd@, ok oga@
-rw-r--r--calmwm.h3
-rw-r--r--client.c18
-rw-r--r--conf.c2
-rw-r--r--cwm.14
-rw-r--r--cwmrc.52
-rw-r--r--kbfunc.c9
-rw-r--r--mousefunc.c6
7 files changed, 43 insertions, 1 deletions
diff --git a/calmwm.h b/calmwm.h
index b213312..7a758d1 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -150,6 +150,7 @@ struct client_ctx {
 #define CLIENT_VMAXIMIZED		0x0020
 #define CLIENT_DOHMAXIMIZE		0x0040
 #define CLIENT_HMAXIMIZED		0x0080
+#define CLIENT_FREEZE			0x0100
 	int			 flags;
 	int			 state;
 	int			 active;
@@ -314,6 +315,7 @@ struct client_ctx	*client_cycle(struct screen_ctx *, int);
 int			 client_delete(struct client_ctx *);
 void			 client_draw_border(struct client_ctx *);
 struct client_ctx	*client_find(Window);
+void			 client_freeze(struct client_ctx *);
 void			 client_getsizehints(struct client_ctx *);
 void			 client_hide(struct client_ctx *);
 void			 client_horizmaximize(struct client_ctx *);
@@ -368,6 +370,7 @@ void			 kbfunc_client_cycle(struct client_ctx *, union arg *);
 void			 kbfunc_client_cyclegroup(struct client_ctx *,
 			     union arg *);
 void			 kbfunc_client_delete(struct client_ctx *, union arg *);
+void			 kbfunc_client_freeze(struct client_ctx *, union arg *);
 void			 kbfunc_client_group(struct client_ctx *, union arg *);
 void			 kbfunc_client_grouponly(struct client_ctx *,
 			     union arg *);
diff --git a/client.c b/client.c
index 237c0ce..1767f44 100644
--- a/client.c
+++ b/client.c
@@ -265,12 +265,24 @@ client_current(void)
 }
 
 void
+client_freeze(struct client_ctx *cc)
+{
+	if (cc->flags & CLIENT_FREEZE)
+		cc->flags &= ~CLIENT_FREEZE;
+	else
+		cc->flags |= CLIENT_FREEZE;
+}
+
+void
 client_maximize(struct client_ctx *cc)
 {
 	struct screen_ctx	*sc = cc->sc;
 	int			 xmax = sc->xmax, ymax = sc->ymax;
 	int			 x_org = 0, y_org = 0;
 
+	if (cc->flags & CLIENT_FREEZE)
+		return;
+
 	if (cc->flags & CLIENT_MAXIMIZED) {
 		cc->geom = cc->savegeom;
 	} else {
@@ -310,6 +322,9 @@ client_vertmaximize(struct client_ctx *cc)
 	struct screen_ctx	*sc = cc->sc;
 	int			 y_org = 0, ymax = sc->ymax;
 
+	if (cc->flags & CLIENT_FREEZE)
+		return;
+
 	if (cc->flags & CLIENT_VMAXIMIZED) {
 		cc->geom = cc->savegeom;
 	} else {
@@ -341,6 +356,9 @@ client_horizmaximize(struct client_ctx *cc)
 	struct screen_ctx	*sc = cc->sc;
 	int			 x_org = 0, xmax = sc->xmax;
 
+	if (cc->flags & CLIENT_FREEZE)
+		return;
+
 	if (cc->flags & CLIENT_HMAXIMIZED) {
 		cc->geom = cc->savegeom;
 	} else {
diff --git a/conf.c b/conf.c
index b453405..f61099d 100644
--- a/conf.c
+++ b/conf.c
@@ -138,6 +138,7 @@ static struct {
 	{ "CM-f",	"maximize" },
 	{ "CM-equal",	"vmaximize" },
 	{ "CMS-equal",	"hmaximize" },
+	{ "CMS-f",	"freeze" },
 	{ "CMS-r",	"reload" },
 	{ "CMS-q",	"quit" },
 	{ "M-h",	"moveleft" },
@@ -361,6 +362,7 @@ static struct {
 	{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} },
 	{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
 	{ "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
+	{ "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
 	{ "reload", kbfunc_reload, 0, {0} },
 	{ "quit", kbfunc_quit_wm, 0, {0} },
 	{ "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
diff --git a/cwm.1 b/cwm.1
index 1282798..1b82f12 100644
--- a/cwm.1
+++ b/cwm.1
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: August 24 2009 $
+.Dd $Mdocdate: September 25 2010 $
 .Dt CWM 1
 .Os
 .Sh NAME
@@ -88,6 +88,8 @@ Toggle group membership of current window.
 Cycle through active groups.
 .It Ic M-Left
 Reverse cycle through active groups.
+.It Ic CMS-f
+Toggle freezing geometry of current window.
 .It Ic CM-f
 Toggle full-screen size of current window.
 .It Ic CM-=
diff --git a/cwmrc.5 b/cwmrc.5
index 800e253..a0544ff 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -287,6 +287,8 @@ Lower current window.
 Raise current window.
 .It label
 Label current window.
+.It freeze
+Freeze current window geometry.
 .It maximize
 Maximize current window full-screen.
 .It vmaximize
diff --git a/kbfunc.c b/kbfunc.c
index c4ee7ed..fc2aede 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -58,6 +58,9 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
 	int			 x, y, flags, amt;
 	u_int			 mx, my;
 
+	if (cc->flags & CLIENT_FREEZE)
+		return;
+
 	sc = cc->sc;
 	mx = my = 0;
 
@@ -480,6 +483,12 @@ kbfunc_client_hmaximize(struct client_ctx *cc, union arg *arg)
 }
 
 void
+kbfunc_client_freeze(struct client_ctx *cc, union arg *arg)
+{
+	client_freeze(cc);
+}
+
+void
 kbfunc_quit_wm(struct client_ctx *cc, union arg *arg)
 {
 	_xev_quit = 1;
diff --git a/mousefunc.c b/mousefunc.c
index 30eed53..c5537fa 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -84,6 +84,9 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg)
 	struct screen_ctx	*sc = cc->sc;
 	int			 x = cc->geom.x, y = cc->geom.y;
 
+	if (cc->flags & CLIENT_FREEZE)
+		return;
+
 	client_raise(cc);
 	client_ptrsave(cc);
 
@@ -142,6 +145,9 @@ mousefunc_window_move(struct client_ctx *cc, void *arg)
 
 	client_raise(cc);
 
+	if (cc->flags & CLIENT_FREEZE)
+		return;
+
 	if (xu_ptr_grab(cc->win, MouseMask, Cursor_move) < 0)
 		return;