summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/place.c
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-14 16:54:15 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-14 16:54:15 +0000
commitfe9fb956fabeed2d4a2a704dda2976dfc494ca48 (patch)
treea9e8f8fdfb361428a942a432bc274c4ec05c1cb8 /beryl-plugins/src/place.c
parent6049a96eb62c5063f445268bf3493a29fed89fcf (diff)
downloadmarex-dev-fe9fb956fabeed2d4a2a704dda2976dfc494ca48.tar.gz
marex-dev-fe9fb956fabeed2d4a2a704dda2976dfc494ca48.tar.bz2
beryl-core & plugins:
- code cleanup: use have only two functions which retrieve the dimensions of output device and its work area instead of eight - fixed calculation error in organic scale git-svn-id: file:///beryl/trunk@1198 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/place.c')
-rw-r--r--beryl-plugins/src/place.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c
index 8cff9da..3993b40 100644
--- a/beryl-plugins/src/place.c
+++ b/beryl-plugins/src/place.c
@@ -813,14 +813,15 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
else
{
int head = screenGetOutputDevForWindow (window);
+ XRectangle workArea;
+
+ screenGetOutputDevWorkArea (window->screen, head, &workArea);
if (window->state & CompWindowStateMaximizedVertMask)
- y = screenGetOutputDevAreaY (window->screen,
- head) + window->input.top;
+ y = workArea.y + window->input.top;
if (window->state & CompWindowStateMaximizedHorzMask)
- x = screenGetOutputDevAreaX (window->screen,
- head) + window->input.left;
+ x = workArea.x + window->input.left;
}
goto done;
@@ -937,8 +938,8 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
window->type == CompWindowTypeSplashMask)
{
/* Center on screen */
- int w, h;
int head;
+ XRectangle workArea;
/* w = window->screen->width;
h = window->screen->height;
@@ -947,12 +948,10 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
y = (h - window->height) / 2;
*/
head = screenGetCurrentOutputDev (window->screen);
+ screenGetOutputDevWorkArea (window->screen, head, &workArea);
- w = screenGetOutputDevAreaWidth (window->screen, head);
- h = screenGetOutputDevAreaHeight (window->screen, head);
-
- x = (w - window_width) / 2;
- y = (h - window_height) / 2;
+ x = (workArea.width - window_width) / 2;
+ y = (workArea.height - window_height) / 2;
goto done_check_denied_focus;
}
@@ -1115,18 +1114,16 @@ placeWindow (CompWindow * window, int x, int y, int *new_x, int *new_y)
else
{
int head = screenGetOutputDevForWindow (window);
+ XRectangle workArea;
- 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 -
- window->input.bottom;
-
- if (y - window->input.top < screenGetOutputDevAreaY (window->screen, head))
- y = screenGetOutputDevAreaY (window->screen, head) + window->input.top;
+ screenGetOutputDevWorkArea (window->screen, head, &workArea);
+
+ if (y + window_height + window->input.bottom >
+ workArea.y + workArea.height)
+ y = workArea.y + workArea.height - window_height - window->input.bottom;
+
+ if (y - window->input.top < workArea.y)
+ y = workArea.y + window->input.top;
}