Commit be824bc8 authored by Mihai Moldovan's avatar Mihai Moldovan

misc nx-X11/{programs/Xserver/composite,include/extensions}: update to Composite…

misc nx-X11/{programs/Xserver/composite,include/extensions}: update to Composite 0.4 - with changes where neccessary and rough edges.
parent f7cff021
......@@ -29,7 +29,7 @@
#define COMPOSITE_NAME "Composite"
#define COMPOSITE_MAJOR 0
#define COMPOSITE_MINOR 2
#define COMPOSITE_MINOR 4
#define CompositeRedirectAutomatic 0
#define CompositeRedirectManual 1
......@@ -41,7 +41,11 @@
#define X_CompositeUnredirectSubwindows 4
#define X_CompositeCreateRegionFromBorderClip 5
#define X_CompositeNameWindowPixmap 6
#define X_CompositeGetOverlayWindow 7
#define X_CompositeReleaseOverlayWindow 8
#define CompositeNumberRequests (X_CompositeNameWindowPixmap + 1)
#define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1)
#define CompositeNumberEvents 0
#endif /* _COMPOSITE_H_ */
......@@ -30,6 +30,7 @@
#define Window CARD32
#define Region CARD32
#define Pixmap CARD32
/*
* requests and replies
......@@ -129,7 +130,43 @@ typedef struct {
#define sz_xCompositeNameWindowPixmapReq 12
/* Version 0.3 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
} xCompositeGetOverlayWindowReq;
#define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq)
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
Window overlayWin B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xCompositeGetOverlayWindowReply;
#define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply)
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
} xCompositeReleaseOverlayWindowReq;
#define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq)
#undef Window
#undef Region
#undef Pixmap
#endif /* _COMPOSITEPROTO_H_ */
......@@ -51,6 +51,7 @@
#include "damageextint.h"
#include "xfixes.h"
#include <nx-X11/extensions/compositeproto.h>
#include "compositeext.h"
#include <assert.h>
/*
......@@ -58,6 +59,7 @@
#define COMPOSITE_DEBUG
*/
#define COMPOSITE_DEBUG
typedef struct _CompClientWindow {
struct _CompClientWindow *next;
......@@ -89,11 +91,19 @@ typedef struct _CompSubwindows {
#define COMP_INCLUDE_RGB24_VISUAL 0
#endif
#if COMP_INCLUDE_RGB24_VISUAL
#define NUM_COMP_ALTERNATE_VISUALS 2
#else
#define NUM_COMP_ALTERNATE_VISUALS 1
#endif
typedef struct _CompOverlayClientRec *CompOverlayClientPtr;
typedef struct _CompOverlayClientRec {
CompOverlayClientPtr pNext;
ClientPtr pClient;
ScreenPtr pScreen;
XID resource;
} CompOverlayClientRec;
typedef struct _CompImplicitRedirectException {
XID parentVisual;
XID winVisual;
} CompImplicitRedirectException;
typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
......@@ -102,13 +112,21 @@ typedef struct _CompScreen {
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
PaintWindowProcPtr PaintWindowBackground;
ClipNotifyProcPtr ClipNotify;
/*
* Called from ConfigureWindow, these
* three track changes to the offscreen storage
* geometry
*/
/*
* Unsupported by our old Xserver infrastructure, replaced with direct calls to
* compReallocPixmap().
*/
/*
ConfigNotifyProcPtr ConfigNotify;
*/
MoveWindowProcPtr MoveWindow;
ResizeWindowProcPtr ResizeWindow;
ChangeBorderWidthProcPtr ChangeBorderWidth;
......@@ -122,30 +140,79 @@ typedef struct _CompScreen {
*/
InstallColormapProcPtr InstallColormap;
/*
* Fake backing store via automatic redirection
*/
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
Bool damaged;
XID alternateVisuals[NUM_COMP_ALTERNATE_VISUALS];
Bool damaged;
int numAlternateVisuals;
VisualID *alternateVisuals;
int numImplicitRedirectExceptions;
CompImplicitRedirectException *implicitRedirectExceptions;
WindowPtr pOverlayWin;
Window overlayWid;
CompOverlayClientPtr pOverlayClients;
GetImageProcPtr GetImage;
GetSpansProcPtr GetSpans;
SourceValidateProcPtr SourceValidate;
} CompScreenRec, *CompScreenPtr;
extern int CompScreenPrivateIndex;
extern int CompWindowPrivateIndex;
extern int CompSubwindowsPrivateIndex;
#ifndef NXAGENT_SERVER
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr))
#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr))
#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr))
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
#define GetCompScreen(s) ((CompScreenPtr) \
dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
#define GetCompWindow(w) ((CompWindowPtr) \
dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
#else /* !defined(NXAGENT_SERVER) */
extern int CompScreenPrivIndex;
extern int CompWindowPrivIndex;
extern int CompSubwindowsPrivIndex;
#define GetCompScreen(s) ((CompScreenPtr) (s)->devPrivates[CompScreenPrivIndex].ptr)
#define GetCompWindow(w) ((CompWindowPtr) (w)->devPrivates[CompWindowPrivIndex].ptr)
#define GetCompSubwindows(w) ((CompSubwindowsPtr) (w)->devPrivates[CompSubwindowsPrivIndex].ptr)
#endif /* !defined(NXAGENT_SERVER) */
extern RESTYPE CompositeClientWindowType;
extern RESTYPE CompositeClientSubwindowsType;
extern RESTYPE CompositeClientOverlayType;
/* Shim for less ifdefs within the actual code. */
#ifndef NXAGENT_SERVER
#define FAKE_DIX_SET_PRIVATE_IMPL(obj, privateKey, ptr_val) do { dixSetPrivate(&(obj)->devPrivates, privateKey, ptr_val); } while (0)
#define FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pScreen, CompScreenPrivateKey, ptr_val)
#define FAKE_DIX_SET_WINDOW_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompWindowPrivateKey, ptr_val)
#define FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompSubwindowsPrivateKey, ptr_val)
#else /* !defined(NXAGENT_SERVER) */
#define FAKE_DIX_SET_PRIVATE_IMPL(obj, privIndex, ptr_val) do { (obj)->devPrivates[privIndex].ptr = (void *) (ptr_val); } while (0)
#define FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pScreen, CompScreenPrivIndex, ptr_val)
#define FAKE_DIX_SET_WINDOW_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompWindowPrivIndex, ptr_val)
#define FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompSubwindowsPrivIndex, ptr_val)
#endif /* !defined(NXAGENT_SERVER) */
/*
* compalloc.c
*/
void
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure);
Bool
compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
......@@ -174,25 +241,40 @@ Bool
compAllocPixmap (WindowPtr pWin);
void
compFreePixmap (WindowPtr pWin);
compSetParentPixmap(WindowPtr pWin);
void
compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
Bool
compReallocPixmap (WindowPtr pWin, int x, int y,
unsigned int w, unsigned int h, int bw);
/*
* compext.c
* compinit.c
*/
void
CompositeExtensionInit (void);
Bool
compScreenInit(ScreenPtr pScreen);
/*
* compinit.c
* compoverlay.c
*/
void
compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
CompOverlayClientPtr
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
CompOverlayClientPtr
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
Bool
compScreenInit (ScreenPtr pScreen);
compCreateOverlayWindow(ScreenPtr pScreen);
void
compDestroyOverlayWindow(ScreenPtr pScreen);
/*
* compwindow.c
......@@ -205,6 +287,9 @@ compCheckTree (ScreenPtr pScreen);
#define compCheckTree(s)
#endif
PictFormatPtr
compWindowFormat (WindowPtr pWin);
void
compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
......@@ -220,8 +305,6 @@ compRealizeWindow (WindowPtr pWin);
Bool
compUnrealizeWindow (WindowPtr pWin);
void
compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what);
void
compClipNotify (WindowPtr pWin, int dx, int dy);
......@@ -255,6 +338,25 @@ void
compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
compWindowUpdate (WindowPtr pWin);
compPaintChildrenToWindow(ScreenPtr pScreen, WindowPtr pWin);
WindowPtr
CompositeRealChildHead(WindowPtr pWin);
int
DeleteWindowNoInputDevices(void *value, XID wid);
/*
* Unsupported by our old Xserver infrastructure, replaced with direct calls to
* compReallocPixmap().
*/
/*
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_ */
/*
* Copyright © 2009 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _COMPOSITEEXT_H_
#define _COMPOSITEEXT_H_
#include "misc.h"
#include "scrnintstr.h"
extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
VisualID * vids,
int nVisuals);
extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
VisualID parentVisual,
VisualID winVisual);
extern _X_EXPORT RESTYPE CompositeClientWindowType;
#endif /* _COMPOSITEEXT_H_ */
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "compint.h"
#ifndef NXAGENT_SERVER
#include "xace.h"
#endif
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#endif
/*
* Delete the given overlay client list element from its screen list.
*/
void
compFreeOverlayClient(CompOverlayClientPtr pOcToDel)
{
ScreenPtr pScreen = pOcToDel->pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr *pPrev, pOc;
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
if (pOc == pOcToDel) {
*pPrev = pOc->pNext;
free(pOc);
break;
}
}
/* Destroy overlay window when there are no more clients using it */
if (cs->pOverlayClients == NULL)
compDestroyOverlayWindow(pScreen);
}
/*
* Return the client's first overlay client rec from the given screen
*/
CompOverlayClientPtr
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
if (pOc->pClient == pClient)
return pOc;
return NULL;
}
/*
* Create an overlay client object for the given client
*/
CompOverlayClientPtr
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
if (pOc == NULL)
return NULL;
pOc->pClient = pClient;
pOc->pScreen = pScreen;
pOc->resource = FakeClientID(pClient->index);
pOc->pNext = cs->pOverlayClients;
cs->pOverlayClients = pOc;
/*
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
if (!AddResource(pOc->resource, CompositeClientOverlayType, (void *) pOc))
return NULL;
return pOc;
}
/*
* Create the overlay window and map it
*/
Bool
compCreateOverlayWindow(ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
WindowPtr pRoot = WindowTable[pScreen->myNum];
WindowPtr pWin;
XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
int result;
int w = pScreen->width;
int h = pScreen->height;
int x = 0, y = 0;
/* Unsupported by current architecture, disabled. */
#if 0
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
x = -pScreen->x;
y = -pScreen->y;
w = PanoramiXPixWidth;
h = PanoramiXPixHeight;
}
#endif
#endif
pWin = cs->pOverlayWin =
CreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0,
InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
pRoot->drawable.depth,
serverClient, pScreen->rootVisual, &result);
if (pWin == NULL)
return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
return FALSE;
MapWindow(pWin, serverClient);
return TRUE;
}
/*
* Destroy the overlay window
*/
void
compDestroyOverlayWindow(ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
cs->pOverlayWin = NullWindow;
FreeResource(cs->overlayWid, RT_NONE);
}
......@@ -33,7 +33,7 @@
#define COMPOSITE_NAME "Composite"
#define COMPOSITE_MAJOR 0
#define COMPOSITE_MINOR 2
#define COMPOSITE_MINOR 4
#define CompositeRedirectAutomatic 0
#define CompositeRedirectManual 1
......@@ -45,7 +45,11 @@
#define X_CompositeUnredirectSubwindows 4
#define X_CompositeCreateRegionFromBorderClip 5
#define X_CompositeNameWindowPixmap 6
#define X_CompositeGetOverlayWindow 7
#define X_CompositeReleaseOverlayWindow 8
#define CompositeNumberRequests (X_CompositeNameWindowPixmap + 1)
#define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1)
#define CompositeNumberEvents 0
#endif /* _COMPOSITE_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment