summaryrefslogtreecommitdiff
path: root/beryl-plugins
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
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')
-rw-r--r--beryl-plugins/src/blurfx.c11
-rw-r--r--beryl-plugins/src/decoration.c3
-rw-r--r--beryl-plugins/src/move.c30
-rw-r--r--beryl-plugins/src/place.c39
-rw-r--r--beryl-plugins/src/put.c10
-rw-r--r--beryl-plugins/src/scale.c78
-rw-r--r--beryl-plugins/src/splash.c42
-rw-r--r--beryl-plugins/src/switcher.c39
-rw-r--r--beryl-plugins/src/wobbly.c44
9 files changed, 137 insertions, 159 deletions
diff --git a/beryl-plugins/src/blurfx.c b/beryl-plugins/src/blurfx.c
index d0ded46..53c1030 100644
--- a/beryl-plugins/src/blurfx.c
+++ b/beryl-plugins/src/blurfx.c
@@ -2148,7 +2148,7 @@ updateBlurTexture (CompWindow * w, CompScreen * s,
MULTM (bm, bs->pm, bpm);
MULTM (bpm, bw->mvm, tm);
- XRectangle rect;
+ XRectangle rect, outputRect;
XClipBox (reblurRegion, &rect);
// check region for visibility
@@ -2189,10 +2189,11 @@ updateBlurTexture (CompWindow * w, CompScreen * s,
rect.height) *
tm[7] + tm[15];
- int s_x1 = screenGetOutputDevX (s, bs->output + 1);
- int s_y1 = screenGetOutputDevY (s, bs->output + 1);
- int s_x2 = s_x1 + screenGetOutputDevWidth (s, bs->output + 1);
- int s_y2 = s_y1 + screenGetOutputDevHeight (s, bs->output + 1);
+ screenGetOutputDevRect (s, bs->output + 1, &outputRect);
+ int s_x1 = outputRect.x;
+ int s_y1 = outputRect.y;
+ int s_x2 = s_x1 + outputRect.width;
+ int s_y2 = s_y1 + outputRect.height;
if (bbProj[0][0] >= bbProj[1][0] || bbProj[2][0] >= bbProj[3][0]
|| bbProj[2][1] >= bbProj[0][1]
diff --git a/beryl-plugins/src/decoration.c b/beryl-plugins/src/decoration.c
index 5b31f53..7ad1411 100644
--- a/beryl-plugins/src/decoration.c
+++ b/beryl-plugins/src/decoration.c
@@ -434,8 +434,9 @@ decorPaintWindow (CompWindow * w,
const WindowPaintAttrib * attrib,
Region region, unsigned int mask)
{
+ /*
DECOR_DISPLAY(w->screen->display);
- /*if (dd->opt[DECOR_DISPLAY_OPTION_DROP_SHADOWS].value.b
+ if (dd->opt[DECOR_DISPLAY_OPTION_DROP_SHADOWS].value.b
&& (dd->opt[DECOR_DISPLAY_OPTION_SHADOWS_ON_DOCKS].value.b ||
w->type & ~CompWindowTypeDockMask))
{
diff --git a/beryl-plugins/src/move.c b/beryl-plugins/src/move.c
index 5f388e3..975ea7f 100644
--- a/beryl-plugins/src/move.c
+++ b/beryl-plugins/src/move.c
@@ -262,11 +262,13 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
{
CompWindow *w;
int dx, dy, head;
+ XRectangle workArea;
MOVE_DISPLAY (s->display);
w = md->w;
head = screenGetOutputDev (s, xRoot, yRoot, 0, 0);
+ screenGetOutputDevWorkArea (s, head, &workArea);
md->x += xRoot - s->display->lastPointerX;
md->y += yRoot - s->display->lastPointerY;
@@ -285,10 +287,8 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
dx = md->x;
dy = md->y;
- max =
- screenGetOutputDevAreaY (s, head) + screenGetOutputDevAreaHeight (s,
- head);
- min = screenGetOutputDevAreaY (s, head) + w->input.top;
+ max = workArea.y + workArea.height;
+ min = workArea.y + w->input.top;
if (md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y_TOP].value.b)
{
@@ -343,9 +343,7 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
maximizeWindow (w, ms->origState);
- wy = screenGetOutputDevAreaY (s,
- head) +
- (w->input.top >> 1);
+ wy = workArea.y + (w->input.top >> 1);
wy += w->sizeHints.height_inc >> 1;
warpPointer (s->display, 0, wy - s->display->pointerY);
@@ -358,12 +356,9 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
if (w->state & CompWindowStateMaximizedVertMask)
{
- min = screenGetOutputDevAreaY (s, head) + w->input.top;
- max =
- screenGetOutputDevAreaY (s, head) + screenGetOutputDevAreaHeight (s,
- head)
- - w->input.bottom - w->serverHeight -
- w->serverBorderWidth * 2;
+ min = workArea.y + w->input.top;
+ max = workArea.y + workArea.height - w->input.bottom -
+ w->serverHeight - w->serverBorderWidth * 2;
if (w->attrib.y + dy < min)
dy = min - w->attrib.y;
@@ -376,12 +371,9 @@ moveHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
if (w->attrib.x + w->serverWidth + w->serverBorderWidth < 0)
return;
- min = screenGetOutputDevAreaX (s, head) + w->input.left;
- max =
- screenGetOutputDevAreaX (s, head) + screenGetOutputDevAreaWidth (s,
- head)
- - w->input.right - w->serverWidth -
- w->serverBorderWidth * 2;
+ min = workArea.x + w->input.left;
+ max = workArea.x + workArea.width - w->input.right -
+ w->serverWidth - w->serverBorderWidth * 2;
if (w->attrib.x + dx < min)
dx = min - w->attrib.x;
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;
}
diff --git a/beryl-plugins/src/put.c b/beryl-plugins/src/put.c
index 355c306..bda3095 100644
--- a/beryl-plugins/src/put.c
+++ b/beryl-plugins/src/put.c
@@ -623,6 +623,7 @@ putInitiate (CompDisplay * d, CompAction * action, CompActionState state,
int px, py, x, y, dx, dy, head, width, height, hx, hy, face, face_x,
face_y, hdirection, vdirection;
PutType type;
+ XRectangle workArea;
CompPlugin *p;
xid = getIntOptionNamed (option, nOption, "window", 0);
@@ -687,10 +688,11 @@ putInitiate (CompDisplay * d, CompAction * action, CompActionState state,
head--;
/* working area of the screen */
- width = screenGetOutputDevAreaWidth (w->screen, head);
- height = screenGetOutputDevAreaHeight (w->screen, head);
- hx = screenGetOutputDevAreaX (w->screen, head);
- hy = screenGetOutputDevAreaY (w->screen, head);
+ screenGetOutputDevWorkArea (w->screen, head, &workArea);
+ width = workArea.width;
+ height = workArea.height;
+ hx = workArea.x;
+ hy = workArea.y;
/* the windows location */
x = w->attrib.x;
diff --git a/beryl-plugins/src/scale.c b/beryl-plugins/src/scale.c
index c15cd20..74a3dc8 100644
--- a/beryl-plugins/src/scale.c
+++ b/beryl-plugins/src/scale.c
@@ -1211,10 +1211,11 @@ layoutStandardThumbs (CompScreen * s)
CompWindow *w;
int i, j, y2;
int cx, cy;
+ int head;
int lineLength, itemsPerLine;
float scaleW, scaleH;
int totalWidth, totalHeight;
- int areaX, areaY, areaWidth, areaHeight, headWidth, headHeight, head;
+ XRectangle outputRect, workArea;
SCALE_SCREEN (s);
@@ -1223,12 +1224,8 @@ layoutStandardThumbs (CompScreen * s)
else
head = ss->head;
- headWidth = screenGetOutputDevWidth (s, head);
- headHeight = screenGetOutputDevHeight (s, head);
- areaX = screenGetOutputDevAreaX (s, head);
- areaY = screenGetOutputDevAreaY (s, head);
- areaWidth = screenGetOutputDevAreaWidth (s, head);
- areaHeight = screenGetOutputDevAreaHeight (s, head);
+ screenGetOutputDevRect (s, head, &outputRect);
+ screenGetOutputDevWorkArea (s, head, &workArea);
cx = cy = ss->nWindows = 0;
@@ -1270,7 +1267,7 @@ layoutStandardThumbs (CompScreen * s)
qsort (ss->windows, ss->nWindows, sizeof (CompWindow *), compareWindows);
- itemsPerLine = (sqrt (ss->nWindows) * headWidth) / headHeight;
+ itemsPerLine = (sqrt (ss->nWindows) * outputRect.width) / outputRect.height;
if (itemsPerLine < 1)
itemsPerLine = 1;
@@ -1382,8 +1379,8 @@ layoutStandardThumbs (CompScreen * s)
totalWidth += ss->spacing;
totalHeight += ss->spacing;
- scaleW = (float)areaWidth / totalWidth;
- scaleH = (float)areaHeight / totalHeight;
+ scaleW = (float)workArea.width / totalWidth;
+ scaleH = (float)workArea.height / totalHeight;
ss->scale = MIN (MIN (scaleH, scaleW), 1.0f);
@@ -1401,10 +1398,10 @@ layoutStandardThumbs (CompScreen * s)
ss->slots[i].x1 = (float)ss->slots[i].x1 * ss->scale;
ss->slots[i].y2 = (float)ss->slots[i].y2 * ss->scale;
ss->slots[i].x2 = (float)ss->slots[i].x2 * ss->scale;
- ss->slots[i].x1 += areaX;
- ss->slots[i].y1 += areaY;
- ss->slots[i].x2 += areaX;
- ss->slots[i].y2 += areaY;
+ ss->slots[i].x1 += workArea.x;
+ ss->slots[i].y1 += workArea.y;
+ ss->slots[i].x2 += workArea.x;
+ ss->slots[i].y2 += workArea.y;
}
}
@@ -1654,8 +1651,8 @@ layoutOrganicThumbs (CompScreen * s)
int i;
int cx, cy;
- int areaX, areaY, areaWidth, areaHeight;
int head;
+ XRectangle workArea;
SCALE_SCREEN (s);
@@ -1666,10 +1663,7 @@ layoutOrganicThumbs (CompScreen * s)
ss->scale = 1.0f;
- areaX = screenGetOutputDevAreaX (s, head);
- areaY = screenGetOutputDevAreaY (s, head);
- areaWidth = screenGetOutputDevAreaWidth (s, head);
- areaHeight = screenGetOutputDevAreaHeight (s, head);
+ screenGetOutputDevWorkArea (s, head, &workArea);
cx = cy = ss->nWindows = 0;
for (w = s->windows; w; w = w->next)
@@ -1727,20 +1721,20 @@ layoutOrganicThumbs (CompScreen * s)
w = ss->windows[i];
sw->slot = &ss->slots[i];
- ss->slots[i].x1 = WIN_X (w) - areaX;
- ss->slots[i].y1 = WIN_Y (w) - areaY;
- ss->slots[i].x2 = WIN_X (w) + WIN_W (w) - areaX;
- ss->slots[i].y2 = WIN_Y (w) + WIN_H (w) - areaY;
+ ss->slots[i].x1 = WIN_X (w) - workArea.x;
+ ss->slots[i].y1 = WIN_Y (w) - workArea.y;
+ ss->slots[i].x2 = WIN_X (w) + WIN_W (w) - workArea.x;
+ ss->slots[i].y2 = WIN_Y (w) + WIN_H (w) - workArea.y;
if (ss->slots[i].x1 < 0)
{
ss->slots[i].x2 += abs (ss->slots[i].x1);
ss->slots[i].x1 = 0;
}
- if (ss->slots[i].x2 > areaWidth - areaX)
+ if (ss->slots[i].x2 > workArea.width - workArea.x)
{
- ss->slots[i].x1 -= abs (ss->slots[i].x2 - areaWidth);
- ss->slots[i].x2 = areaWidth - areaX;
+ ss->slots[i].x1 -= abs (ss->slots[i].x2 - workArea.width);
+ ss->slots[i].x2 = workArea.width - workArea.x;
}
if (ss->slots[i].y1 < 0)
@@ -1748,18 +1742,16 @@ layoutOrganicThumbs (CompScreen * s)
ss->slots[i].y2 += abs (ss->slots[i].y1);
ss->slots[i].y1 = 0;
}
- if (ss->slots[i].y2 > areaWidth - areaY)
+ if (ss->slots[i].y2 > workArea.height - workArea.y)
{
- ss->slots[i].y1 -= abs (ss->slots[i].y2 - areaHeight - areaY);
- ss->slots[i].y2 = areaHeight - areaY;
+ ss->slots[i].y1 -= abs (ss->slots[i].y2 - workArea.height - workArea.y);
+ ss->slots[i].y2 = workArea.height - workArea.y;
}
-
-
}
ss->nSlots = ss->nWindows;
- layoutOrganicRemoveOverlap (s, areaWidth - areaX, areaHeight - areaY);
+ layoutOrganicRemoveOverlap (s, workArea.width - workArea.x, workArea.height - workArea.y);
for (i = 0; i < ss->nWindows; i++)
{
SCALE_WINDOW (ss->windows[i]);
@@ -1767,10 +1759,10 @@ layoutOrganicThumbs (CompScreen * s)
if (ss->onlyCurrent)
raiseWindow(ss->windows[i]);
- ss->slots[i].x1 += ss->windows[i]->input.left + areaX;
- ss->slots[i].x2 += ss->windows[i]->input.left + areaX;
- ss->slots[i].y1 += ss->windows[i]->input.top + areaY;
- ss->slots[i].y2 += ss->windows[i]->input.top + areaY;
+ ss->slots[i].x1 += ss->windows[i]->input.left + workArea.x;
+ ss->slots[i].x2 += ss->windows[i]->input.left + workArea.x;
+ ss->slots[i].y1 += ss->windows[i]->input.top + workArea.y;
+ ss->slots[i].y2 += ss->windows[i]->input.top + workArea.y;
sw->adjust = TRUE;
}
@@ -1782,15 +1774,11 @@ zoomWindow (CompScreen * s,CompWindow * w)
{
SCALE_WINDOW (w);
- int headHeight, headWidth, head, headX, headY;
+ XRectangle outputRect;
+ int head;
head = screenGetCurrentOutputDev (s);
-
-
- headWidth = screenGetOutputDevAreaWidth (s, head);
- headHeight = screenGetOutputDevAreaHeight (s, head);
- headX = screenGetOutputDevAreaX (s, head);
- headY = screenGetOutputDevAreaY (s, head);
+ screenGetOutputDevRect (s, head, &outputRect);
if (sw->rescaled == FALSE)
{
@@ -1806,9 +1794,9 @@ zoomWindow (CompScreen * s,CompWindow * w)
sw->rescaled = TRUE;
sw->slot->x1 =
- (headWidth / 2) - ((w->attrib.width * sw->scale) / 2) + headX;
+ (outputRect.width / 2) - ((w->attrib.width * sw->scale) / 2) + outputRect.x;
sw->slot->y1 =
- (headHeight / 2) - ((w->attrib.height * sw->scale) / 2) + headY;
+ (outputRect.height / 2) - ((w->attrib.height * sw->scale) / 2) + outputRect.y;
}
else
{
diff --git a/beryl-plugins/src/splash.c b/beryl-plugins/src/splash.c
index c8c4cc7..64c92b2 100644
--- a/beryl-plugins/src/splash.c
+++ b/beryl-plugins/src/splash.c
@@ -291,15 +291,17 @@ splashPaintScreen (CompScreen * s, const ScreenPaintAttrib * sa,
SPLASH_DISPLAY (s->display);
Bool status = TRUE;
+ XRectangle outputRect;
UNWRAP (ss, s, paintScreen);
status = (*s->paintScreen) (s, sa, region, output, mask);
WRAP (ss, s, paintScreen, splashPaintScreen);
- int s_x = screenGetOutputDevX (s, output + 1);
- int s_y = screenGetOutputDevY (s, output + 1);
- int s_width = screenGetOutputDevWidth (s, output + 1);
- int s_height = screenGetOutputDevHeight (s, output + 1);
+ screenGetOutputDevRect (s, output + 1, &outputRect);
+ int s_x = outputRect.x;
+ int s_y = outputRect.y;
+ int s_width = outputRect.width;
+ int s_height = outputRect.height;
if (!ss->active)
return status;
@@ -474,12 +476,14 @@ splashPaintScreen (CompScreen * s, const ScreenPaintAttrib * sa,
if (s->nOutputDev > 1)
{
+ XRectangle headOutputRect;
head = screenGetCurrentOutputDev (s);
- x = (screenGetOutputDevWidth (s, head) - ss->backSize[0]) / 2;
- y = (screenGetOutputDevHeight (s, head) - ss->backSize[1]) / 2;
+ screenGetOutputDevRect (s, head, &headOutputRect);
+ x = (headOutputRect.width - ss->backSize[0]) / 2;
+ y = (headOutputRect.height - ss->backSize[1]) / 2;
- x += screenGetOutputDevX (s, head);
- y += screenGetOutputDevY (s, head);
+ x += headOutputRect.x;
+ y += headOutputRect.y;
}
else
{
@@ -522,13 +526,14 @@ splashPaintScreen (CompScreen * s, const ScreenPaintAttrib * sa,
if (s->nOutputDev > 1)
{
+ XRectangle headOutputRect;
head = screenGetCurrentOutputDev (s);
- x = (screenGetOutputDevAreaWidth (s, head) - ss->backSize[0]) / 2;
- y = (screenGetOutputDevAreaHeight (s, head) -
- ss->backSize[1]) / 2;
+ screenGetOutputDevRect (s, head, &headOutputRect);
+ x = (headOutputRect.width - ss->backSize[0]) / 2;
+ y = (headOutputRect.height - ss->backSize[1]) / 2;
- x += screenGetOutputDevAreaX (s, head);
- y += screenGetOutputDevAreaY (s, head);
+ x += headOutputRect.x;
+ y += headOutputRect.y;
}
else
{
@@ -547,13 +552,14 @@ splashPaintScreen (CompScreen * s, const ScreenPaintAttrib * sa,
if (s->nOutputDev > 1)
{
+ XRectangle headOutputRect;
head = screenGetCurrentOutputDev (s);
- x = (screenGetOutputDevAreaWidth (s, head) - ss->logoSize[0]) / 2;
- y = (screenGetOutputDevAreaHeight (s, head) -
- ss->logoSize[1]) / 2;
+ screenGetOutputDevRect (s, head, &headOutputRect);
+ x = (headOutputRect.width - ss->logoSize[0]) / 2;
+ y = (headOutputRect.height - ss->logoSize[1]) / 2;
- x += screenGetOutputDevAreaX (s, head);
- y += screenGetOutputDevAreaY (s, head);
+ x += headOutputRect.x;
+ y += headOutputRect.y;
}
else
{
diff --git a/beryl-plugins/src/switcher.c b/beryl-plugins/src/switcher.c
index 303cbb1..aeefdfd 100644
--- a/beryl-plugins/src/switcher.c
+++ b/beryl-plugins/src/switcher.c
@@ -657,19 +657,15 @@ switchUpdateWindowList (CompScreen * s, int count)
ss->selectedWindow = ss->windows[0]->id;
- if (ss->popupWindow)
+ if (ss->popupWindow) {
+ XRectangle outputRect;
+
+ screenGetOutputDevRect (s, ss->head, &outputRect);
XMoveResizeWindow (s->display->display, ss->popupWindow,
- screenGetOutputDevX (s,
- ss->head) + screenGetOutputDevWidth (s,
- ss->
- head)
- / 2 - WINDOW_WIDTH (count) / 2, screenGetOutputDevY (s,
- ss->
- head)
- + screenGetOutputDevHeight (s,
- ss->head) / 2 -
- WINDOW_HEIGHT / 2, WINDOW_WIDTH (count),
- WINDOW_HEIGHT);
+ outputRect.x + outputRect.width / 2 - WINDOW_WIDTH (count) / 2,
+ outputRect.y + outputRect.height / 2 - WINDOW_HEIGHT / 2,
+ WINDOW_WIDTH (count), WINDOW_HEIGHT);
+ }
}
@@ -787,6 +783,7 @@ switchCountWindows (CompScreen * s)
{
CompWindow *w;
int count = 0;
+ XRectangle outputRect;
// SWITCH_SCREEN(s);
for (w = s->windows; w && count < 5; w = w->next)
@@ -794,7 +791,9 @@ switchCountWindows (CompScreen * s)
count++;
int head = screenGetCurrentOutputDev (s);
- if (count == 5 && screenGetOutputDevWidth (s, head) <= WINDOW_WIDTH (5))
+ screenGetOutputDevRect (s, head, &outputRect);
+
+ if (count == 5 && outputRect.width <= WINDOW_WIDTH (5))
count = 3;
return count;
@@ -840,6 +839,7 @@ static void
switchInitiate (CompScreen * s, Bool allWindows)
{
int count;
+ XRectangle outputRect;
SWITCH_SCREEN (s);
@@ -853,6 +853,7 @@ switchInitiate (CompScreen * s, Bool allWindows)
return;
int head = screenGetCurrentOutputDev (s);
+ screenGetOutputDevRect (s, head, &outputRect);
if (!ss->popupWindow || head != ss->head)
{
@@ -900,15 +901,9 @@ switchInitiate (CompScreen * s, Bool allWindows)
{
ss->popupWindow =
XCreateWindow (dpy, s->root,
- screenGetOutputDevX (s,
- ss->head) +
- screenGetOutputDevWidth (s,
- ss->head) / 2 -
- xsh.width / 2, screenGetOutputDevY (s,
- ss->head) +
- screenGetOutputDevHeight (s,
- ss->head) / 2 -
- xsh.height / 2, xsh.width, xsh.height, 0, 32,
+ outputRect.x + outputRect.width / 2 - xsh.width / 2,
+ outputRect.y + outputRect.height / 2 - xsh.height / 2,
+ xsh.width, xsh.height, 0, 32,
InputOutput, visual,
CWBackPixel | CWBorderPixel | CWColormap,
&attr);
diff --git a/beryl-plugins/src/wobbly.c b/beryl-plugins/src/wobbly.c
index fb7d693..e217a1a 100644
--- a/beryl-plugins/src/wobbly.c
+++ b/beryl-plugins/src/wobbly.c
@@ -853,10 +853,10 @@ findNextWestEdge (CompWindow * w, Object * object)
{
for (i = 1; i <= w->screen->nOutputDev; i++)
{
- s = screenGetOutputDevAreaY (w->screen, i);
- e = screenGetOutputDevAreaY (w->screen,
- i) +
- screenGetOutputDevAreaHeight (w->screen, i);
+ XRectangle workArea;
+ screenGetOutputDevWorkArea (w->screen, i, &workArea);
+ s = workArea.y;
+ e = workArea.y + workArea.height;
if (s > object->position.y)
{
@@ -876,7 +876,7 @@ findNextWestEdge (CompWindow * w, Object * object)
if (e < end)
end = e;
- v = screenGetOutputDevAreaX (w->screen, i);
+ v = workArea.x;
if (v <= x)
{
if (v > v1)
@@ -983,10 +983,10 @@ findNextEastEdge (CompWindow * w, Object * object)
{
for (i = 1; i <= w->screen->nOutputDev; i++)
{
- s = screenGetOutputDevAreaY (w->screen, i);
- e = screenGetOutputDevAreaY (w->screen,
- i) +
- screenGetOutputDevAreaHeight (w->screen, i);
+ XRectangle workArea;
+ screenGetOutputDevWorkArea (w->screen, i, &workArea);
+ s = workArea.y;
+ e = workArea.y + workArea.height;
if (s > object->position.y)
{
@@ -1006,9 +1006,7 @@ findNextEastEdge (CompWindow * w, Object * object)
if (e < end)
end = e;
- v = screenGetOutputDevAreaX (w->screen,
- i) +
- screenGetOutputDevAreaWidth (w->screen, i);
+ v = workArea.x + workArea.width;
if (v >= x)
{
if (v < v1)
@@ -1115,10 +1113,10 @@ findNextNorthEdge (CompWindow * w, Object * object)
{
for (i = 1; i <= w->screen->nOutputDev; i++)
{
- s = screenGetOutputDevAreaX (w->screen, i);
- e = screenGetOutputDevAreaX (w->screen,
- i) +
- screenGetOutputDevAreaWidth (w->screen, i);
+ XRectangle workArea;
+ screenGetOutputDevWorkArea (w->screen, i, &workArea);
+ s = workArea.x;
+ e = workArea.x + workArea.width;
if (s > object->position.x)
{
@@ -1138,7 +1136,7 @@ findNextNorthEdge (CompWindow * w, Object * object)
if (e < end)
end = e;
- v = screenGetOutputDevAreaY (w->screen, i);
+ v = workArea.y;
if (v <= y)
{
if (v > v1)
@@ -1245,10 +1243,10 @@ findNextSouthEdge (CompWindow * w, Object * object)
{
for (i = 1; i <= w->screen->nOutputDev; i++)
{
- s = screenGetOutputDevAreaX (w->screen, i);
- e = screenGetOutputDevAreaX (w->screen,
- i) +
- screenGetOutputDevAreaWidth (w->screen, i);
+ XRectangle workArea;
+ screenGetOutputDevWorkArea (w->screen, i, &workArea);
+ s = workArea.x;
+ e = workArea.x + workArea.width;
if (s > object->position.x)
{
@@ -1268,9 +1266,7 @@ findNextSouthEdge (CompWindow * w, Object * object)
if (e < end)
end = e;
- v = screenGetOutputDevAreaY (w->screen,
- i) +
- screenGetOutputDevAreaHeight (w->screen, i);
+ v = workArea.y + workArea.height;
if (v >= y)
{
if (v < v1)