- struts = g_new0(Strut, screen_num_monitors);
-
- /* calc the xinerama areas */
- for (x = 0; x < screen_num_monitors; ++x) {
- area[i][x] = monitor_area[x];
- if (x == 0) {
- l = monitor_area[x].x;
- t = monitor_area[x].y;
- r = monitor_area[x].x + monitor_area[x].width - 1;
- b = monitor_area[x].y + monitor_area[x].height - 1;
- } else {
- l = MIN(l, monitor_area[x].x);
- t = MIN(t, monitor_area[x].y);
- r = MAX(r, monitor_area[x].x + monitor_area[x].width - 1);
- b = MAX(b, monitor_area[x].y + monitor_area[x].height - 1);
- }
- }
- RECT_SET(area[i][x], l, t, r - l + 1, b - t + 1);
-
- /* apply the struts */
-
- /* find the left-most xin heads, i do this in 2 loops :| */
- o = area[i][0].x;
- for (x = 1; x < screen_num_monitors; ++x)
- o = MIN(o, area[i][x].x);
-
- for (x = 0; x < screen_num_monitors; ++x) {
- for (it = client_list; it; it = g_list_next(it)) {
- ObClient *c = it->data;
- screen_area_add_strut_left(&c->strut,
- &monitor_area[x],
- o + c->strut.left - area[i][x].x,
- &struts[x]);
- }
- screen_area_add_strut_left(&dock_strut,
- &monitor_area[x],
- o + dock_strut.left - area[i][x].x,
- &struts[x]);
-
- area[i][x].x += struts[x].left;
- area[i][x].width -= struts[x].left;
+ /* collect the struts */
+ for (it = client_list; it; it = g_list_next(it)) {
+ ObClient *c = it->data;
+ if (c->strut.left)
+ ADD_STRUT_TO_LIST(struts_left, c->desktop, &c->strut);
+ if (c->strut.top)
+ ADD_STRUT_TO_LIST(struts_top, c->desktop, &c->strut);
+ if (c->strut.right)
+ ADD_STRUT_TO_LIST(struts_right, c->desktop, &c->strut);
+ if (c->strut.bottom)
+ ADD_STRUT_TO_LIST(struts_bottom, c->desktop, &c->strut);
+ }
+ if (dock_strut.left)
+ ADD_STRUT_TO_LIST(struts_left, DESKTOP_ALL, &dock_strut);
+ if (dock_strut.top)
+ ADD_STRUT_TO_LIST(struts_top, DESKTOP_ALL, &dock_strut);
+ if (dock_strut.right)
+ ADD_STRUT_TO_LIST(struts_right, DESKTOP_ALL, &dock_strut);
+ 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) {
+ dims[(i * screen_num_desktops + j) * 4+0] = monitor_area[i].x;
+ dims[(i * screen_num_desktops + j) * 4+1] = monitor_area[i].y;
+ dims[(i * screen_num_desktops + j) * 4+2] = monitor_area[i].width;
+ dims[(i * screen_num_desktops + j) * 4+3] = monitor_area[i].height;