summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/place.c
diff options
context:
space:
mode:
authorquinn <quinn@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-10-06 21:11:49 +0000
committerquinn <quinn@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-10-06 21:11:49 +0000
commitc6f30265a0c35c981ae198b5cff1a64b6bde239a (patch)
treeac43672a83dc597df8490b378fec7dcf30b2885f /beryl-plugins/src/place.c
parent2e06d733dede565524664f235cfb58044f507780 (diff)
downloadmarex-dev-c6f30265a0c35c981ae198b5cff1a64b6bde239a.tar.gz
marex-dev-c6f30265a0c35c981ae198b5cff1a64b6bde239a.tar.bz2
working on making everything work with upstream's multihead support
git-svn-id: file:///beryl/trunk@525 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/place.c')
-rw-r--r--beryl-plugins/src/place.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c
index fc5bbe1..13538bd 100644
--- a/beryl-plugins/src/place.c
+++ b/beryl-plugins/src/place.c
@@ -208,6 +208,39 @@ northwestcmp (gconstpointer a, gconstpointer b)
return 0;
}
+
+static void
+get_workarea_of_current_output_device (CompScreen *s,
+ XRectangle *area)
+{
+ int x1, y1, x2, y2;
+ int oX1, oY1, oX2, oY2;
+
+ x1 = s->workArea.x;
+ y1 = s->workArea.y;
+ x2 = x1 + s->workArea.width;
+ y2 = y1 + s->workArea.height;
+
+ oX1 = s->outputDev[s->currentOutputDev].region.extents.x1;
+ oY1 = s->outputDev[s->currentOutputDev].region.extents.y1;
+ oX2 = s->outputDev[s->currentOutputDev].region.extents.x2;
+ oY2 = s->outputDev[s->currentOutputDev].region.extents.y2;
+
+ if (x1 < oX1)
+ x1 = oX1;
+ if (y1 < oY1)
+ y1 = oY1;
+ if (x2 > oX2)
+ x2 = oX2;
+ if (y2 > oY2)
+ y2 = oY2;
+
+ area->x = x1;
+ area->y = y1;
+ area->width = x2 - x1;
+ area->height = y2 - y1;
+}
+
static void
find_next_cascade (CompWindow * window,
GList * windows, int x, int y, int *new_x, int *new_y)
@@ -242,7 +275,7 @@ find_next_cascade (CompWindow * window,
* of NW corner of window frame.
*/
- work_area = window->screen->workArea;
+ get_workarea_of_current_output_device (window->screen, &work_area);
cascade_x = MAX (0, work_area.x);
cascade_y = MAX (0, work_area.y);
@@ -347,7 +380,7 @@ find_most_freespace (CompWindow * window,
frame_size_left = window->input.left;
frame_size_top = window->input.top;
- work_area = window->screen->workArea;
+ get_workarea_of_current_output_device (window->screen, &work_area);
getOuterRectOfWindow (focus_window, &avoid);
getOuterRectOfWindow (window, &outer);
@@ -604,7 +637,8 @@ find_first_fit (CompWindow * window,
getOuterRectOfWindow (window, &rect);
- work_area = window->screen->workArea;
+ get_workarea_of_current_output_device (window->screen, &work_area);
+
work_area.x += (window->initialViewportX - window->screen->x) *
window->screen->width;
work_area.y += (window->initialViewportY - window->screen->y) *
@@ -707,7 +741,8 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
PLACE_SCREEN (window->screen);
- work_area = window->screen->workArea;
+ get_workarea_of_current_output_device (window->screen, &work_area);
+
work_area.x += x0;
work_area.y += y0;
@@ -858,7 +893,9 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
if (parent->attrib.x < parent->screen->width &&
parent->attrib.x + parent->screen->width > 0)
{
- XRectangle area = parent->screen->workArea;
+ XRectangle area;
+
+ get_workarea_of_current_output_device (window->screen, &area);
if (x + window->width > area.x + area.width)
x = area.x + area.width - window->width;