summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2011-05-07 17:15:38 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2011-05-07 17:15:38 +0000
commit95d258d9c7697b206df906f645600bfaa885eeb8 (patch)
treef31f04f40a2ec67e9ec62d5ee47485390bcda654
parentd450be8250d819b897aa794573c814df1c9c9710 (diff)
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--app/cwm/calmwm.h5
-rw-r--r--app/cwm/client.c20
-rw-r--r--app/cwm/conf.c4
-rw-r--r--app/cwm/cwm.16
-rw-r--r--app/cwm/cwmrc.56
-rw-r--r--app/cwm/kbfunc.c11
-rw-r--r--app/cwm/mousefunc.c8
7 files changed, 51 insertions, 9 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index 96cf9dcec..4d805b9ae 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/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/app/cwm/client.c b/app/cwm/client.c
index ff2df5c11..d52eab966 100644
--- a/app/cwm/client.c
+++ b/app/cwm/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/app/cwm/conf.c b/app/cwm/conf.c
index b0af4ca6b..1777a9552 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/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/app/cwm/cwm.1 b/app/cwm/cwm.1
index 87b74df73..346d1b389 100644
--- a/app/cwm/cwm.1
+++ b/app/cwm/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/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5
index 0d3f9c16f..f6843809d 100644
--- a/app/cwm/cwmrc.5
+++ b/app/cwm/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/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index 775581b11..a9f14fc56 100644
--- a/app/cwm/kbfunc.c
+++ b/app/cwm/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/app/cwm/mousefunc.c b/app/cwm/mousefunc.c
index 9b55c6da0..2f9b8f62d 100644
--- a/app/cwm/mousefunc.c
+++ b/app/cwm/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;