summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-04-15 18:46:59 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-04-15 18:46:59 +0000
commitfe4284d4c2deef28f27802c5fcefa2ba8e1a699b (patch)
tree6e893099f7b0236238d0fd8d87ac66335e28f2e6
parentbf5b496da2aa6b32fa31ce8436562ba05f428c6d (diff)
Add "gap" support to .cwmrc. The options put in here make gaps on the edge
of the screen where an application won't be {,vert}maximized over. used for placing a statusbar or something like xclock. Patch from Edd Barrett, with input from myself and okan. Thanks! ok okan@.
-rw-r--r--app/cwm/calmwm.h3
-rw-r--r--app/cwm/client.c21
-rw-r--r--app/cwm/cwmrc.514
-rw-r--r--app/cwm/parse.y14
4 files changed, 35 insertions, 17 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index 3c7b21a2b..bae2362ae 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.28 2008/04/09 18:10:47 okan Exp $
+ * $Id: calmwm.h,v 1.29 2008/04/15 18:46:58 oga Exp $
*/
#ifndef _CALMWM_H_
@@ -274,6 +274,7 @@ struct conf {
#define DEFAULTFONTNAME "sans-serif:pixelsize=14:bold"
char *DefaultFontName;
+ int gap_top, gap_bottom, gap_left, gap_right;
};
/* Menu stuff */
diff --git a/app/cwm/client.c b/app/cwm/client.c
index 264d0257c..678e6b7ad 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.15 2008/04/09 18:10:47 okan Exp $
+ * $Id: client.c,v 1.16 2008/04/15 18:46:58 oga Exp $
*/
#include "headers.h"
@@ -339,10 +339,12 @@ client_maximize(struct client_ctx *cc)
XGetWindowAttributes(X_Dpy, sc->rootwin, &rootwin_geom);
if (!(cc->flags & CLIENT_VMAXIMIZED))
cc->savegeom = cc->geom;
- cc->geom.x = 0;
- cc->geom.y = 0;
- cc->geom.height = rootwin_geom.height;
- cc->geom.width = rootwin_geom.width;
+ cc->geom.x = Conf.gap_left;
+ cc->geom.y = Conf.gap_top;
+ cc->geom.height = rootwin_geom.height -
+ (Conf.gap_top + Conf.gap_bottom);
+ cc->geom.width = rootwin_geom.width -
+ (Conf.gap_left + Conf.gap_right);
cc->flags |= CLIENT_DOMAXIMIZE;
}
@@ -765,12 +767,9 @@ client_vertmaximize(struct client_ctx *cc)
if (!(cc->flags & CLIENT_MAXIMIZED))
cc->savegeom = cc->geom;
- cc->geom.y = cc->bwidth;
- if (cc->geom.min_dx == 0)
- cc->geom.height = display_height;
- else
- cc->geom.height = display_height -
- (display_height % cc->geom.min_dx);
+ cc->geom.y = cc->bwidth + Conf.gap_top;
+ cc->geom.height = display_height -
+ (Conf.gap_top + Conf.gap_bottom);
cc->flags |= CLIENT_DOVMAXIMIZE;
}
diff --git a/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5
index fa2221364..219175f52 100644
--- a/app/cwm/cwmrc.5
+++ b/app/cwm/cwmrc.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwmrc.5,v 1.1 2008/03/23 15:09:21 simon Exp $
+.\" $OpenBSD: cwmrc.5,v 1.2 2008/04/15 18:46:58 oga Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The following requests are required for all man pages.
-.Dd $Mdocdate: March 23 2008 $
+.Dd $Mdocdate: April 15 2008 $
.Dt CWMRC 1
.Os
.Sh NAME
@@ -138,6 +138,16 @@ Remove a keybinding for Mod4-o
.Bd -literal -offset indent
bind 4-o "unmap"
.Ed
+.It Ic gap Ar top bottom left right
+Define "gaps" at the edge of the screen, so that when a window is maximized it will not overlap this area.
+This gap can be used for other applications such as
+.Xr xclock 1 ,
+which the user may wish to remain visible.
+.Pp
+.Pa top bottom left
+and
+.Pa right
+are the sizes of each the gap in pixels.
.El
.Sh SEE ALSO
.Xr cwm 1
diff --git a/app/cwm/parse.y b/app/cwm/parse.y
index b40e5cd9b..947d09c54 100644
--- a/app/cwm/parse.y
+++ b/app/cwm/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.2 2008/04/15 18:22:08 okan Exp $ */
+/* $OpenBSD: parse.y,v 1.3 2008/04/15 18:46:58 oga Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -65,7 +65,7 @@ typedef struct {
%}
-%token FONTNAME STICKY
+%token FONTNAME STICKY GAP
%token AUTOGROUP BIND COMMAND IGNORE
%token YES NO
%token ERROR
@@ -161,8 +161,13 @@ main : FONTNAME STRING {
free($2);
free($3);
}
+ | GAP NUMBER NUMBER NUMBER NUMBER {
+ conf->gap_top = $2;
+ conf->gap_bottom = $3;
+ conf->gap_left = $4;
+ conf->gap_right = $5;
+ }
;
-
%%
struct keywords {
@@ -199,6 +204,7 @@ lookup(char *s)
{ "bind", BIND},
{ "command", COMMAND},
{ "fontname", FONTNAME},
+ { "gap", GAP},
{ "ignore", IGNORE},
{ "no", NO},
{ "sticky", STICKY},
@@ -574,6 +580,8 @@ parse_config(const char *filename, struct conf *xconf)
strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath));
xconf->DefaultFontName = conf->DefaultFontName;
+
+ bcopy(&(conf->gap_top), &(xconf->gap_top), sizeof(int) * 4);
}
free(conf);