diff options
Diffstat (limited to 'xorg-server/composite')
-rw-r--r-- | xorg-server/composite/compext.c | 362 | ||||
-rw-r--r-- | xorg-server/composite/compint.h | 3 | ||||
-rw-r--r-- | xorg-server/composite/compoverlay.c | 17 | ||||
-rw-r--r-- | xorg-server/composite/compwindow.c | 22 |
4 files changed, 391 insertions, 13 deletions
diff --git a/xorg-server/composite/compext.c b/xorg-server/composite/compext.c index a87b37ca8..2ee6f1259 100644 --- a/xorg-server/composite/compext.c +++ b/xorg-server/composite/compext.c @@ -535,13 +535,6 @@ CompositeExtensionInit (void) if (GetPictureScreenIfSet(pScreen) == NULL)
return;
}
-#ifdef PANORAMIX
- /* Xinerama's rewriting of window drawing before Composite gets to it
- * breaks Composite.
- */
- if (!noPanoramiXExtension)
- return;
-#endif
CompositeClientWindowType = CreateNewResourceType
(FreeCompositeClientWindow, "CompositeClientWindow");
@@ -582,3 +575,358 @@ CompositeExtensionInit (void) /* Initialization succeeded */
noCompositeExtension = FALSE;
}
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+
+int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr);
+
+static int
+PanoramiXCompositeRedirectWindow (ClientPtr client)
+{
+ PanoramiXRes *win;
+ int rc = 0, j;
+ REQUEST(xCompositeRedirectWindowReq);
+
+ REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success) break;
+ }
+
+ return rc;
+}
+
+static int
+PanoramiXCompositeRedirectSubwindows (ClientPtr client)
+{
+ PanoramiXRes *win;
+ int rc = 0, j;
+ REQUEST(xCompositeRedirectSubwindowsReq);
+
+ REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success) break;
+ }
+
+ return rc;
+}
+
+static int
+PanoramiXCompositeUnredirectWindow (ClientPtr client)
+{
+ PanoramiXRes *win;
+ int rc = 0, j;
+ REQUEST(xCompositeUnredirectWindowReq);
+
+ REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success) break;
+ }
+
+ return rc;
+}
+
+static int
+PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
+{
+ PanoramiXRes *win;
+ int rc = 0, j;
+ REQUEST(xCompositeUnredirectSubwindowsReq);
+
+ REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
+ rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
+ if (rc != Success) break;
+ }
+
+ return rc;
+}
+
+static int
+PanoramiXCompositeNameWindowPixmap (ClientPtr client)
+{
+ WindowPtr pWin;
+ CompWindowPtr cw;
+ PixmapPtr pPixmap;
+ int rc;
+ PanoramiXRes *win, *newPix;
+ int i;
+ REQUEST(xCompositeNameWindowPixmapReq);
+
+ REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ LEGAL_NEW_RESOURCE (stuff->pixmap, client);
+
+ if(!(newPix = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newPix->type = XRT_PIXMAP;
+ newPix->u.pix.shared = FALSE;
+ newPix->info[0].id = stuff->pixmap;
+
+ for (i = 1; i < PanoramiXNumScreens; i++)
+ newPix->info[i].id = FakeClientID (client->index);
+
+ FOR_NSCREENS(i) {
+ rc = dixLookupResourceByType ((void **) &pWin, win->info[i].id,
+ RT_WINDOW, client, DixGetAttrAccess);
+ if (rc != Success)
+ {
+ client->errorValue = stuff->window;
+ free (newPix);
+ return rc;
+ }
+
+ if (!pWin->viewable)
+ {
+ free (newPix);
+ return BadMatch;
+ }
+
+ cw = GetCompWindow (pWin);
+ if (!cw)
+ {
+ free (newPix);
+ return BadMatch;
+ }
+
+ pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+ if (!pPixmap)
+ {
+ free (newPix);
+ return BadMatch;
+ }
+
+ if (!AddResource (newPix->info[i].id, RT_PIXMAP,
+ (pointer) pPixmap))
+ return BadAlloc;
+
+ ++pPixmap->refcnt;
+ }
+
+ if (!AddResource (stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
+ return BadAlloc;
+
+ return Success;
+}
+
+
+static int
+PanoramiXCompositeGetOverlayWindow (ClientPtr client)
+{
+ REQUEST(xCompositeGetOverlayWindowReq);
+ xCompositeGetOverlayWindowReply rep;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ CompScreenPtr cs;
+ CompOverlayClientPtr pOc;
+ int rc;
+ PanoramiXRes *win, *overlayWin = NULL;
+ int i;
+
+ REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ cs = GetCompScreen(screenInfo.screens[0]);
+ if (!cs->pOverlayWin)
+ {
+ if(!(overlayWin = malloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ overlayWin->type = XRT_WINDOW;
+ overlayWin->u.win.root = FALSE;
+ }
+
+ FOR_NSCREENS_BACKWARD(i) {
+ rc = dixLookupResourceByType((pointer *)&pWin, win->info[i].id,
+ RT_WINDOW, client, DixGetAttrAccess);
+ if (rc != Success)
+ {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * Create an OverlayClient structure to mark this client's
+ * interest in the overlay window
+ */
+ pOc = compCreateOverlayClient(pScreen, client);
+ if (pOc == NULL)
+ return BadAlloc;
+
+ /*
+ * Make sure the overlay window exists
+ */
+ cs = GetCompScreen(pScreen);
+ if (cs->pOverlayWin == NULL)
+ if (!compCreateOverlayWindow(pScreen))
+ {
+ FreeResource (pOc->resource, RT_NONE);
+ return BadAlloc;
+ }
+
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client,
+ cs->pOverlayWin->drawable.id,
+ RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
+ DixGetAttrAccess);
+ if (rc != Success)
+ {
+ FreeResource (pOc->resource, RT_NONE);
+ return rc;
+ }
+ }
+
+ if (overlayWin)
+ {
+ FOR_NSCREENS(i) {
+ cs = GetCompScreen(screenInfo.screens[i]);
+ overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
+ }
+
+ AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
+ }
+
+ cs = GetCompScreen(screenInfo.screens[0]);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.overlayWin = cs->pOverlayWin->drawable.id;
+
+ if (client->swapped)
+ {
+ int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.overlayWin, n);
+ }
+ (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
+
+ return Success;
+}
+
+static int
+PanoramiXCompositeReleaseOverlayWindow (ClientPtr client)
+{
+ REQUEST(xCompositeReleaseOverlayWindowReq);
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ CompOverlayClientPtr pOc;
+ PanoramiXRes *win;
+ int i, rc;
+
+ REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
+
+ if ((rc = dixLookupResourceByType((void **)&win, stuff->window, XRT_WINDOW,
+ client, DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+
+ FOR_NSCREENS_BACKWARD(i) {
+ if ((rc = dixLookupResourceByType((void **)&pWin, win->info[i].id,
+ XRT_WINDOW, client,
+ DixUnknownAccess))) {
+ client->errorValue = stuff->window;
+ return rc;
+ }
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * Has client queried a reference to the overlay window
+ * on this screen? If not, generate an error.
+ */
+ pOc = compFindOverlayClient (pWin->drawable.pScreen, client);
+ if (pOc == NULL)
+ return BadMatch;
+
+ /* The delete function will free the client structure */
+ FreeResource (pOc->resource, RT_NONE);
+ }
+
+ return Success;
+}
+
+void
+PanoramiXCompositeInit (void)
+{
+ int i;
+
+ for (i = 0; i < CompositeNumberRequests; i++)
+ PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
+ /*
+ * Stuff in Xinerama aware request processing hooks
+ */
+ ProcCompositeVector[X_CompositeRedirectWindow] =
+ PanoramiXCompositeRedirectWindow;
+ ProcCompositeVector[X_CompositeRedirectSubwindows] =
+ PanoramiXCompositeRedirectSubwindows;
+ ProcCompositeVector[X_CompositeUnredirectWindow] =
+ PanoramiXCompositeUnredirectWindow;
+ ProcCompositeVector[X_CompositeUnredirectSubwindows] =
+ PanoramiXCompositeUnredirectSubwindows;
+ ProcCompositeVector[X_CompositeNameWindowPixmap] =
+ PanoramiXCompositeNameWindowPixmap;
+ ProcCompositeVector[X_CompositeGetOverlayWindow] =
+ PanoramiXCompositeGetOverlayWindow;
+ ProcCompositeVector[X_CompositeReleaseOverlayWindow] =
+ PanoramiXCompositeReleaseOverlayWindow;
+}
+
+void
+PanoramiXCompositeReset (void)
+{
+ int i;
+
+ for (i = 0; i < CompositeNumberRequests; i++)
+ ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
+}
+
+#endif
diff --git a/xorg-server/composite/compint.h b/xorg-server/composite/compint.h index 8213c1605..f78884985 100644 --- a/xorg-server/composite/compint.h +++ b/xorg-server/composite/compint.h @@ -326,4 +326,7 @@ int compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
int bw, WindowPtr pSib);
+void PanoramiXCompositeInit (void);
+void PanoramiXCompositeReset (void);
+
#endif /* _COMPINT_H_ */
diff --git a/xorg-server/composite/compoverlay.c b/xorg-server/composite/compoverlay.c index 6a5b01dfb..2d81aeb95 100644 --- a/xorg-server/composite/compoverlay.c +++ b/xorg-server/composite/compoverlay.c @@ -48,6 +48,10 @@ #include "compint.h"
#include "xace.h"
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
/*
* Delete the given overlay client list element from its screen list.
*/
@@ -128,10 +132,19 @@ compCreateOverlayWindow (ScreenPtr pScreen) WindowPtr pWin;
XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
int result;
+ int w = pScreen->width;
+ int h = pScreen->height;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
+ }
+#endif
pWin = cs->pOverlayWin =
- CreateWindow (cs->overlayWid, pRoot,
- 0, 0, pScreen->width, pScreen->height, 0,
+ CreateWindow (cs->overlayWid, pRoot, 0, 0, w, h, 0,
InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
pRoot->drawable.depth,
serverClient, pScreen->rootVisual, &result);
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c index b0afc3f9a..539c1aa23 100644 --- a/xorg-server/composite/compwindow.c +++ b/xorg-server/composite/compwindow.c @@ -47,6 +47,10 @@ #include "compint.h"
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
#ifdef COMPOSITE_DEBUG
static int
compCheckWindow (WindowPtr pWin, pointer data)
@@ -172,16 +176,26 @@ updateOverlayWindow(ScreenPtr pScreen) CompScreenPtr cs;
WindowPtr pWin; /* overlay window */
XID vlist[2];
+ int w = pScreen->width;
+ int h = pScreen->height;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
+ }
+#endif
cs = GetCompScreen(pScreen);
if ((pWin = cs->pOverlayWin) != NULL) {
- if ((pWin->drawable.width == pScreen->width) &&
- (pWin->drawable.height == pScreen->height))
+ if ((pWin->drawable.width == w) &&
+ (pWin->drawable.height == h))
return Success;
/* Let's resize the overlay window. */
- vlist[0] = pScreen->width;
- vlist[1] = pScreen->height;
+ vlist[0] = w;
+ vlist[1] = h;
return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
}
|