summaryrefslogtreecommitdiff
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
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
-rw-r--r--beryl-core/include/beryl.h32
-rw-r--r--beryl-core/src/display.c259
-rw-r--r--beryl-core/src/event.c16
-rw-r--r--beryl-core/src/paint.c13
-rw-r--r--beryl-core/src/screen.c111
-rw-r--r--beryl-core/src/window.c24
-rw-r--r--beryl-dbus/src/dbus.c11
-rw-r--r--beryl-plugins/src/cube.c23
-rw-r--r--beryl-plugins/src/place.c47
-rw-r--r--beryl-plugins/src/rotate.c8
-rw-r--r--beryl-plugins/src/scale.c4
-rw-r--r--beryl-plugins/src/screenshot.c4
-rw-r--r--beryl-plugins/src/switcher.c6
-rw-r--r--beryl-plugins/src/wobbly.c4
-rw-r--r--beryl-plugins/src/zoom.c6
15 files changed, 413 insertions, 155 deletions
diff --git a/beryl-core/include/beryl.h b/beryl-core/include/beryl.h
index 1ed6c55..544ee42 100644
--- a/beryl-core/include/beryl.h
+++ b/beryl-core/include/beryl.h
@@ -43,6 +43,7 @@ sizeof(CompIcon)
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xdamage.h>
+#include <X11/extensions/Xinerama.h>
#include <X11/extensions/sync.h>
#include <X11/Xregion.h>
#include <X11/XKBlib.h>
@@ -595,6 +596,12 @@ struct _CompDisplay {
Bool xkbExtension;
int xkbEvent, xkbError;
+ Bool xineramaExtension;
+ int xineramaEvent, xineramaError;
+
+ XineramaScreenInfo *screenInfo;
+ int nScreenInfo;
+
SnDisplay *snDisplay;
Atom supportedAtom;
@@ -927,10 +934,12 @@ typedef void (*DonePaintScreenProc) (CompScreen *screen);
typedef Bool (*PaintScreenProc) (CompScreen *screen,
const ScreenPaintAttrib *sAttrib,
Region region,
+ int output,
unsigned int mask);
typedef void (*PaintTransformedScreenProc) (CompScreen *screen,
const ScreenPaintAttrib *sAttrib,
+ int output,
unsigned int mask);
@@ -979,12 +988,14 @@ translateRotateScreen (const ScreenPaintAttrib *sa);
void
paintTransformedScreen (CompScreen *screen,
const ScreenPaintAttrib *sAttrib,
+ int output,
unsigned int mask);
Bool
paintScreen (CompScreen *screen,
const ScreenPaintAttrib *sAttrib,
Region region,
+ int output,
unsigned int mask);
Bool
@@ -1348,6 +1359,11 @@ struct _CompIcon {
int height;
};
+typedef struct _CompOutput {
+ char *name;
+ REGION region;
+} CompOutput;
+
struct _CompScreen {
CompScreen *next;
CompDisplay *display;
@@ -1393,6 +1409,10 @@ struct _CompScreen {
unsigned int mapNum;
unsigned int activeNum;
+ CompOutput *outputDev;
+ int nOutputDev;
+ int currentOutputDev;
+
int overlayWindowCount;
CompScreenEdge screenEdge[SCREEN_EDGE_NUM];
@@ -1544,6 +1564,10 @@ configureScreen (CompScreen *s,
XConfigureEvent *ce);
void
+setCurrentOutput (CompScreen *s,
+ int outputNum);
+
+void
updateScreenBackground (CompScreen *screen,
CompTexture *texture);
@@ -1745,6 +1769,11 @@ makeScreenCurrent (CompScreen *s);
void
finishScreenDrawing (CompScreen *s);
+int
+outputDeviceForPoint (CompScreen *s,
+ int x,
+ int y);
+
/* window.c */
@@ -2177,6 +2206,9 @@ getWindowIcon (CompWindow *w,
void
freeWindowIcons (CompWindow *w);
+int
+outputDeviceForWindow (CompWindow *w);
+
/* plugin.c */
diff --git a/beryl-core/src/display.c b/beryl-core/src/display.c
index 94b7d60..ae16572 100644
--- a/beryl-core/src/display.c
+++ b/beryl-core/src/display.c
@@ -1800,6 +1800,11 @@ waitForVideoSync (CompScreen * s)
if (!s->opt[COMP_SCREEN_OPTION_SYNC_TO_VBLANK].value.b)
return;
+ /* we currently can't handle sync to vblank when we have more than one
+ output device */
+ if (s->nOutputDev > 1)
+ return;
+
if (s->getVideoSync)
{
glFlush ();
@@ -1813,19 +1818,21 @@ void
eventLoop (void)
{
XEvent event;
- int timeDiff;
+ int timeDiff, i;
struct timeval tv;
- Region tmpRegion;
+ Region tmpRegion, outputRegion;
CompDisplay *display = compDisplays;
CompScreen *s;
int time, timeToNextRedraw = 0;
CompWindow *w;
- unsigned int damageMask;
+ unsigned int damageMask, mask;
tmpRegion = XCreateRegion ();
- if (!tmpRegion)
+ outputRegion = XCreateRegion ();
+ if (!tmpRegion || !outputRegion)
{
- fprintf (stderr, "%s: Couldn't create region\n", programName);
+ fprintf (stderr, "%s: Couldn't create temporary regions\n",
+ programName);
return;
}
@@ -1992,109 +1999,130 @@ eventLoop (void)
{
XIntersectRegion (s->damage, &s->region, tmpRegion);
- if (tmpRegion->numRects == 1 &&
- tmpRegion->rects->x1 == 0 &&
- tmpRegion->rects->y1 == 0 &&
+ if (tmpRegion->numRects == 1 &&
+ tmpRegion->rects->x1 == 0 &&
+ tmpRegion->rects->y1 == 0 &&
tmpRegion->rects->x2 == s->width &&
tmpRegion->rects->y2 == s->height)
damageScreen (s);
}
EMPTY_REGION (s->damage);
+ mask = s->damageMask;
+ s->damageMask = 0;
- if (s->damageMask & COMP_SCREEN_DAMAGE_ALL_MASK)
- {
- s->damageMask = 0;
-
- (*s->paintScreen) (s,
- &defaultScreenPaintAttrib,
- &s->region,
- PAINT_SCREEN_REGION_MASK |
- PAINT_SCREEN_FULL_MASK);
-
- waitForVideoSync (s);
-
- glXSwapBuffers (s->display->display, s->output);
- }
- else if (s->damageMask & COMP_SCREEN_DAMAGE_REGION_MASK)
+ for (i = 0; i < s->nOutputDev; i++)
{
- s->damageMask = 0;
+ if (s->nOutputDev > 1)
+ glScissor (s->outputDev[i].region.extents.x1,
+ s->outputDev[i].region.extents.y1,
+ s->outputDev[i].region.extents.x2 -
+ s->outputDev[i].region.extents.x1,
+ s->outputDev[i].region.extents.y2 -
+ s->outputDev[i].region.extents.y1);
+
+ if (mask & COMP_SCREEN_DAMAGE_ALL_MASK)
+ {
+ (*s->paintScreen) (s,
+ &defaultScreenPaintAttrib,
+ &s->outputDev[i].region, i,
+ PAINT_SCREEN_REGION_MASK |
+ PAINT_SCREEN_FULL_MASK);
- if ((*s->paintScreen) (s,
- &defaultScreenPaintAttrib,
- tmpRegion,
- PAINT_SCREEN_REGION_MASK))
+ if (i + 1 == s->nOutputDev)
+ {
+ waitForVideoSync (s);
+ glXSwapBuffers (s->display->display, s->output);
+ }
+ }
+ else if (mask & COMP_SCREEN_DAMAGE_REGION_MASK)
{
- BoxPtr pBox;
- int nBox, y;
+ XIntersectRegion (tmpRegion,
+ &s->outputDev[i].region,
+ outputRegion);
+
+ if ((*s->paintScreen) (s,
+ &defaultScreenPaintAttrib,
+ outputRegion, i,
+ PAINT_SCREEN_REGION_MASK))
+ {
+ BoxPtr pBox;
+ int nBox, y;
- pBox = tmpRegion->rects;
- nBox = tmpRegion->numRects;
+ pBox = outputRegion->rects;
+ nBox = outputRegion->numRects;
- waitForVideoSync (s);
+ waitForVideoSync (s);
- if (s->copySubBuffer)
- {
- while (nBox--)
+ if (s->copySubBuffer)
{
- y = s->height - pBox->y2;
-
- (*s->copySubBuffer) (s->display->display,
- s->output,
- pBox->x1, y,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1);
-
- pBox++;
+ while (nBox--)
+ {
+ y = s->height - pBox->y2;
+
+ (*s->copySubBuffer) (display->display,
+ s->output,
+ pBox->x1, y,
+ pBox->x2 -
+ pBox->x1,
+ pBox->y2 -
+ pBox->y1);
+
+ pBox++;
+ }
}
- }
- else
- {
- glEnable (GL_SCISSOR_TEST);
- glDrawBuffer (GL_FRONT);
-
- while (nBox--)
+ else
{
- y = s->height - pBox->y2;
+ glEnable (GL_SCISSOR_TEST);
+ glDrawBuffer (GL_FRONT);
- glBitmap (0, 0, 0, 0,
- pBox->x1 - s->rasterX,
- y - s->rasterY, NULL);
+ while (nBox--)
+ {
+ y = s->height - pBox->y2;
- s->rasterX = pBox->x1;
- s->rasterY = y;
+ glBitmap (0, 0, 0, 0,
+ pBox->x1 - s->rasterX,
+ y - s->rasterY,
+ NULL);
- glScissor (pBox->x1, y,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1);
+ s->rasterX = pBox->x1;
+ s->rasterY = y;
- glCopyPixels (pBox->x1, y,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- GL_COLOR);
+ glScissor (pBox->x1, y,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
- pBox++;
- }
+ glCopyPixels (pBox->x1, y,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1,
+ GL_COLOR);
- glDrawBuffer (GL_BACK);
- glDisable (GL_SCISSOR_TEST);
- glFlush ();
- }
- }
- else
- {
- (*s->paintScreen) (s,
- &defaultScreenPaintAttrib,
- &s->region,
- PAINT_SCREEN_FULL_MASK);
+ pBox++;
+ }
- waitForVideoSync (s);
+ glDrawBuffer (GL_BACK);
+ glDisable (GL_SCISSOR_TEST);
+ glFlush ();
+ }
+ }
+ else
+ {
+ (*s->paintScreen) (s,
+ &defaultScreenPaintAttrib,
+ &s->outputDev[i].region, i,
+ PAINT_SCREEN_FULL_MASK);
- glXSwapBuffers (s->display->display,
+ if (i + 1 == s->nOutputDev)
+ {
+ waitForVideoSync (s);
+ glXSwapBuffers (display->display,
s->output);
+ }
+ }
}
}
+
s->lastRedraw = tv;
IPCS_lock = FALSE;
@@ -2152,7 +2180,7 @@ eventLoop (void)
static int errors = 0;
-static int
+ static int
errorHandler (Display * dpy, XErrorEvent * e)
{
@@ -2171,11 +2199,11 @@ errorHandler (Display * dpy, XErrorEvent * e)
o = e->error_code - compDisplays->damageError;
switch (o)
{
- case BadDamage:
- name = "BadDamage";
- break;
- default:
- break;
+ case BadDamage:
+ name = "BadDamage";
+ break;
+ default:
+ break;
}
if (name)
@@ -2211,7 +2239,7 @@ errorHandler (Display * dpy, XErrorEvent * e)
return 0;
}
-int
+ int
compCheckForError (Display * dpy)
{
int e;
@@ -2226,7 +2254,7 @@ compCheckForError (Display * dpy)
#define PING_DELAY 5000
-static Bool
+ static Bool
pingTimeout (void *closure)
{
CompDisplay *d = closure;
@@ -2271,10 +2299,10 @@ pingTimeout (void *closure)
if (w->closeRequests)
{
toolkitAction (s,
- d->
- toolkitActionForceQuitDialogAtom,
- w->lastCloseRequestTime, w->id,
- TRUE, 0, 0);
+ d->
+ toolkitActionForceQuitDialogAtom,
+ w->lastCloseRequestTime, w->id,
+ TRUE, 0, 0);
w->closeRequests = 0;
}
@@ -2296,38 +2324,38 @@ pingTimeout (void *closure)
return TRUE;
}
-static void
+ static void
addScreenActions (CompDisplay * d, CompScreen * s)
{
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_CLOSE_WINDOW].value.action);
+ &d->opt[COMP_DISPLAY_OPTION_CLOSE_WINDOW].value.action);
addScreenAction (s, &d->opt[COMP_DISPLAY_OPTION_MAIN_MENU].value.action);
addScreenAction (s, &d->opt[COMP_DISPLAY_OPTION_RUN_DIALOG].value.action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_MINIMIZE_WINDOW].value.
- action);
+ &d->opt[COMP_DISPLAY_OPTION_MINIMIZE_WINDOW].value.
+ action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW].value.
- action);
+ &d->opt[COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW].value.
+ action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_HORZ].value.
- action);
+ &d->opt[COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_HORZ].value.
+ action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_VERT].value.
- action);
+ &d->opt[COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_VERT].value.
+ action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_UNMAXIMIZE_WINDOW].value.
- action);
+ &d->opt[COMP_DISPLAY_OPTION_UNMAXIMIZE_WINDOW].value.
+ action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_SHOW_DESKTOP].value.action);
+ &d->opt[COMP_DISPLAY_OPTION_SHOW_DESKTOP].value.action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND0].value.action);
+ &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND0].value.action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND1].value.action);
+ &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND1].value.action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND2].value.action);
+ &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND2].value.action);
addScreenAction (s,
- &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND3].value.action);
+ &d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND3].value.action);
addScreenAction (s,
&d->opt[COMP_DISPLAY_OPTION_RUN_COMMAND4].value.action);
addScreenAction (s,
@@ -2679,6 +2707,19 @@ addDisplay (char *name, char **plugin, int nPlugin)
d->xkbEvent = d->xkbError = -1;
}
+ d->xineramaExtension = XineramaQueryExtension (dpy,
+ &d->xineramaEvent,
+ &d->xineramaError);
+ if (d->xineramaExtension)
+ {
+ d->screenInfo = XineramaQueryScreens (dpy, &d->nScreenInfo);
+ }
+ else
+ {
+ d->screenInfo = NULL;
+ d->nScreenInfo = 0;
+ }
+
compDisplays = d;
d->escapeKeyCode = XKeysymToKeycode (dpy, XStringToKeysym ("Escape"));
diff --git a/beryl-core/src/event.c b/beryl-core/src/event.c
index 60bea7e..393b5da 100644
--- a/beryl-core/src/event.c
+++ b/beryl-core/src/event.c
@@ -1067,6 +1067,22 @@ handleEvent (CompDisplay * d, XEvent * event)
CompScreen *s;
CompWindow *w;
+ switch (event->type) {
+ case ButtonPress:
+ s = findScreenAtDisplay (d, event->xbutton.root);
+ if (s)
+ setCurrentOutput (s, outputDeviceForPoint (s,
+ event->xbutton.x_root,
+ event->xbutton.y_root));
+ break;
+ case KeyPress:
+ w = findWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ setCurrentOutput (w->screen, outputDeviceForWindow (w));
+ default:
+ break;
+ }
+
if (handleActionEvent (d, event))
{
if (!d->screens->maxGrab)
diff --git a/beryl-core/src/paint.c b/beryl-core/src/paint.c
index 1f57e47..f92b245 100644
--- a/beryl-core/src/paint.c
+++ b/beryl-core/src/paint.c
@@ -61,7 +61,9 @@ translateRotateScreen (const ScreenPaintAttrib * sa)
void
paintTransformedScreen (CompScreen * screen,
- const ScreenPaintAttrib * sAttrib, unsigned int mask)
+ const ScreenPaintAttrib * sAttrib,
+ int output,
+ unsigned int mask)
{
CompWindow *w;
int windowMask;
@@ -141,7 +143,9 @@ paintTransformedScreen (CompScreen * screen,
Bool
paintScreen (CompScreen * screen,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region,
+ int output,
+ unsigned int mask)
{
static Region tmpRegion = NULL;
CompWindow *w;
@@ -152,7 +156,8 @@ paintScreen (CompScreen * screen,
{
if (mask & PAINT_SCREEN_FULL_MASK)
{
- (*screen->paintTransformedScreen) (screen, sAttrib, mask);
+ (*screen->paintTransformedScreen) (screen, sAttrib, output,
+ mask);
return TRUE;
}
@@ -164,7 +169,7 @@ paintScreen (CompScreen * screen,
}
else if (mask & PAINT_SCREEN_FULL_MASK)
{
- (*screen->paintTransformedScreen) (screen, sAttrib, mask);
+ (*screen->paintTransformedScreen) (screen, sAttrib, output, mask);
return TRUE;
}
diff --git a/beryl-core/src/screen.c b/beryl-core/src/screen.c
index 2e2f619..79374a1 100644
--- a/beryl-core/src/screen.c
+++ b/beryl-core/src/screen.c
@@ -571,11 +571,84 @@ perspective (GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
}
static void
-reshape (CompScreen * s, int w, int h)
+updateOutputDevices (CompScreen *s)
{
- s->width = w;
- s->height = h;
+ CompOutput *output;
+ int nOutput, i;
+
+ if (s->display->screenInfo)
+ {
+ XineramaScreenInfo *screenInfo = s->display->screenInfo;
+ int nScreenInfo = s->display->nScreenInfo;
+
+ output = malloc (sizeof (CompOutput) * nScreenInfo);
+ if (!output)
+ return;
+
+ for (i = 0; i < nScreenInfo; i++)
+ {
+ output->name = malloc (sizeof (char) * 10);
+ if (output->name)
+ snprintf (output->name, 10, "Output %d", i);
+
+ output[i].region.rects = &output[i].region.extents;
+ output[i].region.numRects = 1;
+
+ output[i].region.extents.x1 = screenInfo[i].x_org;
+ output[i].region.extents.y1 = screenInfo[i].y_org;
+ output[i].region.extents.x2 = screenInfo[i].x_org +
+ screenInfo[i].width;
+ output[i].region.extents.y2 = screenInfo[i].y_org +
+ screenInfo[i].height;
+ }
+
+ nOutput = nScreenInfo;
+ }
+ else
+ {
+ output = malloc (sizeof (CompOutput));
+ if (!output)
+ return;
+
+ output->name = strdup ("Output 0");
+
+ output->region.rects = &output->region.extents;
+ output->region.numRects = 1;
+
+ output->region.extents.x1 = 0;
+ output->region.extents.y1 = 0;
+ output->region.extents.x2 = s->attrib.width;
+ output->region.extents.y2 = s->attrib.height;
+
+ nOutput = 1;
+ }
+
+ if (s->outputDev)
+ {
+ for (i = 0; i < s->nOutputDev; i++)
+ if (s->outputDev->name)
+ free (s->outputDev->name);
+
+ free (s->outputDev);
+ }
+
+ s->outputDev = output;
+ s->nOutputDev = nOutput;
+}
+void
+setCurrentOutput (CompScreen *s,
+ int outputNum)
+{
+ if (outputNum >= s->nOutputDev)
+ outputNum = 0;
+
+ s->currentOutputDev = outputNum;
+}
+
+static void
+reshape (CompScreen * s, int w, int h)
+{
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glMatrixMode (GL_MODELVIEW);
@@ -600,6 +673,13 @@ reshape (CompScreen * s, int w, int h)
s->region.extents.y2 = h;
s->region.size = 1;
+ s->width = w;
+ s->height = h;
+
+ updateOutputDevices (s);
+
+ setCurrentOutput (s, s->currentOutputDev);
+
updateScreenEdges (s);
updateWorkareaForScreen (s);
}
@@ -1082,6 +1162,10 @@ addScreen (CompDisplay * display,
s->rasterX = 0;
s->rasterY = 0;
+ s->outputDev = NULL;
+ s->nOutputDev = 0;
+ s->currentOutputDev = 0;
+
s->windows = 0;
s->reverseWindows = 0;
@@ -3333,3 +3417,24 @@ finishScreenDrawing (CompScreen * s)
s->pendingCommands = FALSE;
}
}
+
+int
+outputDeviceForPoint (CompScreen *s,
+ int x,
+ int y)
+{
+ int i, x1, y1, x2, y2;
+
+ for (i = 0; i < s->nOutputDev; i++)
+ {
+ x1 = s->outputDev[i].region.extents.x1;
+ y1 = s->outputDev[i].region.extents.y1;
+ x2 = s->outputDev[i].region.extents.x2;
+ y2 = s->outputDev[i].region.extents.y2;
+
+ if (x1 < x && x2 >= x && y1 < y && y2 >= y)
+ return i;
+ }
+
+ return s->currentOutputDev;
+}
diff --git a/beryl-core/src/window.c b/beryl-core/src/window.c
index 9d90525..d41f41f 100644
--- a/beryl-core/src/window.c
+++ b/beryl-core/src/window.c
@@ -4032,3 +4032,27 @@ freeWindowIcons (CompWindow * w)
w->nIcon = 0;
}
+
+int
+outputDeviceForWindow (CompWindow *w)
+{
+ int output = w->screen->currentOutputDev;
+ int x1, y1, x2, y2;
+
+ x1 = w->screen->outputDev[output].region.extents.x1;
+ y1 = w->screen->outputDev[output].region.extents.y1;
+ x2 = w->screen->outputDev[output].region.extents.x2;
+ y2 = w->screen->outputDev[output].region.extents.y2;
+
+ if (x1 > w->attrib.x + w->width ||
+ y1 > w->attrib.y + w->height ||
+ x2 < w->attrib.x ||
+ y2 < w->attrib.y)
+ {
+ output = outputDeviceForPoint (w->screen,
+ w->attrib.x + w->width / 2,
+ w->attrib.y + w->height / 2);
+ }
+
+ return output;
+}
diff --git a/beryl-dbus/src/dbus.c b/beryl-dbus/src/dbus.c
index b34cb46..60d6e91 100644
--- a/beryl-dbus/src/dbus.c
+++ b/beryl-dbus/src/dbus.c
@@ -839,18 +839,10 @@ dbusFini (CompPlugin *p)
freeDisplayPrivateIndex (displayPrivateIndex);
}
-static int
-dbusGetVersion (CompPlugin *plugin,
- int version)
-{
- return ABIVERSION;
-}
-
CompPluginVTable dbusVTable = {
"dbus",
"Dbus",
"Dbus Control Backend",
- dbusGetVersion,
dbusInit,
dbusFini,
dbusInitDisplay,
@@ -864,7 +856,8 @@ CompPluginVTable dbusVTable = {
0, /* GetScreenOptions */
0, /* SetScreenOption */
NULL,
- 0
+ 0,
+ BERYL_ABI_INFO
};
CompPluginVTable *
diff --git a/beryl-plugins/src/cube.c b/beryl-plugins/src/cube.c
index 8ae6579..d38c6a0 100644
--- a/beryl-plugins/src/cube.c
+++ b/beryl-plugins/src/cube.c
@@ -1331,7 +1331,9 @@ cubePreparePaintScreen (CompScreen * s, int msSinceLastPaint)
static Bool
cubePaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region,
+ int output,
+ unsigned int mask)
{
Bool status;
@@ -1344,7 +1346,7 @@ cubePaintScreen (CompScreen * s,
}
UNWRAP (cs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (cs, s, paintScreen, cubePaintScreen);
return status;
@@ -1366,6 +1368,7 @@ cubeDonePaintScreen (CompScreen * s)
static void
cubePaintTransformedScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
+ int output,
unsigned int mask)
{
ScreenPaintAttrib sa = *sAttrib;
@@ -1641,7 +1644,7 @@ cubePaintTransformedScreen (CompScreen * s,
if (xMove != cs->xrotations + 1)
{
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
}
sa.yRotate -= 360.0f / size;
@@ -1652,7 +1655,7 @@ cubePaintTransformedScreen (CompScreen * s,
sa.yRotate = yRot - (360.0 / size);
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
s->display->textureFilter = filter;
@@ -1664,7 +1667,7 @@ cubePaintTransformedScreen (CompScreen * s,
xMove = cs->xrotations;
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
xMove++;
@@ -1674,7 +1677,7 @@ cubePaintTransformedScreen (CompScreen * s,
sa.yRotate -= 360.0f / size;
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
}
}
@@ -1712,7 +1715,7 @@ cubePaintTransformedScreen (CompScreen * s,
for (i = 0; i < s->hsize; i++)
{
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate += 360.0f / size;
@@ -1724,21 +1727,21 @@ cubePaintTransformedScreen (CompScreen * s,
else
{
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate += 360.0f / size;
xMove = -cs->xrotations;
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate += 360.0f / size;
xMove = 1 - cs->xrotations;
moveScreenViewport (s, xMove, 0, FALSE);
- (*s->paintTransformedScreen) (s, &sa, mask);
+ (*s->paintTransformedScreen) (s, &sa, output, mask);
moveScreenViewport (s, -xMove, 0, FALSE);
}
}
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;
diff --git a/beryl-plugins/src/rotate.c b/beryl-plugins/src/rotate.c
index 447b01b..ddb084c 100644
--- a/beryl-plugins/src/rotate.c
+++ b/beryl-plugins/src/rotate.c
@@ -887,7 +887,9 @@ rotateDonePaintScreen (CompScreen * s)
static Bool
rotatePaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region,
+ int output,
+ unsigned int mask)
{
Bool status;
@@ -918,13 +920,13 @@ rotatePaintScreen (CompScreen * s,
mask |= PAINT_SCREEN_TRANSFORMED_MASK;
UNWRAP (rs, s, paintScreen);
- status = (*s->paintScreen) (s, &sa, region, mask);
+ status = (*s->paintScreen) (s, &sa, region, output, mask);
WRAP (rs, s, paintScreen, rotatePaintScreen);
}
else
{
UNWRAP (rs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (rs, s, paintScreen, rotatePaintScreen);
}
diff --git a/beryl-plugins/src/scale.c b/beryl-plugins/src/scale.c
index b9634ed..8649314 100644
--- a/beryl-plugins/src/scale.c
+++ b/beryl-plugins/src/scale.c
@@ -1853,7 +1853,7 @@ adjustScaleVelocity (CompWindow * w)
static Bool
scalePaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region, int output, unsigned int mask)
{
Bool status;
@@ -1863,7 +1863,7 @@ scalePaintScreen (CompScreen * s,
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
UNWRAP (ss, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (ss, s, paintScreen, scalePaintScreen);
return status;
diff --git a/beryl-plugins/src/screenshot.c b/beryl-plugins/src/screenshot.c
index 9bff3f6..442308a 100644
--- a/beryl-plugins/src/screenshot.c
+++ b/beryl-plugins/src/screenshot.c
@@ -166,14 +166,14 @@ shotFilter (const struct dirent *d)
static Bool
shotPaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region, int output, unsigned int mask)
{
Bool status;
SHOT_SCREEN (s);
UNWRAP (ss, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (ss, s, paintScreen, shotPaintScreen);
if (status && ss->grab)
diff --git a/beryl-plugins/src/switcher.c b/beryl-plugins/src/switcher.c
index 99aba6c..58bf58d 100644
--- a/beryl-plugins/src/switcher.c
+++ b/beryl-plugins/src/switcher.c
@@ -1492,7 +1492,7 @@ switchPreparePaintScreen (CompScreen * s, int msSinceLastPaint)
static Bool
switchPaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region, int output, unsigned int mask)
{
Bool status;
@@ -1541,7 +1541,7 @@ switchPaintScreen (CompScreen * s,
}
UNWRAP (ss, s, paintScreen);
- status = (*s->paintScreen) (s, &sa, region, mask);
+ status = (*s->paintScreen) (s, &sa, region, output, mask);
WRAP (ss, s, paintScreen, switchPaintScreen);
if (zoomed)
@@ -1572,7 +1572,7 @@ switchPaintScreen (CompScreen * s,
else
{
UNWRAP (ss, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (ss, s, paintScreen, switchPaintScreen);
}
diff --git a/beryl-plugins/src/wobbly.c b/beryl-plugins/src/wobbly.c
index 7ecc100..ad0e5ab 100644
--- a/beryl-plugins/src/wobbly.c
+++ b/beryl-plugins/src/wobbly.c
@@ -3363,7 +3363,7 @@ wobblyWindowUngrabNotify (CompWindow * w)
static Bool
wobblyPaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region, int output, unsigned int mask)
{
Bool status;
@@ -3373,7 +3373,7 @@ wobblyPaintScreen (CompScreen * s,
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
UNWRAP (ws, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (ws, s, paintScreen, wobblyPaintScreen);
return status;
diff --git a/beryl-plugins/src/zoom.c b/beryl-plugins/src/zoom.c
index 2d84158..8f1a654 100644
--- a/beryl-plugins/src/zoom.c
+++ b/beryl-plugins/src/zoom.c
@@ -459,7 +459,7 @@ zoomDonePaintScreen (CompScreen * s)
static Bool
zoomPaintScreen (CompScreen * s,
const ScreenPaintAttrib * sAttrib,
- Region region, unsigned int mask)
+ Region region, int output, unsigned int mask)
{
Bool status;
@@ -493,7 +493,7 @@ zoomPaintScreen (CompScreen * s,
s->filter[SCREEN_TRANS_FILTER] = COMP_TEXTURE_FILTER_FAST;
UNWRAP (zs, s, paintScreen);
- status = (*s->paintScreen) (s, &sa, region, mask);
+ status = (*s->paintScreen) (s, &sa, region, output, mask);
WRAP (zs, s, paintScreen, zoomPaintScreen);
s->filter[SCREEN_TRANS_FILTER] = saveFilter;
@@ -501,7 +501,7 @@ zoomPaintScreen (CompScreen * s,
else
{
UNWRAP (zs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, mask);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (zs, s, paintScreen, zoomPaintScreen);
}