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@
This commit is contained in:
okan 2011-05-07 17:15:37 +00:00
parent 760c6b5522
commit 43450c8fd7
7 changed files with 43 additions and 1 deletions

View File

@ -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 *);

View File

@ -264,6 +264,15 @@ client_current(void)
return (_curcc);
}
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)
{
@ -271,6 +280,9 @@ client_maximize(struct client_ctx *cc)
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 {

2
conf.c
View File

@ -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} },

4
cwm.1
View File

@ -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-=

View File

@ -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

View File

@ -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;
@ -479,6 +482,12 @@ kbfunc_client_hmaximize(struct client_ctx *cc, union arg *arg)
client_horizmaximize(cc);
}
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)
{

View File

@ -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;