summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/place.c
diff options
context:
space:
mode:
authorreggaemanu <reggaemanu@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-10-17 16:59:20 +0000
committerreggaemanu <reggaemanu@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-10-17 16:59:20 +0000
commit63c09a12334318bc757a58d1ee9d5b41cae76857 (patch)
tree7a72dff12e6261d0b2bec3219b134355ed2d5f4f /beryl-plugins/src/place.c
parent25a0bd06c5537ba75813875f6ca1ac75a9920a8a (diff)
downloadmarex-dev-63c09a12334318bc757a58d1ee9d5b41cae76857.tar.gz
marex-dev-63c09a12334318bc757a58d1ee9d5b41cae76857.tar.bz2
Upstream updates...
beryl-core: Add serverWidth serverHeight and serverBorderWidth beryl-plugins: Use serverWidth, serverHeight and serverBorderWidth for place and move plugins git-svn-id: file:///beryl/trunk@666 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/place.c')
-rw-r--r--beryl-plugins/src/place.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c
index 6ee6a6c..70ebc5d 100644
--- a/beryl-plugins/src/place.c
+++ b/beryl-plugins/src/place.c
@@ -241,6 +241,18 @@ get_workarea_of_current_output_device (CompScreen *s,
area->height = y2 - y1;
}
+static int
+get_window_width (CompWindow *window)
+{
+ return window->serverWidth + window->serverBorderWidth * 2;
+}
+
+static int
+get_window_height (CompWindow *window)
+{
+ return window->serverHeight + window->serverBorderWidth * 2;
+}
+
static void
find_next_cascade (CompWindow * window,
GList * windows, int x, int y, int *new_x, int *new_y)
@@ -282,9 +294,9 @@ find_next_cascade (CompWindow * window,
/* Find first cascade position that's not used. */
- window_width = window->attrib.width + window->input.left +
+ window_width = get_window_width (window) + window->input.left +
window->input.right;
- window_height = window->attrib.height + window->input.top +
+ window_height = get_window_height (window) + window->input.top +
window->input.bottom;
cascade_stage = 0;
@@ -738,9 +750,13 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
window->screen->width;
int y0 = (window->initialViewportY - window->screen->y) *
window->screen->height;
+ int window_width, window_height;
PLACE_SCREEN (window->screen);
+ window_width = get_window_width (window);
+ window_height = get_window_height (window);
+
get_workarea_of_current_output_device (window->screen, &work_area);
work_area.x += x0;
@@ -873,18 +889,18 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
x = parent->attrib.x;
y = parent->attrib.y;
- w = parent->width;
+ w = get_window_width (parent);
/* center of parent */
x = x + w / 2;
/* center of child over center of parent */
- x -= window->width / 2;
+ x -= window_width / 2;
/* "visually" center window over parent, leaving twice as
* much space below as on top.
*/
- y += (parent->height - window->height) / 3;
+ y += (get_window_height (parent) - window_height) / 3;
/* put top of child's frame, not top of child's client */
y += window->input.top;
@@ -897,10 +913,10 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
get_workarea_of_current_output_device (window->screen, &area);
- if (x + window->width > area.x + area.width)
- x = area.x + area.width - window->width;
- if (y + window->height > area.y + area.height)
- y = area.y + area.height - window->height;
+ if (x + window_width > area.x + area.width)
+ x = area.x + area.width - window_width;
+ if (y + window_height > area.y + area.height)
+ y = area.y + area.height - window_height;
if (x < area.x)
x = area.x;
if (y < area.y)
@@ -935,8 +951,8 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
w = screenGetOutputDevAreaWidth (window->screen, head);
h = screenGetOutputDevAreaHeight (window->screen, head);
- x = (w - window->width) / 2;
- y = (h - window->height) / 2;
+ x = (w - window_width) / 2;
+ y = (h - window_height) / 2;
goto done_check_denied_focus;
}
@@ -950,10 +966,10 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
if (!wi->shaded && wi->attrib.map_state != IsViewable)
continue;
- if (wi->attrib.x >= work_area.x + work_area.width ||
- wi->attrib.x + wi->width <= work_area.x ||
- wi->attrib.y >= work_area.y + work_area.height ||
- wi->attrib.y + wi->height <= work_area.y)
+ if (wi->attrib.x >= work_area.x + work_area.width ||
+ wi->attrib.x + get_window_width (wi) <= work_area.x ||
+ wi->attrib.y >= work_area.y + work_area.height ||
+ wi->attrib.y + get_window_height (wi) <= work_area.y)
continue;
if (wi->state & (CompWindowTypeDesktopMask |
@@ -1054,17 +1070,17 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
g_list_free (windows);
done:
- if (((x + window->width + window->input.right < work_area.x +
+ if (((x + window_width + window->input.right < work_area.x +
work_area.width) &&
- (x + window->width + window->input.right > work_area.x))
+ (x + window_width + window->input.right > work_area.x))
||
((x - window->input.left > work_area.x) &&
(x - window->input.left < work_area.x + work_area.width)))
{
- if (x + window->width + window->input.right >
+ if (x + window_width + window->input.right >
work_area.x + work_area.width)
x = work_area.x + work_area.width
- - window->width - window->input.right;
+ - window_width - window->input.right;
if (x - window->input.left < work_area.x)
x = work_area.x + window->input.left;
@@ -1072,7 +1088,7 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
else
{
//only use THIS code if the window is TOTALLY outside the viewport.
- while (x + window->width + window->input.right >
+ while (x + window_width + window->input.right >
work_area.x + work_area.width)
x -= work_area.width;
@@ -1085,10 +1101,10 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
done_no_x_constraints:
if (window->screen->nOutputDev == 1)
{
- if (y + window->height + window->input.bottom >
+ if (y + window_height + window->input.bottom >
work_area.y + work_area.height)
y = work_area.y + work_area.height
- - window->height - window->input.bottom;
+ - window_height - window->input.bottom;
if (y - window->input.top < work_area.y)
y = work_area.y + window->input.top;
@@ -1097,13 +1113,13 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
{
int head = screenGetOutputDevForWindow (window);
- if (y + window->height + window->input.bottom >
+ if (y + window_height + window->input.bottom >
screenGetOutputDevAreaY (window->screen, head) +
screenGetOutputDevAreaHeight (window->screen, head))
y = screenGetOutputDevAreaY (window->screen,
head) +
screenGetOutputDevAreaHeight (window->screen,
- head) - window->height -
+ head) - window_height -
window->input.bottom;
if (y - window->input.top < screenGetOutputDevAreaY (window->screen, head))