allow SPOT1 on right #1

This commit is contained in:
seanpringle
2012-09-05 11:45:52 +10:00
parent cc727e76aa
commit fbe87fe701
3 changed files with 14 additions and 6 deletions

View File

@@ -18,6 +18,13 @@
// | | 3 | // | | 3 |
// ------------------------------- // -------------------------------
// Actually, there are a few layout choices, but only at build time.
// The layout can be flipped so SPOT1 is on the right.
// If you do this, review the directional move/focus key bindings too.
//#define SPOT1_ALIGN SPOT1_RIGHT
#define SPOT1_ALIGN SPOT1_LEFT
// Width of SPOT1 as percentage of screen width. // Width of SPOT1 as percentage of screen width.
#define SPOT1_WIDTH_PCT 67 #define SPOT1_WIDTH_PCT 67

9
xoat.c
View File

@@ -362,18 +362,17 @@ void spot_calc_xywh(int spot, int mon, int *x, int *y, int *w, int *h)
monitor *m = &monitors[MIN(nmonitors-1, MAX(0, mon))]; monitor *m = &monitors[MIN(nmonitors-1, MAX(0, mon))];
int width_spot1 = (double)m->w / 100 * MIN(90, MAX(10, SPOT1_WIDTH_PCT)); int width_spot1 = (double)m->w / 100 * MIN(90, MAX(10, SPOT1_WIDTH_PCT));
int height_spot2 = (double)m->h / 100 * MIN(90, MAX(10, SPOT2_HEIGHT_PCT)); int height_spot2 = (double)m->h / 100 * MIN(90, MAX(10, SPOT2_HEIGHT_PCT));
int x_spot1 = SPOT1_ALIGN == SPOT1_LEFT ? m->x: m->x + m->w - width_spot1;
int x_spot2 = SPOT1_ALIGN == SPOT1_LEFT ? m->x + width_spot1: m->x;
// default, left 2/3 of screen *x = x_spot1, *y = m->y, *w = width_spot1, *h = m->h;
*x = m->x, *y = m->y, *w = width_spot1, *h = m->h;
if (spot == SPOT1) return; if (spot == SPOT1) return;
// right top 2/9 of screen *x = x_spot2;
*x = m->x + width_spot1;
*w = m->w - width_spot1; *w = m->w - width_spot1;
*h = height_spot2; *h = height_spot2;
if (spot == SPOT2) return; if (spot == SPOT2) return;
// right bottom 1/9 of screen
*y = m->y + height_spot2; *y = m->y + height_spot2;
*h = m->h - height_spot2; *h = m->h - height_spot2;
} }

4
xoat.h
View File

@@ -185,7 +185,9 @@ enum {
SPOT2, // medium top right pane SPOT2, // medium top right pane
SPOT3, // small bottom right pane SPOT3, // small bottom right pane
SPOT_CURRENT, SPOT_CURRENT,
SPOT_SMART SPOT_SMART,
SPOT1_LEFT,
SPOT1_RIGHT
}; };
#define TAG1 1<<0 #define TAG1 1<<0