aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2011-05-07 17:15:37 +0000
committerokan2011-05-07 17:15:37 +0000
commitaab3606ea2265f01371140ee6d315679188062c4 (patch)
treea3d9ae2779a058d3d7ccfff93bd393fdc549edf2
parent0c012f4b4d6a4c203267367da87271b835b83547 (diff)
downloadcwm-aab3606ea2265f01371140ee6d315679188062c4.tar.gz
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.h5
-rw-r--r--client.c20
-rw-r--r--conf.c4
-rw-r--r--cwm.16
-rw-r--r--cwmrc.56
-rw-r--r--kbfunc.c11
-rw-r--r--mousefunc.c8
7 files changed, 51 insertions, 9 deletions
diff --git a/calmwm.h b/calmwm.h
index 96cf9dc..4d805b9 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.h,v 1.123 2011/05/05 16:40:37 okan Exp $
+ * $Id: calmwm.h,v 1.124 2011/05/07 17:15:37 okan Exp $
*/
#ifndef _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 ff2df5c..d52eab9 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: client.c,v 1.80 2011/03/22 10:56:08 okan Exp $
+ * $Id: client.c,v 1.81 2011/05/07 17:15:37 okan Exp $
*/
#include <sys/param.h>
@@ -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 b0af4ca..1777a95 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: conf.c,v 1.77 2011/03/22 10:57:31 okan Exp $
+ * $Id: conf.c,v 1.78 2011/05/07 17:15:37 okan Exp $
*/
#include <sys/param.h>
@@ -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 87b74df..346d1b3 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.44 2010/09/25 21:58:18 schwarze Exp $
+.\" $OpenBSD: cwm.1,v 1.45 2011/05/07 17:15:37 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -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: September 25 2010 $
+.Dd $Mdocdate: May 7 2011 $
.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 0d3f9c1..f684380 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwmrc.5,v 1.34 2010/09/25 21:48:08 schwarze Exp $
+.\" $OpenBSD: cwmrc.5,v 1.35 2011/05/07 17:15:37 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -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: September 25 2010 $
+.Dd $Mdocdate: May 7 2011 $
.Dt CWMRC 5
.Os
.Sh NAME
@@ -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 775581b..a9f14fc 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: kbfunc.c,v 1.51 2010/02/10 01:23:05 okan Exp $
+ * $Id: kbfunc.c,v 1.52 2011/05/07 17:15:37 okan Exp $
*/
#include <sys/param.h>
@@ -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 9b55c6d..2f9b8f6 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: mousefunc.c,v 1.23 2011/05/05 19:52:52 okan Exp $
+ * $Id: mousefunc.c,v 1.24 2011/05/07 17:15:37 okan Exp $
*/
#include <sys/param.h>
@@ -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;