diff options
author | okan | 2011-05-07 17:15:37 +0000 |
---|---|---|
committer | okan | 2011-05-07 17:15:37 +0000 |
commit | aab3606ea2265f01371140ee6d315679188062c4 (patch) | |
tree | a3d9ae2779a058d3d7ccfff93bd393fdc549edf2 | |
parent | 0c012f4b4d6a4c203267367da87271b835b83547 (diff) | |
download | cwm-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.h | 5 | ||||
-rw-r--r-- | client.c | 20 | ||||
-rw-r--r-- | conf.c | 4 | ||||
-rw-r--r-- | cwm.1 | 6 | ||||
-rw-r--r-- | cwmrc.5 | 6 | ||||
-rw-r--r-- | kbfunc.c | 11 | ||||
-rw-r--r-- | mousefunc.c | 8 |
7 files changed, 51 insertions, 9 deletions
@@ -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 *); @@ -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 { @@ -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} }, @@ -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-= @@ -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 @@ -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; |