summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2013-01-08 04:12:52 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2013-01-08 04:12:52 +0000
commit56d275c60815ab6091abd64e4efb2f3c785b2e6b (patch)
treeada31de08d1cdd6f372091f93ed3a03ffdadf8aa /app
parent81baf25321a15ffce7ad4f1265f52cbec62f4922 (diff)
teach screen_find_xinerama() about gap and adjust (simplify) callers;
menu becomes gap-aware for free.
Diffstat (limited to 'app')
-rw-r--r--app/cwm/client.c35
-rw-r--r--app/cwm/screen.c12
2 files changed, 18 insertions, 29 deletions
diff --git a/app/cwm/client.c b/app/cwm/client.c
index ea43d1b29..8b9d2c02e 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.
*
- * $OpenBSD: client.c,v 1.117 2013/01/07 21:53:23 okan Exp $
+ * $OpenBSD: client.c,v 1.118 2013/01/08 04:12:51 okan Exp $
*/
#include <sys/param.h>
@@ -286,10 +286,7 @@ client_maximize(struct client_ctx *cc)
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2);
- cc->geom.x = xine.x + sc->gap.left;
- cc->geom.y = xine.y + sc->gap.top;
- cc->geom.h = xine.h - (sc->gap.top + sc->gap.bottom);
- cc->geom.w = xine.w - (sc->gap.left + sc->gap.right);
+ cc->geom = xine;
cc->bwidth = 0;
cc->flags |= CLIENT_MAXIMIZED;
@@ -329,9 +326,8 @@ client_vmaximize(struct client_ctx *cc)
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2);
- cc->geom.y = xine.y + sc->gap.top;
- cc->geom.h = xine.h - (cc->bwidth * 2) - (sc->gap.top +
- sc->gap.bottom);
+ cc->geom.y = xine.y;
+ cc->geom.h = xine.h - (cc->bwidth * 2);
cc->flags |= CLIENT_VMAXIMIZED;
resize:
@@ -370,9 +366,8 @@ client_hmaximize(struct client_ctx *cc)
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2);
- cc->geom.x = xine.x + sc->gap.left;
- cc->geom.w = xine.w - (cc->bwidth * 2) - (sc->gap.left +
- sc->gap.right);
+ cc->geom.x = xine.x;
+ cc->geom.w = xine.w - (cc->bwidth * 2);
cc->flags |= CLIENT_HMAXIMIZED;
resize:
@@ -672,22 +667,16 @@ client_placecalc(struct client_ctx *cc)
yslack = xine.h - cc->geom.h - cc->bwidth * 2;
if (xslack >= xine.x) {
- cc->geom.x = MAX(MIN(xmouse, xslack),
- xine.x + sc->gap.left);
- if (cc->geom.x > (xslack - sc->gap.right))
- cc->geom.x -= sc->gap.right;
+ cc->geom.x = MAX(MIN(xmouse, xslack), xine.x);
} else {
- cc->geom.x = xine.x + sc->gap.left;
- cc->geom.w = xine.w - sc->gap.left;
+ cc->geom.x = xine.x;
+ cc->geom.w = xine.w;
}
if (yslack >= xine.y) {
- cc->geom.y = MAX(MIN(ymouse, yslack),
- xine.y + sc->gap.top);
- if (cc->geom.y > (yslack - sc->gap.bottom))
- cc->geom.y -= sc->gap.bottom;
+ cc->geom.y = MAX(MIN(ymouse, yslack), xine.y);
} else {
- cc->geom.y = xine.y + sc->gap.top;
- cc->geom.h = xine.h - sc->gap.top;
+ cc->geom.y = xine.y;
+ cc->geom.h = xine.h;
}
}
}
diff --git a/app/cwm/screen.c b/app/cwm/screen.c
index 02fa34220..e7ed769ca 100644
--- a/app/cwm/screen.c
+++ b/app/cwm/screen.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.
*
- * $OpenBSD: screen.c,v 1.44 2013/01/07 21:45:24 okan Exp $
+ * $OpenBSD: screen.c,v 1.45 2013/01/08 04:12:51 okan Exp $
*/
#include <sys/param.h>
@@ -132,7 +132,7 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y)
struct geom geom;
int i;
- geom = sc->view;
+ geom = sc->work;
if (sc->xinerama == NULL)
return (geom);
@@ -141,10 +141,10 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y)
info = &sc->xinerama[i];
if (x >= info->x_org && x < info->x_org + info->width &&
y >= info->y_org && y < info->y_org + info->height) {
- geom.x = info->x_org;
- geom.y = info->y_org;
- geom.w = info->width;
- geom.h = info->height;
+ geom.x = info->x_org + sc->gap.left;
+ geom.y = info->y_org + sc->gap.top;
+ geom.w = info->width - (sc->gap.left + sc->gap.right);
+ geom.h = info->height - (sc->gap.top + sc->gap.bottom);
break;
}
}