diff options
author | marha <marha@users.sourceforge.net> | 2010-06-11 12:14:52 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-06-11 12:14:52 +0000 |
commit | 4c61bf84b11e26e6f22648668c95ea760a379163 (patch) | |
tree | 0ac762ab2815eae283dded7447ad7cb5a54b926a /xorg-server/hw/xnest | |
parent | e1dabd2ce8be0d70c6c15353b58de256129dfd1f (diff) | |
download | vcxsrv-4c61bf84b11e26e6f22648668c95ea760a379163.tar.gz vcxsrv-4c61bf84b11e26e6f22648668c95ea760a379163.tar.bz2 vcxsrv-4c61bf84b11e26e6f22648668c95ea760a379163.zip |
xserver git update 11/6/2010
Diffstat (limited to 'xorg-server/hw/xnest')
-rw-r--r-- | xorg-server/hw/xnest/Color.c | 15 | ||||
-rw-r--r-- | xorg-server/hw/xnest/Drawable.h | 52 | ||||
-rw-r--r-- | xorg-server/hw/xnest/Events.c | 454 | ||||
-rw-r--r-- | xorg-server/hw/xnest/GC.c | 15 | ||||
-rw-r--r-- | xorg-server/hw/xnest/GCOps.c | 654 | ||||
-rw-r--r-- | xorg-server/hw/xnest/Pixmap.c | 28 | ||||
-rw-r--r-- | xorg-server/hw/xnest/Screen.c | 15 | ||||
-rw-r--r-- | xorg-server/hw/xnest/Window.c | 1045 | ||||
-rw-r--r-- | xorg-server/hw/xnest/XNCursor.h | 117 | ||||
-rw-r--r-- | xorg-server/hw/xnest/XNGC.h | 85 | ||||
-rw-r--r-- | xorg-server/hw/xnest/XNPixmap.h | 73 | ||||
-rw-r--r-- | xorg-server/hw/xnest/XNWindow.h | 145 |
12 files changed, 1347 insertions, 1351 deletions
diff --git a/xorg-server/hw/xnest/Color.c b/xorg-server/hw/xnest/Color.c index 985b5ad95..bb215fc45 100644 --- a/xorg-server/hw/xnest/Color.c +++ b/xorg-server/hw/xnest/Color.c @@ -34,8 +34,8 @@ is" without express or implied warranty. #include "XNWindow.h"
#include "Args.h"
-static int cmapScrPrivateKeyIndex;
-static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex;
+static DevPrivateKeyRec cmapScrPrivateKeyRec;
+#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
@@ -214,8 +214,7 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) free(icws.cmapIDs);
if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
- if (xnestOldInstalledColormapWindows)
- free(xnestOldInstalledColormapWindows);
+ free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64
{
@@ -264,14 +263,13 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) #endif /* DUMB_WINDOW_MANAGERS */
}
else
- if (icws.windows) free(icws.windows);
+ free(icws.windows);
}
void
xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
{
- if (xnestOldInstalledColormapWindows)
- free(xnestOldInstalledColormapWindows);
+ free(xnestOldInstalledColormapWindows);
#ifdef _XSERVER64
{
@@ -469,6 +467,9 @@ xnestCreateDefaultColormap(ScreenPtr pScreen) unsigned short zero = 0, ones = 0xFFFF;
Pixel wp, bp;
+ if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
for (pVisual = pScreen->visuals;
pVisual->vid != pScreen->rootVisual;
pVisual++);
diff --git a/xorg-server/hw/xnest/Drawable.h b/xorg-server/hw/xnest/Drawable.h index d94916ecd..7f742cb1f 100644 --- a/xorg-server/hw/xnest/Drawable.h +++ b/xorg-server/hw/xnest/Drawable.h @@ -1,26 +1,26 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTDRAWABLE_H -#define XNESTDRAWABLE_H - -#include "XNWindow.h" -#include "XNPixmap.h" - -#define xnestDrawable(pDrawable) \ - ((pDrawable)->type == DRAWABLE_WINDOW ? \ - xnestWindow((WindowPtr)pDrawable) : \ - xnestPixmap((PixmapPtr)pDrawable)) - -#endif /* XNESTDRAWABLE_H */ +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTDRAWABLE_H
+#define XNESTDRAWABLE_H
+
+#include "XNWindow.h"
+#include "XNPixmap.h"
+
+#define xnestDrawable(pDrawable) \
+ (WindowDrawable((pDrawable)->type) ? \
+ xnestWindow((WindowPtr)pDrawable) : \
+ xnestPixmap((PixmapPtr)pDrawable))
+
+#endif /* XNESTDRAWABLE_H */
diff --git a/xorg-server/hw/xnest/Events.c b/xorg-server/hw/xnest/Events.c index 277718ba3..88970bbe0 100644 --- a/xorg-server/hw/xnest/Events.c +++ b/xorg-server/hw/xnest/Events.c @@ -1,227 +1,227 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifdef HAVE_XNEST_CONFIG_H -#include <xnest-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "screenint.h" -#include "input.h" -#include "misc.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "servermd.h" -#include "inputstr.h" - -#include "mi.h" - -#include "Xnest.h" - -#include "Args.h" -#include "Color.h" -#include "Display.h" -#include "Screen.h" -#include "XNWindow.h" -#include "Events.h" -#include "Keyboard.h" -#include "Pointer.h" -#include "mipointer.h" - -CARD32 lastEventTime = 0; - -extern EventList *xnestEvents; - -void -ProcessInputEvents(void) -{ - mieqProcessInputEvents(); -} - -int -TimeSinceLastInputEvent(void) -{ - if (lastEventTime == 0) - lastEventTime = GetTimeInMillis(); - return GetTimeInMillis() - lastEventTime; -} - -void -SetTimeSinceLastInputEvent(void) -{ - lastEventTime = GetTimeInMillis(); -} - -static Bool -xnestExposurePredicate(Display *display, XEvent *event, char *args) -{ - return (event->type == Expose || event->type == ProcessedExpose); -} - -static Bool -xnestNotExposurePredicate(Display *display, XEvent *event, char *args) -{ - return !xnestExposurePredicate(display, event, args); -} - -void -xnestCollectExposures(void) -{ - XEvent X; - WindowPtr pWin; - RegionRec Rgn; - BoxRec Box; - - while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) { - pWin = xnestWindowPtr(X.xexpose.window); - - if (pWin && X.xexpose.width && X.xexpose.height) { - Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x; - Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y; - Box.x2 = Box.x1 + X.xexpose.width; - Box.y2 = Box.y1 + X.xexpose.height; - - REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1); - - miSendExposures(pWin, &Rgn, Box.x2, Box.y2); - } - } -} - -void -xnestQueueKeyEvent(int type, unsigned int keycode) -{ - int i, n; - - GetEventList(&xnestEvents); - lastEventTime = GetTimeInMillis(); - n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode); - for (i = 0; i < n; i++) - mieqEnqueue(xnestKeyboardDevice, (InternalEvent*)(xnestEvents + i)->event); -} - -void -xnestCollectEvents(void) -{ - XEvent X; - int i, n, valuators[2]; - ScreenPtr pScreen; - GetEventList(&xnestEvents); - - while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) { - switch (X.type) { - case KeyPress: - xnestUpdateModifierState(X.xkey.state); - xnestQueueKeyEvent(KeyPress, X.xkey.keycode); - break; - - case KeyRelease: - xnestUpdateModifierState(X.xkey.state); - xnestQueueKeyEvent(KeyRelease, X.xkey.keycode); - break; - - case ButtonPress: - xnestUpdateModifierState(X.xkey.state); - lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress, - X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); - break; - - case ButtonRelease: - xnestUpdateModifierState(X.xkey.state); - lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease, - X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); - break; - - case MotionNotify: - valuators[0] = X.xmotion.x; - valuators[1] = X.xmotion.y; - lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, - 0, POINTER_ABSOLUTE, 0, 2, valuators); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); - break; - - case FocusIn: - if (X.xfocus.detail != NotifyInferior) { - pScreen = xnestScreen(X.xfocus.window); - if (pScreen) - xnestDirectInstallColormaps(pScreen); - } - break; - - case FocusOut: - if (X.xfocus.detail != NotifyInferior) { - pScreen = xnestScreen(X.xfocus.window); - if (pScreen) - xnestDirectUninstallColormaps(pScreen); - } - break; - - case KeymapNotify: - break; - - case EnterNotify: - if (X.xcrossing.detail != NotifyInferior) { - pScreen = xnestScreen(X.xcrossing.window); - if (pScreen) { - NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y); - valuators[0] = X.xcrossing.x; - valuators[1] = X.xcrossing.y; - lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, - 0, POINTER_ABSOLUTE, 0, 2, valuators); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); - xnestDirectInstallColormaps(pScreen); - } - } - break; - - case LeaveNotify: - if (X.xcrossing.detail != NotifyInferior) { - pScreen = xnestScreen(X.xcrossing.window); - if (pScreen) { - xnestDirectUninstallColormaps(pScreen); - } - } - break; - - case DestroyNotify: - if (xnestParentWindow != (Window) 0 && - X.xdestroywindow.window == xnestParentWindow) - exit (0); - break; - - case CirculateNotify: - case ConfigureNotify: - case GravityNotify: - case MapNotify: - case ReparentNotify: - case UnmapNotify: - break; - - default: - ErrorF("xnest warning: unhandled event\n"); - break; - } - } -} +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "inputstr.h"
+
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Args.h"
+#include "Color.h"
+#include "Display.h"
+#include "Screen.h"
+#include "XNWindow.h"
+#include "Events.h"
+#include "Keyboard.h"
+#include "Pointer.h"
+#include "mipointer.h"
+
+CARD32 lastEventTime = 0;
+
+extern EventList *xnestEvents;
+
+void
+ProcessInputEvents(void)
+{
+ mieqProcessInputEvents();
+}
+
+int
+TimeSinceLastInputEvent(void)
+{
+ if (lastEventTime == 0)
+ lastEventTime = GetTimeInMillis();
+ return GetTimeInMillis() - lastEventTime;
+}
+
+void
+SetTimeSinceLastInputEvent(void)
+{
+ lastEventTime = GetTimeInMillis();
+}
+
+static Bool
+xnestExposurePredicate(Display *display, XEvent *event, char *args)
+{
+ return event->type == Expose || event->type == ProcessedExpose;
+}
+
+static Bool
+xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
+{
+ return !xnestExposurePredicate(display, event, args);
+}
+
+void
+xnestCollectExposures(void)
+{
+ XEvent X;
+ WindowPtr pWin;
+ RegionRec Rgn;
+ BoxRec Box;
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
+ pWin = xnestWindowPtr(X.xexpose.window);
+
+ if (pWin && X.xexpose.width && X.xexpose.height) {
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
+ Box.x2 = Box.x1 + X.xexpose.width;
+ Box.y2 = Box.y1 + X.xexpose.height;
+
+ RegionInit(&Rgn, &Box, 1);
+
+ miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
+ }
+ }
+}
+
+void
+xnestQueueKeyEvent(int type, unsigned int keycode)
+{
+ int i, n;
+
+ GetEventList(&xnestEvents);
+ lastEventTime = GetTimeInMillis();
+ n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestKeyboardDevice, (InternalEvent*)(xnestEvents + i)->event);
+}
+
+void
+xnestCollectEvents(void)
+{
+ XEvent X;
+ int i, n, valuators[2];
+ ScreenPtr pScreen;
+ GetEventList(&xnestEvents);
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
+ switch (X.type) {
+ case KeyPress:
+ xnestUpdateModifierState(X.xkey.state);
+ xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
+ break;
+
+ case KeyRelease:
+ xnestUpdateModifierState(X.xkey.state);
+ xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
+ break;
+
+ case ButtonPress:
+ xnestUpdateModifierState(X.xkey.state);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+ break;
+
+ case ButtonRelease:
+ xnestUpdateModifierState(X.xkey.state);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+ break;
+
+ case MotionNotify:
+ valuators[0] = X.xmotion.x;
+ valuators[1] = X.xmotion.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+ break;
+
+ case FocusIn:
+ if (X.xfocus.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xfocus.window);
+ if (pScreen)
+ xnestDirectInstallColormaps(pScreen);
+ }
+ break;
+
+ case FocusOut:
+ if (X.xfocus.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xfocus.window);
+ if (pScreen)
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ break;
+
+ case KeymapNotify:
+ break;
+
+ case EnterNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xcrossing.window);
+ if (pScreen) {
+ NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y);
+ valuators[0] = X.xcrossing.x;
+ valuators[1] = X.xcrossing.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
+ xnestDirectInstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case LeaveNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xcrossing.window);
+ if (pScreen) {
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case DestroyNotify:
+ if (xnestParentWindow != (Window) 0 &&
+ X.xdestroywindow.window == xnestParentWindow)
+ exit (0);
+ break;
+
+ case CirculateNotify:
+ case ConfigureNotify:
+ case GravityNotify:
+ case MapNotify:
+ case ReparentNotify:
+ case UnmapNotify:
+ break;
+
+ default:
+ ErrorF("xnest warning: unhandled event\n");
+ break;
+ }
+ }
+}
diff --git a/xorg-server/hw/xnest/GC.c b/xorg-server/hw/xnest/GC.c index 9df015728..3c0074cc9 100644 --- a/xorg-server/hw/xnest/GC.c +++ b/xorg-server/hw/xnest/GC.c @@ -35,8 +35,7 @@ is" without express or implied warranty. #include "XNFont.h"
#include "Color.h"
-static int xnestGCPrivateKeyIndex;
-DevPrivateKey xnestGCPrivateKey = &xnestGCPrivateKeyIndex;
+DevPrivateKeyRec xnestGCPrivateKeyRec;
static GCFuncs xnestFuncs = {
xnestValidateGC,
@@ -210,10 +209,10 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects) break;
case CT_REGION:
- nRects = REGION_NUM_RECTS((RegionPtr)pValue);
+ nRects = RegionNumRects((RegionPtr)pValue);
size = nRects * sizeof(*pRects);
pRects = (XRectangle *) malloc(size);
- pBox = REGION_RECTS((RegionPtr)pValue);
+ pBox = RegionRects((RegionPtr)pValue);
for (i = nRects; i-- > 0; ) {
pRects[i].x = pBox[i].x1;
pRects[i].y = pBox[i].y1;
@@ -277,7 +276,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects) * other parts of server can only deal with CT_NONE,
* CT_PIXMAP and CT_REGION client clips.
*/
- pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nRects,
+ pGC->clientClip = (pointer) RegionFromRects(nRects,
(xRectangle *)pValue, type);
free(pValue);
pValue = pGC->clientClip;
@@ -313,7 +312,7 @@ xnestDestroyClipHelper(GCPtr pGC) break;
case CT_REGION:
- REGION_DESTROY(pGC->pScreen, pGC->clientClip);
+ RegionDestroy(pGC->clientClip);
break;
}
}
@@ -331,8 +330,8 @@ xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc) break;
case CT_REGION:
- pRgn = REGION_CREATE(pGCDst->pScreen, NULL, 1);
- REGION_COPY(pGCDst->pScreen, pRgn, pGCSrc->clientClip);
+ pRgn = RegionCreate(NULL, 1);
+ RegionCopy(pRgn, pGCSrc->clientClip);
xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
break;
}
diff --git a/xorg-server/hw/xnest/GCOps.c b/xorg-server/hw/xnest/GCOps.c index ad9668ec1..d19ec6710 100644 --- a/xorg-server/hw/xnest/GCOps.c +++ b/xorg-server/hw/xnest/GCOps.c @@ -1,327 +1,327 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifdef HAVE_XNEST_CONFIG_H -#include <xnest-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "regionstr.h" -#include <X11/fonts/fontstruct.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "region.h" -#include "servermd.h" - -#include "Xnest.h" - -#include "Display.h" -#include "Screen.h" -#include "XNGC.h" -#include "XNFont.h" -#include "GCOps.h" -#include "Drawable.h" -#include "Visual.h" - -void -xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints, - int *pWidths, int fSorted) -{ - ErrorF("xnest warning: function xnestFillSpans not implemented\n"); -} - -void -xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc, - xPoint *pPoints, int *pWidths, int nSpans, int fSorted) -{ - ErrorF("xnest warning: function xnestSetSpans not implemented\n"); -} - -void -xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints, - int *pWidths, int nSpans, char *pBuffer) -{ - ErrorF("xnest warning: function xnestGetSpans not implemented\n"); -} - -void -xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight, - ScreenPtr pScreen) -{ - unsigned int width, height; - - width = *pWidth; - height = *pHeight; - - XQueryBestSize(xnestDisplay, class, - xnestDefaultWindows[pScreen->myNum], - width, height, &width, &height); - - *pWidth = width; - *pHeight = height; -} - -void -xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, char *pImage) -{ - XImage *ximage; - - ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pDrawable->pScreen), - depth, format, leftPad, (char *)pImage, - w, h, BitmapPad(xnestDisplay), - (format == ZPixmap) ? - PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad)); - - if (ximage) { - XPutImage(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - ximage, 0, 0, x, y, w, h); - XFree(ximage); - } -} - -void -xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, - unsigned int format, unsigned long planeMask, - char *pImage) -{ - XImage *ximage; - int length; - - ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable), - x, y, w, h, planeMask, format); - - if (ximage) { - length = ximage->bytes_per_line * ximage->height; - - memmove(pImage, ximage->data, length); - - XDestroyImage(ximage); - } -} - -static Bool -xnestBitBlitPredicate(Display *display, XEvent *event, char *args) -{ - return (event->type == GraphicsExpose || event->type == NoExpose); -} - -static RegionPtr -xnestBitBlitHelper(GCPtr pGC) -{ - if (!pGC->graphicsExposures) - return NullRegion; - else { - XEvent event; - RegionPtr pReg, pTmpReg; - BoxRec Box; - Bool pending, overlap; - - pReg = REGION_CREATE(pGC->pScreen, NULL, 1); - pTmpReg = REGION_CREATE(pGC->pScreen, NULL, 1); - if(!pReg || !pTmpReg) return NullRegion; - - pending = True; - while (pending) { - XIfEvent(xnestDisplay, &event, xnestBitBlitPredicate, NULL); - - switch (event.type) { - case NoExpose: - pending = False; - break; - - case GraphicsExpose: - Box.x1 = event.xgraphicsexpose.x; - Box.y1 = event.xgraphicsexpose.y; - Box.x2 = event.xgraphicsexpose.x + event.xgraphicsexpose.width; - Box.y2 = event.xgraphicsexpose.y + event.xgraphicsexpose.height; - REGION_RESET(pGC->pScreen, pTmpReg, &Box); - REGION_APPEND(pGC->pScreen, pReg, pTmpReg); - pending = event.xgraphicsexpose.count; - break; - } - } - - REGION_DESTROY(pGC->pScreen, pTmpReg); - REGION_VALIDATE(pGC->pScreen, pReg, &overlap); - return(pReg); - } -} - -RegionPtr -xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GCPtr pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty) -{ - XCopyArea(xnestDisplay, - xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable), - xnestGC(pGC), srcx, srcy, width, height, dstx, dsty); - - return xnestBitBlitHelper(pGC); -} - -RegionPtr -xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, - GCPtr pGC, int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long plane) -{ - XCopyPlane(xnestDisplay, - xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable), - xnestGC(pGC), srcx, srcy, width, height, dstx, dsty, plane); - - return xnestBitBlitHelper(pGC); -} - -void -xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, - DDXPointPtr pPoints) -{ - XDrawPoints(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XPoint *)pPoints, nPoints, mode); -} - -void -xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, - DDXPointPtr pPoints) -{ - XDrawLines(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XPoint *)pPoints, nPoints, mode); -} - -void -xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments, - xSegment *pSegments) -{ - XDrawSegments(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XSegment *)pSegments, nSegments); -} - -void -xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, - xRectangle *pRectangles) -{ - XDrawRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XRectangle *)pRectangles, nRectangles); -} - -void -xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) -{ - XDrawArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XArc *)pArcs, nArcs); -} - -void -xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, - int nPoints, DDXPointPtr pPoints) -{ - XFillPolygon(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XPoint *)pPoints, nPoints, shape, mode); -} - -void -xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, - xRectangle *pRectangles) -{ - XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XRectangle *)pRectangles, nRectangles); -} - -void -xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) -{ - XFillArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - (XArc *)pArcs, nArcs); -} - -int -xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, - char *string) -{ - int width; - - XDrawString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - x, y, string, count); - - width = XTextWidth(xnestFontStruct(pGC->font), string, count); - - return width + x; -} - -int -xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, - unsigned short *string) -{ - int width; - - XDrawString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - x, y, (XChar2b *)string, count); - - width = XTextWidth16(xnestFontStruct(pGC->font), (XChar2b *)string, count); - - return width + x; -} - -void -xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, - char *string) -{ - XDrawImageString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - x, y, string, count); -} - -void -xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, - unsigned short *string) -{ - XDrawImageString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC), - x, y, (XChar2b *)string, count); -} - -void -xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nGlyphs, CharInfoPtr *pCharInfo, - pointer pGlyphBase) -{ - ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n"); -} - -void -xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nGlyphs, CharInfoPtr *pCharInfo, - pointer pGlyphBase) -{ - ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n"); -} - -void -xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst, - int width, int height, int x, int y) -{ - /* only works for solid bitmaps */ - if (pGC->fillStyle == FillSolid) - { - XSetStipple (xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap)); - XSetTSOrigin (xnestDisplay, xnestGC(pGC), x, y); - XSetFillStyle (xnestDisplay, xnestGC(pGC), FillStippled); - XFillRectangle (xnestDisplay, xnestDrawable(pDst), - xnestGC(pGC), x, y, width, height); - XSetFillStyle (xnestDisplay, xnestGC(pGC), FillSolid); - } - else - ErrorF("xnest warning: function xnestPushPixels not implemented\n"); -} +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "region.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "XNFont.h"
+#include "GCOps.h"
+#include "Drawable.h"
+#include "Visual.h"
+
+void
+xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints,
+ int *pWidths, int fSorted)
+{
+ ErrorF("xnest warning: function xnestFillSpans not implemented\n");
+}
+
+void
+xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ xPoint *pPoints, int *pWidths, int nSpans, int fSorted)
+{
+ ErrorF("xnest warning: function xnestSetSpans not implemented\n");
+}
+
+void
+xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
+ int *pWidths, int nSpans, char *pBuffer)
+{
+ ErrorF("xnest warning: function xnestGetSpans not implemented\n");
+}
+
+void
+xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
+ ScreenPtr pScreen)
+{
+ unsigned int width, height;
+
+ width = *pWidth;
+ height = *pHeight;
+
+ XQueryBestSize(xnestDisplay, class,
+ xnestDefaultWindows[pScreen->myNum],
+ width, height, &width, &height);
+
+ *pWidth = width;
+ *pHeight = height;
+}
+
+void
+xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ XImage *ximage;
+
+ ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pDrawable->pScreen),
+ depth, format, leftPad, (char *)pImage,
+ w, h, BitmapPad(xnestDisplay),
+ (format == ZPixmap) ?
+ PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
+
+ if (ximage) {
+ XPutImage(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ ximage, 0, 0, x, y, w, h);
+ XFree(ximage);
+ }
+}
+
+void
+xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *pImage)
+{
+ XImage *ximage;
+ int length;
+
+ ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
+ x, y, w, h, planeMask, format);
+
+ if (ximage) {
+ length = ximage->bytes_per_line * ximage->height;
+
+ memmove(pImage, ximage->data, length);
+
+ XDestroyImage(ximage);
+ }
+}
+
+static Bool
+xnestBitBlitPredicate(Display *display, XEvent *event, char *args)
+{
+ return event->type == GraphicsExpose || event->type == NoExpose;
+}
+
+static RegionPtr
+xnestBitBlitHelper(GCPtr pGC)
+{
+ if (!pGC->graphicsExposures)
+ return NullRegion;
+ else {
+ XEvent event;
+ RegionPtr pReg, pTmpReg;
+ BoxRec Box;
+ Bool pending, overlap;
+
+ pReg = RegionCreate(NULL, 1);
+ pTmpReg = RegionCreate(NULL, 1);
+ if(!pReg || !pTmpReg) return NullRegion;
+
+ pending = True;
+ while (pending) {
+ XIfEvent(xnestDisplay, &event, xnestBitBlitPredicate, NULL);
+
+ switch (event.type) {
+ case NoExpose:
+ pending = False;
+ break;
+
+ case GraphicsExpose:
+ Box.x1 = event.xgraphicsexpose.x;
+ Box.y1 = event.xgraphicsexpose.y;
+ Box.x2 = event.xgraphicsexpose.x + event.xgraphicsexpose.width;
+ Box.y2 = event.xgraphicsexpose.y + event.xgraphicsexpose.height;
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
+ pending = event.xgraphicsexpose.count;
+ break;
+ }
+ }
+
+ RegionDestroy(pTmpReg);
+ RegionValidate(pReg, &overlap);
+ return pReg;
+ }
+}
+
+RegionPtr
+xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
+{
+ XCopyArea(xnestDisplay,
+ xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
+ xnestGC(pGC), srcx, srcy, width, height, dstx, dsty);
+
+ return xnestBitBlitHelper(pGC);
+}
+
+RegionPtr
+xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane)
+{
+ XCopyPlane(xnestDisplay,
+ xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
+ xnestGC(pGC), srcx, srcy, width, height, dstx, dsty, plane);
+
+ return xnestBitBlitHelper(pGC);
+}
+
+void
+xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
+{
+ XDrawPoints(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *)pPoints, nPoints, mode);
+}
+
+void
+xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
+{
+ XDrawLines(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *)pPoints, nPoints, mode);
+}
+
+void
+xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment *pSegments)
+{
+ XDrawSegments(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XSegment *)pSegments, nSegments);
+}
+
+void
+xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
+{
+ XDrawRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XRectangle *)pRectangles, nRectangles);
+}
+
+void
+xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
+{
+ XDrawArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XArc *)pArcs, nArcs);
+}
+
+void
+xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
+ int nPoints, DDXPointPtr pPoints)
+{
+ XFillPolygon(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *)pPoints, nPoints, shape, mode);
+}
+
+void
+xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
+{
+ XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XRectangle *)pRectangles, nRectangles);
+}
+
+void
+xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
+{
+ XFillArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XArc *)pArcs, nArcs);
+}
+
+int
+xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ int width;
+
+ XDrawString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, string, count);
+
+ width = XTextWidth(xnestFontStruct(pGC->font), string, count);
+
+ return width + x;
+}
+
+int
+xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string)
+{
+ int width;
+
+ XDrawString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, (XChar2b *)string, count);
+
+ width = XTextWidth16(xnestFontStruct(pGC->font), (XChar2b *)string, count);
+
+ return width + x;
+}
+
+void
+xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ XDrawImageString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, string, count);
+}
+
+void
+xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string)
+{
+ XDrawImageString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, (XChar2b *)string, count);
+}
+
+void
+xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
+}
+
+void
+xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
+}
+
+void
+xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
+ int width, int height, int x, int y)
+{
+ /* only works for solid bitmaps */
+ if (pGC->fillStyle == FillSolid)
+ {
+ XSetStipple (xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap));
+ XSetTSOrigin (xnestDisplay, xnestGC(pGC), x, y);
+ XSetFillStyle (xnestDisplay, xnestGC(pGC), FillStippled);
+ XFillRectangle (xnestDisplay, xnestDrawable(pDst),
+ xnestGC(pGC), x, y, width, height);
+ XSetFillStyle (xnestDisplay, xnestGC(pGC), FillSolid);
+ }
+ else
+ ErrorF("xnest warning: function xnestPushPixels not implemented\n");
+}
diff --git a/xorg-server/hw/xnest/Pixmap.c b/xorg-server/hw/xnest/Pixmap.c index cd2245b46..da81a1d06 100644 --- a/xorg-server/hw/xnest/Pixmap.c +++ b/xorg-server/hw/xnest/Pixmap.c @@ -33,8 +33,7 @@ is" without express or implied warranty. #include "Screen.h"
#include "XNPixmap.h"
-static int xnestPixmapPrivateKeyIndex;
-DevPrivateKey xnestPixmapPrivateKey = &xnestPixmapPrivateKeyIndex;
+DevPrivateKeyRec xnestPixmapPrivateKeyRec;
PixmapPtr
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
@@ -42,7 +41,7 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, {
PixmapPtr pPixmap;
- pPixmap = AllocatePixmap(pScreen, sizeof(xnestPrivPixmap));
+ pPixmap = AllocatePixmap(pScreen, 0);
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
@@ -59,8 +58,6 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
pPixmap->usage_hint = usage_hint;
- dixSetPrivate(&pPixmap->devPrivates, xnestPixmapPrivateKey,
- (char *)pPixmap + pScreen->totalPixmapSize);
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
@@ -78,8 +75,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap) if(--pPixmap->refcnt)
return TRUE;
XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
- dixFreePrivates(pPixmap->devPrivates);
- free(pPixmap);
+ FreePixmap(pPixmap);
return TRUE;
}
@@ -97,8 +93,8 @@ xnestPixmapToRegion(PixmapPtr pPixmap) pPixmap->drawable.width, pPixmap->drawable.height,
1, XYPixmap);
- pReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
- pTmpReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
+ pReg = RegionCreate(NULL, 1);
+ pTmpReg = RegionCreate(NULL, 1);
if(!pReg || !pTmpReg) {
XDestroyImage(ximage);
return NullRegion;
@@ -118,8 +114,8 @@ xnestPixmapToRegion(PixmapPtr pPixmap) else if (currentPixel == 0L) {
/* right edge */
Box.x2 = x;
- REGION_RESET(pPixmap->drawable.pScreen, pTmpReg, &Box);
- REGION_APPEND(pPixmap->drawable.pScreen, pReg, pTmpReg);
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
}
previousPixel = currentPixel;
}
@@ -127,15 +123,15 @@ xnestPixmapToRegion(PixmapPtr pPixmap) if (previousPixel != 0L) {
/* right edge because of the end of pixmap */
Box.x2 = pPixmap->drawable.width;
- REGION_RESET(pPixmap->drawable.pScreen, pTmpReg, &Box);
- REGION_APPEND(pPixmap->drawable.pScreen, pReg, pTmpReg);
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
}
}
- REGION_DESTROY(pPixmap->drawable.pScreen, pTmpReg);
+ RegionDestroy(pTmpReg);
XDestroyImage(ximage);
- REGION_VALIDATE(pPixmap->drawable.pScreen, pReg, &overlap);
+ RegionValidate(pReg, &overlap);
- return(pReg);
+ return pReg;
}
diff --git a/xorg-server/hw/xnest/Screen.c b/xorg-server/hw/xnest/Screen.c index d25666508..cf225d0ab 100644 --- a/xorg-server/hw/xnest/Screen.c +++ b/xorg-server/hw/xnest/Screen.c @@ -45,8 +45,7 @@ is" without express or implied warranty. Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
-static int xnestCursorScreenKeyIndex;
-DevPrivateKey xnestCursorScreenKey = &xnestCursorScreenKeyIndex;
+DevPrivateKeyRec xnestCursorScreenKeyRec;
ScreenPtr
xnestScreen(Window window)
@@ -146,10 +145,14 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) int rootDepth;
miPointerScreenPtr PointPriv;
- if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
- return False;
- if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC)))
- return False;
+ if (!dixRegisterPrivateKey(&xnestWindowPrivateKeyRec, PRIVATE_WINDOW, sizeof(xnestPrivWin)))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&xnestGCPrivateKeyRec, PRIVATE_GC, sizeof(xnestPrivGC)))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&xnestPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof (xnestPrivPixmap)))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
visuals = (VisualPtr)malloc(xnestNumVisuals * sizeof(VisualRec));
numVisuals = 0;
diff --git a/xorg-server/hw/xnest/Window.c b/xorg-server/hw/xnest/Window.c index 48c870fac..7ef3d8b96 100644 --- a/xorg-server/hw/xnest/Window.c +++ b/xorg-server/hw/xnest/Window.c @@ -1,526 +1,519 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifdef HAVE_XNEST_CONFIG_H -#include <xnest-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "gcstruct.h" -#include "window.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "colormapst.h" -#include "scrnintstr.h" -#include "region.h" - -#include "mi.h" - -#include "Xnest.h" - -#include "Display.h" -#include "Screen.h" -#include "XNGC.h" -#include "Drawable.h" -#include "Color.h" -#include "Visual.h" -#include "Events.h" -#include "Args.h" - -static int xnestWindowPrivateKeyIndex; -DevPrivateKey xnestWindowPrivateKey = &xnestWindowPrivateKeyIndex; - -static int -xnestFindWindowMatch(WindowPtr pWin, pointer ptr) -{ - xnestWindowMatch *wm = (xnestWindowMatch *)ptr; - if (wm->window == xnestWindow(pWin)) { - wm->pWin = pWin; - return WT_STOPWALKING; - } - else - return WT_WALKCHILDREN; -} - -WindowPtr -xnestWindowPtr(Window window) -{ - xnestWindowMatch wm; - int i; - - wm.pWin = NullWindow; - wm.window = window; - - for (i = 0; i < xnestNumScreens; i++) { - WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm); - if (wm.pWin) break; - } - - return wm.pWin; -} - -Bool -xnestCreateWindow(WindowPtr pWin) -{ - unsigned long mask; - XSetWindowAttributes attributes; - Visual *visual; - ColormapPtr pCmap; - - if (pWin->drawable.class == InputOnly) { - mask = 0L; - visual = CopyFromParent; - } - else { - mask = CWEventMask | CWBackingStore; - attributes.event_mask = ExposureMask; - attributes.backing_store = NotUseful; - - if (pWin->parent) { - if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) { - visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); - mask |= CWColormap; - if (pWin->optional->colormap) { - dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin), - RT_COLORMAP, serverClient, DixUseAccess); - attributes.colormap = xnestColormap(pCmap); - } - else - attributes.colormap = xnestDefaultVisualColormap(visual); - } - else - visual = CopyFromParent; - } - else { /* root windows have their own colormaps at creation time */ - visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); - dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin), - RT_COLORMAP, serverClient, DixUseAccess); - mask |= CWColormap; - attributes.colormap = xnestColormap(pCmap); - } - } - - xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay, - xnestWindowParent(pWin), - pWin->origin.x - - wBorderWidth(pWin), - pWin->origin.y - - wBorderWidth(pWin), - pWin->drawable.width, - pWin->drawable.height, - pWin->borderWidth, - pWin->drawable.depth, - pWin->drawable.class, - visual, - mask, &attributes); - xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin); - xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); - xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin); - xnestWindowPriv(pWin)->width = pWin->drawable.width; - xnestWindowPriv(pWin)->height = pWin->drawable.height; - xnestWindowPriv(pWin)->border_width = pWin->borderWidth; - xnestWindowPriv(pWin)->sibling_above = None; - if (pWin->nextSib) - xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin); - xnestWindowPriv(pWin)->bounding_shape = - REGION_CREATE(pWin->drawable.pScreen, NULL, 1); - xnestWindowPriv(pWin)->clip_shape = - REGION_CREATE(pWin->drawable.pScreen, NULL, 1); - - if (!pWin->parent) /* only the root window will have the right colormap */ - xnestSetInstalledColormapWindows(pWin->drawable.pScreen); - - return True; -} - -Bool -xnestDestroyWindow(WindowPtr pWin) -{ - if (pWin->nextSib) - xnestWindowPriv(pWin->nextSib)->sibling_above = - xnestWindowPriv(pWin)->sibling_above; - REGION_DESTROY(pWin->drawable.pScreen, - xnestWindowPriv(pWin)->bounding_shape); - REGION_DESTROY(pWin->drawable.pScreen, - xnestWindowPriv(pWin)->clip_shape); - XDestroyWindow(xnestDisplay, xnestWindow(pWin)); - xnestWindowPriv(pWin)->window = None; - - if (pWin->optional && pWin->optional->colormap && pWin->parent) - xnestSetInstalledColormapWindows(pWin->drawable.pScreen); - - return True; -} - -Bool -xnestPositionWindow(WindowPtr pWin, int x, int y) -{ - xnestConfigureWindow(pWin, - CWParent | - CWX | CWY | - CWWidth | CWHeight | - CWBorderWidth); - - return True; -} - -void -xnestConfigureWindow(WindowPtr pWin, unsigned int mask) -{ - unsigned int valuemask; - XWindowChanges values; - - if (mask & CWParent && - xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) { - XReparentWindow(xnestDisplay, xnestWindow(pWin), - xnestWindowParent(pWin), - pWin->origin.x - wBorderWidth(pWin), - pWin->origin.y - wBorderWidth(pWin)); - xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin); - xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); - xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin); - xnestWindowPriv(pWin)->sibling_above = None; - if (pWin->nextSib) - xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin); - } - - valuemask = 0; - - if (mask & CWX && - xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) { - valuemask |= CWX; - values.x = - xnestWindowPriv(pWin)->x = - pWin->origin.x - wBorderWidth(pWin); - } - - if (mask & CWY && - xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) { - valuemask |= CWY; - values.y = - xnestWindowPriv(pWin)->y = - pWin->origin.y - wBorderWidth(pWin); - } - - if (mask & CWWidth && - xnestWindowPriv(pWin)->width != pWin->drawable.width) { - valuemask |= CWWidth; - values.width = - xnestWindowPriv(pWin)->width = - pWin->drawable.width; - } - - if (mask & CWHeight && - xnestWindowPriv(pWin)->height != pWin->drawable.height) { - valuemask |= CWHeight; - values.height = - xnestWindowPriv(pWin)->height = - pWin->drawable.height; - } - - if (mask & CWBorderWidth && - xnestWindowPriv(pWin)->border_width != pWin->borderWidth) { - valuemask |= CWBorderWidth; - values.border_width = - xnestWindowPriv(pWin)->border_width = - pWin->borderWidth; - } - - if (valuemask) - XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values); - - if (mask & CWStackingOrder && - xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) { - WindowPtr pSib; - - /* find the top sibling */ - for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib); - - /* the top sibling */ - valuemask = CWStackMode; - values.stack_mode = Above; - XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values); - xnestWindowPriv(pSib)->sibling_above = None; - - /* the rest of siblings */ - for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) { - valuemask = CWSibling | CWStackMode; - values.sibling = xnestWindowSiblingAbove(pSib); - values.stack_mode = Below; - XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values); - xnestWindowPriv(pSib)->sibling_above = xnestWindowSiblingAbove(pSib); - } - } -} - -Bool -xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask) -{ - XSetWindowAttributes attributes; - - if (mask & CWBackPixmap) - switch (pWin->backgroundState) { - case None: - attributes.background_pixmap = None; - break; - - case ParentRelative: - attributes.background_pixmap = ParentRelative; - break; - - case BackgroundPixmap: - attributes.background_pixmap = xnestPixmap(pWin->background.pixmap); - break; - - case BackgroundPixel: - mask &= ~CWBackPixmap; - break; - } - - if (mask & CWBackPixel) { - if (pWin->backgroundState == BackgroundPixel) - attributes.background_pixel = xnestPixel(pWin->background.pixel); - else - mask &= ~CWBackPixel; - } - - if (mask & CWBorderPixmap) { - if (pWin->borderIsPixel) - mask &= ~CWBorderPixmap; - else - attributes.border_pixmap = xnestPixmap(pWin->border.pixmap); - } - - if (mask & CWBorderPixel) { - if (pWin->borderIsPixel) - attributes.border_pixel = xnestPixel(pWin->border.pixel); - else - mask &= ~CWBorderPixel; - } - - if (mask & CWBitGravity) - attributes.bit_gravity = pWin->bitGravity; - - if (mask & CWWinGravity) /* dix does this for us */ - mask &= ~CWWinGravity; - - if (mask & CWBackingStore) /* this is really not useful */ - mask &= ~CWBackingStore; - - if (mask & CWBackingPlanes) /* this is really not useful */ - mask &= ~CWBackingPlanes; - - if (mask & CWBackingPixel) /* this is really not useful */ - mask &= ~CWBackingPixel; - - if (mask & CWOverrideRedirect) - attributes.override_redirect = pWin->overrideRedirect; - - if (mask & CWSaveUnder) /* this is really not useful */ - mask &= ~CWSaveUnder; - - if (mask & CWEventMask) /* events are handled elsewhere */ - mask &= ~CWEventMask; - - if (mask & CWDontPropagate) /* events are handled elsewhere */ - mask &= ~CWDontPropagate; - - if (mask & CWColormap) { - ColormapPtr pCmap; - - dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin), RT_COLORMAP, - serverClient, DixUseAccess); - - attributes.colormap = xnestColormap(pCmap); - - xnestSetInstalledColormapWindows(pWin->drawable.pScreen); - } - - if (mask & CWCursor) /* this is handeled in cursor code */ - mask &= ~CWCursor; - - if (mask) - XChangeWindowAttributes(xnestDisplay, xnestWindow(pWin), - mask, &attributes); - - return True; -} - -Bool -xnestRealizeWindow(WindowPtr pWin) -{ - xnestConfigureWindow(pWin, CWStackingOrder); - xnestShapeWindow(pWin); - XMapWindow(xnestDisplay, xnestWindow(pWin)); - - return True; -} - -Bool -xnestUnrealizeWindow(WindowPtr pWin) -{ - XUnmapWindow(xnestDisplay, xnestWindow(pWin)); - - return True; -} - -void -xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) -{ -} - -void -xnestClipNotify(WindowPtr pWin, int dx, int dy) -{ - xnestConfigureWindow(pWin, CWStackingOrder); - xnestShapeWindow(pWin); -} - -static Bool -xnestWindowExposurePredicate(Display *display, XEvent *event, XPointer ptr) -{ - return (event->type == Expose && event->xexpose.window == *(Window *)ptr); -} - -void -xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) -{ - XEvent event; - Window window; - BoxRec Box; - - XSync(xnestDisplay, False); - - window = xnestWindow(pWin); - - while (XCheckIfEvent(xnestDisplay, &event, - xnestWindowExposurePredicate, (char *)&window)) { - - Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x; - Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y; - Box.x2 = Box.x1 + event.xexpose.width; - Box.y2 = Box.y1 + event.xexpose.height; - - event.xexpose.type = ProcessedExpose; - - if (RECT_IN_REGION(pWin->drawable.pScreen, pRgn, &Box) != rgnIN) - XPutBackEvent(xnestDisplay, &event); - } - - miWindowExposures(pWin, pRgn, other_exposed); -} - -void -xnestSetShape(WindowPtr pWin) -{ - xnestShapeWindow(pWin); - miSetShape(pWin); -} - -static Bool -xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2) -{ - BoxPtr pBox1, pBox2; - unsigned int n1, n2; - - if (pReg1 == pReg2) return True; - - if (pReg1 == NullRegion || pReg2 == NullRegion) return False; - - pBox1 = REGION_RECTS(pReg1); - n1 = REGION_NUM_RECTS(pReg1); - - pBox2 = REGION_RECTS(pReg2); - n2 = REGION_NUM_RECTS(pReg2); - - if (n1 != n2) return False; - - if (pBox1 == pBox2) return True; - - if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) return False; - - return True; -} - -void -xnestShapeWindow(WindowPtr pWin) -{ - Region reg; - BoxPtr pBox; - XRectangle rect; - int i; - - if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape, - wBoundingShape(pWin))) { - - if (wBoundingShape(pWin)) { - REGION_COPY(pWin->drawable.pScreen, - xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin)); - - reg = XCreateRegion(); - pBox = REGION_RECTS(xnestWindowPriv(pWin)->bounding_shape); - for (i = 0; - i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape); - i++) { - rect.x = pBox[i].x1; - rect.y = pBox[i].y1; - rect.width = pBox[i].x2 - pBox[i].x1; - rect.height = pBox[i].y2 - pBox[i].y1; - XUnionRectWithRegion(&rect, reg, reg); - } - XShapeCombineRegion(xnestDisplay, xnestWindow(pWin), - ShapeBounding, 0, 0, reg, ShapeSet); - XDestroyRegion(reg); - } - else { - REGION_EMPTY(pWin->drawable.pScreen, - xnestWindowPriv(pWin)->bounding_shape); - - XShapeCombineMask(xnestDisplay, xnestWindow(pWin), - ShapeBounding, 0, 0, None, ShapeSet); - } - } - - if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape, - wClipShape(pWin))) { - - if (wClipShape(pWin)) { - REGION_COPY(pWin->drawable.pScreen, - xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin)); - - reg = XCreateRegion(); - pBox = REGION_RECTS(xnestWindowPriv(pWin)->clip_shape); - for (i = 0; - i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->clip_shape); - i++) { - rect.x = pBox[i].x1; - rect.y = pBox[i].y1; - rect.width = pBox[i].x2 - pBox[i].x1; - rect.height = pBox[i].y2 - pBox[i].y1; - XUnionRectWithRegion(&rect, reg, reg); - } - XShapeCombineRegion(xnestDisplay, xnestWindow(pWin), - ShapeClip, 0, 0, reg, ShapeSet); - XDestroyRegion(reg); - } - else { - REGION_EMPTY(pWin->drawable.pScreen, - xnestWindowPriv(pWin)->clip_shape); - - XShapeCombineMask(xnestDisplay, xnestWindow(pWin), - ShapeClip, 0, 0, None, ShapeSet); - } - } -} +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "gcstruct.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "Drawable.h"
+#include "Color.h"
+#include "Visual.h"
+#include "Events.h"
+#include "Args.h"
+
+DevPrivateKeyRec xnestWindowPrivateKeyRec;
+
+static int
+xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
+{
+ xnestWindowMatch *wm = (xnestWindowMatch *)ptr;
+ if (wm->window == xnestWindow(pWin)) {
+ wm->pWin = pWin;
+ return WT_STOPWALKING;
+ }
+ else
+ return WT_WALKCHILDREN;
+}
+
+WindowPtr
+xnestWindowPtr(Window window)
+{
+ xnestWindowMatch wm;
+ int i;
+
+ wm.pWin = NullWindow;
+ wm.window = window;
+
+ for (i = 0; i < xnestNumScreens; i++) {
+ WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
+ if (wm.pWin) break;
+ }
+
+ return wm.pWin;
+}
+
+Bool
+xnestCreateWindow(WindowPtr pWin)
+{
+ unsigned long mask;
+ XSetWindowAttributes attributes;
+ Visual *visual;
+ ColormapPtr pCmap;
+
+ if (pWin->drawable.class == InputOnly) {
+ mask = 0L;
+ visual = CopyFromParent;
+ }
+ else {
+ mask = CWEventMask | CWBackingStore;
+ attributes.event_mask = ExposureMask;
+ attributes.backing_store = NotUseful;
+
+ if (pWin->parent) {
+ if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) {
+ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
+ mask |= CWColormap;
+ if (pWin->optional->colormap) {
+ dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
+ RT_COLORMAP, serverClient, DixUseAccess);
+ attributes.colormap = xnestColormap(pCmap);
+ }
+ else
+ attributes.colormap = xnestDefaultVisualColormap(visual);
+ }
+ else
+ visual = CopyFromParent;
+ }
+ else { /* root windows have their own colormaps at creation time */
+ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
+ dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
+ RT_COLORMAP, serverClient, DixUseAccess);
+ mask |= CWColormap;
+ attributes.colormap = xnestColormap(pCmap);
+ }
+ }
+
+ xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay,
+ xnestWindowParent(pWin),
+ pWin->origin.x -
+ wBorderWidth(pWin),
+ pWin->origin.y -
+ wBorderWidth(pWin),
+ pWin->drawable.width,
+ pWin->drawable.height,
+ pWin->borderWidth,
+ pWin->drawable.depth,
+ pWin->drawable.class,
+ visual,
+ mask, &attributes);
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->width = pWin->drawable.width;
+ xnestWindowPriv(pWin)->height = pWin->drawable.height;
+ xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
+ xnestWindowPriv(pWin)->sibling_above = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ xnestWindowPriv(pWin)->bounding_shape =
+ RegionCreate(NULL, 1);
+ xnestWindowPriv(pWin)->clip_shape =
+ RegionCreate(NULL, 1);
+
+ if (!pWin->parent) /* only the root window will have the right colormap */
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
+}
+
+Bool
+xnestDestroyWindow(WindowPtr pWin)
+{
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above =
+ xnestWindowPriv(pWin)->sibling_above;
+ RegionDestroy(xnestWindowPriv(pWin)->bounding_shape);
+ RegionDestroy(xnestWindowPriv(pWin)->clip_shape);
+ XDestroyWindow(xnestDisplay, xnestWindow(pWin));
+ xnestWindowPriv(pWin)->window = None;
+
+ if (pWin->optional && pWin->optional->colormap && pWin->parent)
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
+}
+
+Bool
+xnestPositionWindow(WindowPtr pWin, int x, int y)
+{
+ xnestConfigureWindow(pWin,
+ CWParent |
+ CWX | CWY |
+ CWWidth | CWHeight |
+ CWBorderWidth);
+
+ return True;
+}
+
+void
+xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
+{
+ unsigned int valuemask;
+ XWindowChanges values;
+
+ if (mask & CWParent &&
+ xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) {
+ XReparentWindow(xnestDisplay, xnestWindow(pWin),
+ xnestWindowParent(pWin),
+ pWin->origin.x - wBorderWidth(pWin),
+ pWin->origin.y - wBorderWidth(pWin));
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->sibling_above = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ }
+
+ valuemask = 0;
+
+ if (mask & CWX &&
+ xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) {
+ valuemask |= CWX;
+ values.x =
+ xnestWindowPriv(pWin)->x =
+ pWin->origin.x - wBorderWidth(pWin);
+ }
+
+ if (mask & CWY &&
+ xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) {
+ valuemask |= CWY;
+ values.y =
+ xnestWindowPriv(pWin)->y =
+ pWin->origin.y - wBorderWidth(pWin);
+ }
+
+ if (mask & CWWidth &&
+ xnestWindowPriv(pWin)->width != pWin->drawable.width) {
+ valuemask |= CWWidth;
+ values.width =
+ xnestWindowPriv(pWin)->width =
+ pWin->drawable.width;
+ }
+
+ if (mask & CWHeight &&
+ xnestWindowPriv(pWin)->height != pWin->drawable.height) {
+ valuemask |= CWHeight;
+ values.height =
+ xnestWindowPriv(pWin)->height =
+ pWin->drawable.height;
+ }
+
+ if (mask & CWBorderWidth &&
+ xnestWindowPriv(pWin)->border_width != pWin->borderWidth) {
+ valuemask |= CWBorderWidth;
+ values.border_width =
+ xnestWindowPriv(pWin)->border_width =
+ pWin->borderWidth;
+ }
+
+ if (valuemask)
+ XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values);
+
+ if (mask & CWStackingOrder &&
+ xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) {
+ WindowPtr pSib;
+
+ /* find the top sibling */
+ for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib);
+
+ /* the top sibling */
+ valuemask = CWStackMode;
+ values.stack_mode = Above;
+ XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above = None;
+
+ /* the rest of siblings */
+ for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
+ valuemask = CWSibling | CWStackMode;
+ values.sibling = xnestWindowSiblingAbove(pSib);
+ values.stack_mode = Below;
+ XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above = xnestWindowSiblingAbove(pSib);
+ }
+ }
+}
+
+Bool
+xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ XSetWindowAttributes attributes;
+
+ if (mask & CWBackPixmap)
+ switch (pWin->backgroundState) {
+ case None:
+ attributes.background_pixmap = None;
+ break;
+
+ case ParentRelative:
+ attributes.background_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ attributes.background_pixmap = xnestPixmap(pWin->background.pixmap);
+ break;
+
+ case BackgroundPixel:
+ mask &= ~CWBackPixmap;
+ break;
+ }
+
+ if (mask & CWBackPixel) {
+ if (pWin->backgroundState == BackgroundPixel)
+ attributes.background_pixel = xnestPixel(pWin->background.pixel);
+ else
+ mask &= ~CWBackPixel;
+ }
+
+ if (mask & CWBorderPixmap) {
+ if (pWin->borderIsPixel)
+ mask &= ~CWBorderPixmap;
+ else
+ attributes.border_pixmap = xnestPixmap(pWin->border.pixmap);
+ }
+
+ if (mask & CWBorderPixel) {
+ if (pWin->borderIsPixel)
+ attributes.border_pixel = xnestPixel(pWin->border.pixel);
+ else
+ mask &= ~CWBorderPixel;
+ }
+
+ if (mask & CWBitGravity)
+ attributes.bit_gravity = pWin->bitGravity;
+
+ if (mask & CWWinGravity) /* dix does this for us */
+ mask &= ~CWWinGravity;
+
+ if (mask & CWBackingStore) /* this is really not useful */
+ mask &= ~CWBackingStore;
+
+ if (mask & CWBackingPlanes) /* this is really not useful */
+ mask &= ~CWBackingPlanes;
+
+ if (mask & CWBackingPixel) /* this is really not useful */
+ mask &= ~CWBackingPixel;
+
+ if (mask & CWOverrideRedirect)
+ attributes.override_redirect = pWin->overrideRedirect;
+
+ if (mask & CWSaveUnder) /* this is really not useful */
+ mask &= ~CWSaveUnder;
+
+ if (mask & CWEventMask) /* events are handled elsewhere */
+ mask &= ~CWEventMask;
+
+ if (mask & CWDontPropagate) /* events are handled elsewhere */
+ mask &= ~CWDontPropagate;
+
+ if (mask & CWColormap) {
+ ColormapPtr pCmap;
+
+ dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin), RT_COLORMAP,
+ serverClient, DixUseAccess);
+
+ attributes.colormap = xnestColormap(pCmap);
+
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+ }
+
+ if (mask & CWCursor) /* this is handeled in cursor code */
+ mask &= ~CWCursor;
+
+ if (mask)
+ XChangeWindowAttributes(xnestDisplay, xnestWindow(pWin),
+ mask, &attributes);
+
+ return True;
+}
+
+Bool
+xnestRealizeWindow(WindowPtr pWin)
+{
+ xnestConfigureWindow(pWin, CWStackingOrder);
+ xnestShapeWindow(pWin);
+ XMapWindow(xnestDisplay, xnestWindow(pWin));
+
+ return True;
+}
+
+Bool
+xnestUnrealizeWindow(WindowPtr pWin)
+{
+ XUnmapWindow(xnestDisplay, xnestWindow(pWin));
+
+ return True;
+}
+
+void
+xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion)
+{
+}
+
+void
+xnestClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ xnestConfigureWindow(pWin, CWStackingOrder);
+ xnestShapeWindow(pWin);
+}
+
+static Bool
+xnestWindowExposurePredicate(Display *display, XEvent *event, XPointer ptr)
+{
+ return (event->type == Expose && event->xexpose.window == *(Window *)ptr);
+}
+
+void
+xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
+{
+ XEvent event;
+ Window window;
+ BoxRec Box;
+
+ XSync(xnestDisplay, False);
+
+ window = xnestWindow(pWin);
+
+ while (XCheckIfEvent(xnestDisplay, &event,
+ xnestWindowExposurePredicate, (char *)&window)) {
+
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y;
+ Box.x2 = Box.x1 + event.xexpose.width;
+ Box.y2 = Box.y1 + event.xexpose.height;
+
+ event.xexpose.type = ProcessedExpose;
+
+ if (RegionContainsRect(pRgn, &Box) != rgnIN)
+ XPutBackEvent(xnestDisplay, &event);
+ }
+
+ miWindowExposures(pWin, pRgn, other_exposed);
+}
+
+void
+xnestSetShape(WindowPtr pWin, int kind)
+{
+ xnestShapeWindow(pWin);
+ miSetShape(pWin, kind);
+}
+
+static Bool
+xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
+{
+ BoxPtr pBox1, pBox2;
+ unsigned int n1, n2;
+
+ if (pReg1 == pReg2) return True;
+
+ if (pReg1 == NullRegion || pReg2 == NullRegion) return False;
+
+ pBox1 = RegionRects(pReg1);
+ n1 = RegionNumRects(pReg1);
+
+ pBox2 = RegionRects(pReg2);
+ n2 = RegionNumRects(pReg2);
+
+ if (n1 != n2) return False;
+
+ if (pBox1 == pBox2) return True;
+
+ if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) return False;
+
+ return True;
+}
+
+void
+xnestShapeWindow(WindowPtr pWin)
+{
+ Region reg;
+ BoxPtr pBox;
+ XRectangle rect;
+ int i;
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
+ wBoundingShape(pWin))) {
+
+ if (wBoundingShape(pWin)) {
+ RegionCopy(xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin));
+
+ reg = XCreateRegion();
+ pBox = RegionRects(xnestWindowPriv(pWin)->bounding_shape);
+ for (i = 0;
+ i < RegionNumRects(xnestWindowPriv(pWin)->bounding_shape);
+ i++) {
+ rect.x = pBox[i].x1;
+ rect.y = pBox[i].y1;
+ rect.width = pBox[i].x2 - pBox[i].x1;
+ rect.height = pBox[i].y2 - pBox[i].y1;
+ XUnionRectWithRegion(&rect, reg, reg);
+ }
+ XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
+ ShapeBounding, 0, 0, reg, ShapeSet);
+ XDestroyRegion(reg);
+ }
+ else {
+ RegionEmpty(xnestWindowPriv(pWin)->bounding_shape);
+
+ XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
+ ShapeBounding, 0, 0, None, ShapeSet);
+ }
+ }
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape,
+ wClipShape(pWin))) {
+
+ if (wClipShape(pWin)) {
+ RegionCopy(xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin));
+
+ reg = XCreateRegion();
+ pBox = RegionRects(xnestWindowPriv(pWin)->clip_shape);
+ for (i = 0;
+ i < RegionNumRects(xnestWindowPriv(pWin)->clip_shape);
+ i++) {
+ rect.x = pBox[i].x1;
+ rect.y = pBox[i].y1;
+ rect.width = pBox[i].x2 - pBox[i].x1;
+ rect.height = pBox[i].y2 - pBox[i].y1;
+ XUnionRectWithRegion(&rect, reg, reg);
+ }
+ XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
+ ShapeClip, 0, 0, reg, ShapeSet);
+ XDestroyRegion(reg);
+ }
+ else {
+ RegionEmpty(xnestWindowPriv(pWin)->clip_shape);
+
+ XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
+ ShapeClip, 0, 0, None, ShapeSet);
+ }
+ }
+}
diff --git a/xorg-server/hw/xnest/XNCursor.h b/xorg-server/hw/xnest/XNCursor.h index ab2c3b1e6..c50b79d1d 100644 --- a/xorg-server/hw/xnest/XNCursor.h +++ b/xorg-server/hw/xnest/XNCursor.h @@ -1,58 +1,59 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTCURSOR_H -#define XNESTCURSOR_H - -#include "mipointrst.h" - -typedef struct { - miPointerSpriteFuncPtr spriteFuncs; -} xnestCursorFuncRec, *xnestCursorFuncPtr; - -extern DevPrivateKey xnestCursorScreenKey; -extern xnestCursorFuncRec xnestCursorFuncs; - -typedef struct { - Cursor cursor; -} xnestPrivCursor; - -#define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \ - dixLookupPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen))) - -#define xnestSetCursorPriv(pCursor, pScreen, v) \ - dixSetPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen), v) - -#define xnestCursor(pCursor, pScreen) \ - (xnestGetCursorPriv(pCursor, pScreen)->cursor) - -Bool xnestRealizeCursor(DeviceIntPtr pDev, - ScreenPtr pScreen, - CursorPtr pCursor); -Bool xnestUnrealizeCursor(DeviceIntPtr pDev, - ScreenPtr pScreen, - CursorPtr pCursor); -void xnestRecolorCursor(ScreenPtr pScreen, - CursorPtr pCursor, - Bool displayed); -void xnestSetCursor (DeviceIntPtr pDev, - ScreenPtr pScreen, - CursorPtr pCursor, - int x, int y); -void xnestMoveCursor (DeviceIntPtr pDev, - ScreenPtr pScreen, - int x, int y); -Bool xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); -void xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); -#endif /* XNESTCURSOR_H */ +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTCURSOR_H
+#define XNESTCURSOR_H
+
+#include "mipointrst.h"
+
+typedef struct {
+ miPointerSpriteFuncPtr spriteFuncs;
+} xnestCursorFuncRec, *xnestCursorFuncPtr;
+
+extern DevPrivateKeyRec xnestCursorScreenKeyRec;
+#define xnestCursorScreenKey (&xnestCursorScreenKeyRec)
+extern xnestCursorFuncRec xnestCursorFuncs;
+
+typedef struct {
+ Cursor cursor;
+} xnestPrivCursor;
+
+#define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \
+ dixLookupPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen)))
+
+#define xnestSetCursorPriv(pCursor, pScreen, v) \
+ dixSetPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen), v)
+
+#define xnestCursor(pCursor, pScreen) \
+ (xnestGetCursorPriv(pCursor, pScreen)->cursor)
+
+Bool xnestRealizeCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+Bool xnestUnrealizeCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+void xnestRecolorCursor(ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed);
+void xnestSetCursor (DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ int x, int y);
+void xnestMoveCursor (DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ int x, int y);
+Bool xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
+void xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
+#endif /* XNESTCURSOR_H */
diff --git a/xorg-server/hw/xnest/XNGC.h b/xorg-server/hw/xnest/XNGC.h index 19535fe3a..2eb89533d 100644 --- a/xorg-server/hw/xnest/XNGC.h +++ b/xorg-server/hw/xnest/XNGC.h @@ -1,42 +1,43 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTGC_H -#define XNESTGC_H - -/* This file uses the GC definition form Xlib.h as XlibGC. */ - -typedef struct { - XlibGC gc; - int nClipRects; -} xnestPrivGC; - -extern DevPrivateKey xnestGCPrivateKey; - -#define xnestGCPriv(pGC) ((xnestPrivGC *) \ - dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey)) - -#define xnestGC(pGC) (xnestGCPriv(pGC)->gc) - -Bool xnestCreateGC(GCPtr pGC); -void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); -void xnestChangeGC(GCPtr pGC, unsigned long mask); -void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -void xnestDestroyGC(GCPtr pGC); -void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects); -void xnestDestroyClip(GCPtr pGC); -void xnestDestroyClipHelper(GCPtr pGC); -void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc); - -#endif /* XNESTGC_H */ +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTGC_H
+#define XNESTGC_H
+
+/* This file uses the GC definition form Xlib.h as XlibGC. */
+
+typedef struct {
+ XlibGC gc;
+ int nClipRects;
+} xnestPrivGC;
+
+extern DevPrivateKeyRec xnestGCPrivateKeyRec;
+#define xnestGCPrivateKey (&xnestGCPrivateKeyRec)
+
+#define xnestGCPriv(pGC) ((xnestPrivGC *) \
+ dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey))
+
+#define xnestGC(pGC) (xnestGCPriv(pGC)->gc)
+
+Bool xnestCreateGC(GCPtr pGC);
+void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+void xnestChangeGC(GCPtr pGC, unsigned long mask);
+void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+void xnestDestroyGC(GCPtr pGC);
+void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects);
+void xnestDestroyClip(GCPtr pGC);
+void xnestDestroyClipHelper(GCPtr pGC);
+void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
+
+#endif /* XNESTGC_H */
diff --git a/xorg-server/hw/xnest/XNPixmap.h b/xorg-server/hw/xnest/XNPixmap.h index 614827587..0d7c6b61e 100644 --- a/xorg-server/hw/xnest/XNPixmap.h +++ b/xorg-server/hw/xnest/XNPixmap.h @@ -1,36 +1,37 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTPIXMAP_H -#define XNESTPIXMAP_H - -extern DevPrivateKey xnestPixmapPrivateKey; - -typedef struct { - Pixmap pixmap; -} xnestPrivPixmap; - -#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \ - dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey)) - -#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap) - -#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++) - -PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, - int depth, unsigned usage_hint); -Bool xnestDestroyPixmap(PixmapPtr pPixmap); -RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap); - -#endif /* XNESTPIXMAP_H */ +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTPIXMAP_H
+#define XNESTPIXMAP_H
+
+extern DevPrivateKeyRec xnestPixmapPrivateKeyRec;
+#define xnestPixmapPrivateKey (&xnestPixmapPrivateKeyRec)
+
+typedef struct {
+ Pixmap pixmap;
+} xnestPrivPixmap;
+
+#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey))
+
+#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
+
+#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++)
+
+PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
+ int depth, unsigned usage_hint);
+Bool xnestDestroyPixmap(PixmapPtr pPixmap);
+RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
+
+#endif /* XNESTPIXMAP_H */
diff --git a/xorg-server/hw/xnest/XNWindow.h b/xorg-server/hw/xnest/XNWindow.h index b59d86a97..c620767aa 100644 --- a/xorg-server/hw/xnest/XNWindow.h +++ b/xorg-server/hw/xnest/XNWindow.h @@ -1,72 +1,73 @@ -/* - -Copyright 1993 by Davor Matic - -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. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#ifndef XNESTWINDOW_H -#define XNESTWINDOW_H - -typedef struct { - Window window; - Window parent; - int x; - int y; - unsigned int width; - unsigned int height; - unsigned int border_width; - Window sibling_above; - RegionPtr bounding_shape; - RegionPtr clip_shape; -} xnestPrivWin; - -typedef struct { - WindowPtr pWin; - Window window; -} xnestWindowMatch; - -extern DevPrivateKey xnestWindowPrivateKey; - -#define xnestWindowPriv(pWin) ((xnestPrivWin *) \ - dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey)) - -#define xnestWindow(pWin) (xnestWindowPriv(pWin)->window) - -#define xnestWindowParent(pWin) \ - ((pWin)->parent ? \ - xnestWindow((pWin)->parent) : \ - xnestDefaultWindows[pWin->drawable.pScreen->myNum]) - -#define xnestWindowSiblingAbove(pWin) \ - ((pWin)->prevSib ? xnestWindow((pWin)->prevSib) : None) - -#define xnestWindowSiblingBelow(pWin) \ - ((pWin)->nextSib ? xnestWindow((pWin)->nextSib) : None) - -#define CWParent CWSibling -#define CWStackingOrder CWStackMode - -WindowPtr xnestWindowPtr(Window window); -Bool xnestCreateWindow(WindowPtr pWin); -Bool xnestDestroyWindow(WindowPtr pWin); -Bool xnestPositionWindow(WindowPtr pWin, int x, int y); -void xnestConfigureWindow(WindowPtr pWin, unsigned int mask); -Bool xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask); -Bool xnestRealizeWindow(WindowPtr pWin); -Bool xnestUnrealizeWindow(WindowPtr pWin); -void xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion); -void xnestClipNotify(WindowPtr pWin, int dx, int dy); -void xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, - RegionPtr other_exposed); -void xnestSetShape(WindowPtr pWin); -void xnestShapeWindow(WindowPtr pWin); - -#endif /* XNESTWINDOW_H */ +/*
+
+Copyright 1993 by Davor Matic
+
+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. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTWINDOW_H
+#define XNESTWINDOW_H
+
+typedef struct {
+ Window window;
+ Window parent;
+ int x;
+ int y;
+ unsigned int width;
+ unsigned int height;
+ unsigned int border_width;
+ Window sibling_above;
+ RegionPtr bounding_shape;
+ RegionPtr clip_shape;
+} xnestPrivWin;
+
+typedef struct {
+ WindowPtr pWin;
+ Window window;
+} xnestWindowMatch;
+
+extern DevPrivateKeyRec xnestWindowPrivateKeyRec;
+#define xnestWindowPrivateKey (&xnestWindowPrivateKeyRec)
+
+#define xnestWindowPriv(pWin) ((xnestPrivWin *) \
+ dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey))
+
+#define xnestWindow(pWin) (xnestWindowPriv(pWin)->window)
+
+#define xnestWindowParent(pWin) \
+ ((pWin)->parent ? \
+ xnestWindow((pWin)->parent) : \
+ xnestDefaultWindows[pWin->drawable.pScreen->myNum])
+
+#define xnestWindowSiblingAbove(pWin) \
+ ((pWin)->prevSib ? xnestWindow((pWin)->prevSib) : None)
+
+#define xnestWindowSiblingBelow(pWin) \
+ ((pWin)->nextSib ? xnestWindow((pWin)->nextSib) : None)
+
+#define CWParent CWSibling
+#define CWStackingOrder CWStackMode
+
+WindowPtr xnestWindowPtr(Window window);
+Bool xnestCreateWindow(WindowPtr pWin);
+Bool xnestDestroyWindow(WindowPtr pWin);
+Bool xnestPositionWindow(WindowPtr pWin, int x, int y);
+void xnestConfigureWindow(WindowPtr pWin, unsigned int mask);
+Bool xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+Bool xnestRealizeWindow(WindowPtr pWin);
+Bool xnestUnrealizeWindow(WindowPtr pWin);
+void xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion);
+void xnestClipNotify(WindowPtr pWin, int dx, int dy);
+void xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn,
+ RegionPtr other_exposed);
+void xnestSetShape(WindowPtr pWin, int kind);
+void xnestShapeWindow(WindowPtr pWin);
+
+#endif /* XNESTWINDOW_H */
|