summaryrefslogtreecommitdiff
path: root/openbox/screen.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-07-10 23:59:17 +0000
committerDana Jansens <danakj@orodu.net>2007-07-10 23:59:17 +0000
commit0b97b6043c177bc4cb0bc982a84278120f31c58a (patch)
tree5ed9f2b45dd940e8fac81d91b31d0f5b2959315a /openbox/screen.c
parent976d406529c4ea79adc163793ec73178dbc14101 (diff)
user-sepcified margins
Diffstat (limited to 'openbox/screen.c')
-rw-r--r--openbox/screen.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/openbox/screen.c b/openbox/screen.c
index 0dfca59c..de3c9fb0 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -1199,6 +1199,15 @@ typedef struct {
sl = g_slist_prepend(sl, ss); \
}
+#define VALIDATE_STRUTS(sl, side, max) \
+{ \
+ GSList *it; \
+ for (it = sl; it; it = g_slist_next(it)) { \
+ ObScreenStrut *ss = it->data; \
+ ss->strut->side = MIN(max, ss->strut->side); \
+ } \
+}
+
void screen_update_areas()
{
guint i, j;
@@ -1206,11 +1215,19 @@ void screen_update_areas()
GList *it;
GSList *sit;
- ob_debug("updating screen areas\n");
-
g_free(monitor_area);
extensions_xinerama_screens(&monitor_area, &screen_num_monitors);
+ /* set up the user-specified margins */
+ config_margins.top_start = RECT_LEFT(monitor_area[screen_num_monitors]);
+ config_margins.top_end = RECT_RIGHT(monitor_area[screen_num_monitors]);
+ config_margins.bottom_start = RECT_LEFT(monitor_area[screen_num_monitors]);
+ config_margins.bottom_end = RECT_RIGHT(monitor_area[screen_num_monitors]);
+ config_margins.left_start = RECT_TOP(monitor_area[screen_num_monitors]);
+ config_margins.left_end = RECT_BOTTOM(monitor_area[screen_num_monitors]);
+ config_margins.right_start = RECT_TOP(monitor_area[screen_num_monitors]);
+ config_margins.right_end = RECT_BOTTOM(monitor_area[screen_num_monitors]);
+
dims = g_new(gulong, 4 * screen_num_desktops * screen_num_monitors);
RESET_STRUT_LIST(struts_left);
@@ -1239,6 +1256,24 @@ void screen_update_areas()
if (dock_strut.bottom)
ADD_STRUT_TO_LIST(struts_bottom, DESKTOP_ALL, &dock_strut);
+ if (config_margins.left)
+ ADD_STRUT_TO_LIST(struts_left, DESKTOP_ALL, &config_margins);
+ if (config_margins.top)
+ ADD_STRUT_TO_LIST(struts_top, DESKTOP_ALL, &config_margins);
+ if (config_margins.right)
+ ADD_STRUT_TO_LIST(struts_right, DESKTOP_ALL, &config_margins);
+ if (config_margins.bottom)
+ ADD_STRUT_TO_LIST(struts_bottom, DESKTOP_ALL, &config_margins);
+
+ VALIDATE_STRUTS(struts_left, left,
+ monitor_area[screen_num_monitors].width / 2);
+ VALIDATE_STRUTS(struts_right, right,
+ monitor_area[screen_num_monitors].width / 2);
+ VALIDATE_STRUTS(struts_top, top,
+ monitor_area[screen_num_monitors].height / 2);
+ VALIDATE_STRUTS(struts_bottom, bottom,
+ monitor_area[screen_num_monitors].height / 2);
+
/* set up the work areas to be full screen */
for (i = 0; i < screen_num_monitors; ++i)
for (j = 0; j < screen_num_desktops; ++j) {