a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/***********************************************************
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCopyright 1987, 1998 The Open Group
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncthe above copyright notice appear in all copies and that both that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynccopyright notice and this permission notice appear in supporting
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncdocumentation.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncThe above copyright notice and this permission notice shall be included in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncall copies or substantial portions of the Software.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncin this Software without prior written authorization from The Open Group.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync All Rights Reserved
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncPermission to use, copy, modify, and distribute this software and its
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncdocumentation for any purpose and without fee is hereby granted,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncprovided that the above copyright notice appear in all copies and that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncboth that copyright notice and this permission notice appear in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncsupporting documentation, and that the name of Digital not be
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncused in advertising or publicity pertaining to distribution of the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncsoftware without specific, written prior permission.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync******************************************************************/
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync short nplanes; /* = log2 (ColormapEntries). This does not
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * imply that the screen has this many planes.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * it may have more or fewer */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync VisualID *vids; /* block of visual ids for this depth */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*xstate */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * There is a typedef for each screen function pointer so that code that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * needs to declare a screen function pointer (e.g. in a screen private
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * or as a local variable) can easily do so and retain full type checking.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*QueryBestSizeProcPtr) (int /*class */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned short * /*pwidth */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned short * /*pheight */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*on */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*sx */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*sy */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*w */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*h */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned int /*format */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned long /*planeMask */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync char * /*pdstLine */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*wMax */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int * /*pwidth */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*nspans */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync char * /*pdstStart */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*width */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*height */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned int /*subWindowMode */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned long /*mask */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*w */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*h */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*dx */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*dy */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* pixmap will exist only for the duration of the current rendering operation */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* pixmap will be the backing pixmap for a redirected window */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* pixmap will contain a glyph */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* pixmap will be shared */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*width */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*height */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*depth */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned /*usage_hint */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*ndef */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned short * /*pgreen */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned short * /*pblue */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned long result,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*w */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*h */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*bw */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*x */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*y */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned int /*w */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned int /*h */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /* kind */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync unsigned int /*width */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int *, int *);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*StartPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int x, int y);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynctypedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* Wrapping Screen procedures
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync There are a few modules in the X server which dynamically add and
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync remove themselves from various screen procedure call chains.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync For example, the BlockHandler is dynamically modified by:
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * xf86Rotate
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * composite
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * render (for animated cursors)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Correctly manipulating this chain is complicated by the fact that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync the chain is constructed through a sequence of screen private
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync structures, each holding the next screen->proc pointer.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync To add a module to a screen->proc chain is fairly simple; just save
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync the current screen->proc value in the module screen private
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync and store the module's function in the screen->proc location.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Removing a screen proc is a bit trickier. It seems like all you
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync need to do is set the screen->proc pointer back to the value saved
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync in your screen private. However, if some other module has come
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync along and wrapped on top of you, then the right place to store the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync previous screen->proc value is actually in the wrapping module's
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync screen private structure(!). Of course, you have no idea what
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync other module may have wrapped on top, nor could you poke inside
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync its screen private in any case.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync To make this work, we restrict the unwrapping process to happen
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync during the invocation of the screen proc itself, and then we
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync require the screen proc to take some care when manipulating the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync screen proc functions pointers.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync The requirements are:
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync 1) The screen proc must set the screen->proc pointer back to the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync value saved in its screen private before calling outside its
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync 2a) If the screen proc wants to be remove itself from the chain,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync it must not manipulate screen->proc pointer again before
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync 2b) If the screen proc wants to remain in the chain, it must:
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync 2b.1) Re-fetch the screen->proc pointer and store that in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync its screen private. This ensures that any changes
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync to the chain will be preserved.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync 2b.2) Set screen->proc back to itself
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync One key requirement here is that these steps must wrap not just
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync any invocation of the nested screen->proc value, but must nest
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync essentially any calls outside the current module. This ensures
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync that other modules can reliably manipulate screen->proc wrapping
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync using these same rules.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync For example, the animated cursor code in render has two macros,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Wrap and Unwrap.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync #define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Unwrap takes the screen private (as), the screen (s) and the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync member name (elt), and restores screen->proc to that saved in the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync screen private.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Wrap takes the screen private (as), the screen (s), the member
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync name (elt) and the wrapping function (func). It saves the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync current screen->proc value in the screen private, and then sets the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync screen->proc to the local wrapping function.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Within each of these functions, there's a pretty simple pattern:
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Unwrap(as, pScreen, UnrealizeCursor);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync // Do local stuff, including possibly calling down through
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync // pScreen->UnrealizeCursor
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync The wrapping block handler is a bit different; it does the Unwrap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync the local operations and then only re-Wraps if the hook is still
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync required. Unwrap occurrs at the top of each function, just after
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync entry, and Wrap occurrs at the bottom of each function, just
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync before returning.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int myNum; /* index of this instance in Screens[] */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* next field is a stipple to use as default in
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync a GC. we don't build default tiles of all depths
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync because they are likely to be of a color
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync different from the default fg pixel, so
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync we don't win anything by building
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync a standard one.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST];
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Random screen procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Window Procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync ChangeWindowAttributesProcPtr ChangeWindowAttributes;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Pixmap procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Font procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Cursor Procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync ConstrainCursorHarderProcPtr ConstrainCursorHarder;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* GC procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Colormap procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync ListInstalledColormapsProcPtr ListInstalledColormaps;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Region procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* os layer procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* anybody can get a piece of this array */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync CreateScreenResourcesProcPtr CreateScreenResources;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* Device cursor procedures */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync DeviceCursorInitializeProcPtr DeviceCursorInitialize;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync /* set it in driver side if X server can copy the framebuffer content.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Meant to be used together with '-background none' option, avoiding
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * malicious users to steal framebuffer's content if that would be the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * default */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync SetSharedPixmapBackingProcPtr SetSharedPixmapBacking;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int x; /* origin */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int y; /* origin */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int width; /* total width of all screens together */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int height; /* total height of all screens together */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncextern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int /*argc */ ,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync char ** /*argv */ );
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#endif /* SCREENINTSTRUCT_H */