Hello, All;
I've added a property to CWM config to hide the window in the top
left corner of the screen while moving or resizeing a window.
This is my first patch, so feel free to yell at me.
Ben Raskin
diff --git app/cwm/calmwm.h app/cwm/calmwm.h
index a0aeafa8f..3904eeddf 100644
--- app/cwm/calmwm.h
+++ app/cwm/calmwm.h
@@ -293,6 +293,7 @@ struct conf {
int snapdist;
int htile;
int vtile;
+ int wprop;
struct gap gap;
char *color[CWM_COLOR_NITEMS];
char *font;
diff --git app/cwm/conf.c app/cwm/conf.c
index 1e95bd9e1..21d30d184 100644
--- app/cwm/conf.c
+++ app/cwm/conf.c
@@ -283,6 +283,7 @@ conf_init(struct conf *c)
c->mamount = 1;
c->htile = 50;
c->vtile = 50;
+ c->wprop = 1;
c->snapdist = 0;
c->ngroups = 0;
c->nameqlen = 5;
diff --git app/cwm/cwmrc.5 app/cwm/cwmrc.5
index bca861b0b..b511f45fa 100644
--- app/cwm/cwmrc.5
+++ app/cwm/cwmrc.5
@@ -207,6 +207,10 @@ The default behavior for new windows is to not assign any
group.
By enabling sticky group mode,
.Xr cwm 1
will assign new windows to the currently selected group.
+.It Ic wprop Ic yes Ns \&| Ns Ic no
+Toggle showing window size properties in the top left corner of a
+window during moving or resizing.
+The default behaviour is to show window size properties.
.It Ic unbind-key Ar key
Unbind function bound to
.Ar key .
diff --git app/cwm/kbfunc.c app/cwm/kbfunc.c
index 53ec0cffb..c3c27a26f 100644
--- app/cwm/kbfunc.c
+++ app/cwm/kbfunc.c
@@ -167,8 +167,11 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs)
CurrentTime) != GrabSuccess)
return;
- screen_prop_win_create(sc, cc->win);
- screen_prop_win_draw(sc, "%+5d%+5d", cc->geom.x, cc->geom.y);
+ if (Conf.wprop) {
+ screen_prop_win_create(sc, cc->win);
+ screen_prop_win_draw(sc, "%+5d%+5d", cc->geom.x,
+ cc->geom.y);
+ }
while (move) {
XMaskEvent(X_Dpy, MOUSEMASK, &ev);
switch (ev.type) {
@@ -191,8 +194,9 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs)
cc->geom.y + cc->geom.h + (cc->bwidth * 2),
area.y, area.y + area.h, sc->snapdist);
client_move(cc);
- screen_prop_win_draw(sc,
- "%+5d%+5d", cc->geom.x, cc->geom.y);
+ if (Conf.wprop)
+ screen_prop_win_draw(sc,
+ "%+5d%+5d", cc->geom.x, cc->geom.y);
break;
case ButtonRelease:
move = 0;
@@ -201,7 +205,8 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs)
}
if (ltime)
client_move(cc);
- screen_prop_win_destroy(sc);
+ if (Conf.wprop)
+ screen_prop_win_destroy(sc);
XUngrabPointer(X_Dpy, CurrentTime);
}
@@ -256,8 +261,11 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
CurrentTime) != GrabSuccess)
return;
- screen_prop_win_create(sc, cc->win);
- screen_prop_win_draw(sc, "%4d x %-4d", cc->dim.w, cc->dim.h);
+ if (Conf.wprop) {
+ screen_prop_win_create(sc, cc->win);
+ screen_prop_win_draw(sc, "%4d x %-4d", cc->dim.w,
+ cc->dim.h);
+ }
while (resize) {
XMaskEvent(X_Dpy, MOUSEMASK, &ev);
switch (ev.type) {
@@ -271,8 +279,10 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
cc->geom.h = ev.xmotion.y;
client_apply_sizehints(cc);
client_resize(cc, 1);
- screen_prop_win_draw(sc,
- "%4d x %-4d", cc->dim.w, cc->dim.h);
+ if (Conf.wprop)
+ screen_prop_win_draw(sc,
+ "%4d x %-4d", cc->dim.w,
+ cc->dim.h);
break;
case ButtonRelease:
resize = 0;
@@ -281,7 +291,8 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
}
if (ltime)
client_resize(cc, 1);
- screen_prop_win_destroy(sc);
+ if (Conf.wprop)
+ screen_prop_win_destroy(sc);
XUngrabPointer(X_Dpy, CurrentTime);
/* Make sure the pointer stays within the window. */
diff --git app/cwm/parse.y app/cwm/parse.y
index c1bf8c563..0cef1e205 100644
--- app/cwm/parse.y
+++ app/cwm/parse.y
@@ -69,7 +69,7 @@ typedef struct {
%}
%token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
-%token FONTNAME STICKY GAP
+%token FONTNAME STICKY GAP WPROP
%token AUTOGROUP COMMAND IGNORE WM
%token YES NO BORDERWIDTH MOVEAMOUNT HTILE VTILE
%token COLOR SNAPDIST
@@ -136,6 +136,9 @@ main : FONTNAME STRING {
}
conf->vtile = $2;
}
+ | WPROP yesno {
+ conf->wprop = $2;
+ }
| MOVEAMOUNT NUMBER {
if ($2 < 0 || $2 > INT_MAX) {
yyerror("invalid movemount");
@@ -346,6 +349,7 @@ lookup(char *s)
{ "urgencyborder", URGENCYBORDER},
{ "vtile", VTILE},
{ "wm", WM},
+ { "wprop", WPROP},
{ "yes", YES}
};
const struct keywords *p;