105b261ecSmrg/*********************************************************** 205b261ecSmrg 305b261ecSmrgCopyright 1987, 1998 The Open Group 405b261ecSmrg 505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its 605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that 705b261ecSmrgthe above copyright notice appear in all copies and that both that 805b261ecSmrgcopyright notice and this permission notice appear in supporting 905b261ecSmrgdocumentation. 1005b261ecSmrg 1105b261ecSmrgThe above copyright notice and this permission notice shall be included in 1205b261ecSmrgall copies or substantial portions of the Software. 1305b261ecSmrg 1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1505b261ecSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1605b261ecSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1705b261ecSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 1805b261ecSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 1905b261ecSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2005b261ecSmrg 2105b261ecSmrgExcept as contained in this notice, the name of The Open Group shall not be 2205b261ecSmrgused in advertising or otherwise to promote the sale, use or other dealings 2305b261ecSmrgin this Software without prior written authorization from The Open Group. 2405b261ecSmrg 2505b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 2605b261ecSmrg 2705b261ecSmrg All Rights Reserved 2805b261ecSmrg 2935c4bbdfSmrgPermission to use, copy, modify, and distribute this software and its 3035c4bbdfSmrgdocumentation for any purpose and without fee is hereby granted, 3105b261ecSmrgprovided that the above copyright notice appear in all copies and that 3235c4bbdfSmrgboth that copyright notice and this permission notice appear in 3305b261ecSmrgsupporting documentation, and that the name of Digital not be 3405b261ecSmrgused in advertising or publicity pertaining to distribution of the 3535c4bbdfSmrgsoftware without specific, written prior permission. 3605b261ecSmrg 3705b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 3805b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 3905b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 4005b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 4105b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 4205b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 4305b261ecSmrgSOFTWARE. 4405b261ecSmrg 4505b261ecSmrg******************************************************************/ 4605b261ecSmrg 4705b261ecSmrg#ifndef SCREENINTSTRUCT_H 4805b261ecSmrg#define SCREENINTSTRUCT_H 4905b261ecSmrg 5005b261ecSmrg#include "screenint.h" 5105b261ecSmrg#include "regionstr.h" 5205b261ecSmrg#include "colormap.h" 5305b261ecSmrg#include "cursor.h" 5405b261ecSmrg#include "validate.h" 5505b261ecSmrg#include <X11/Xproto.h> 5605b261ecSmrg#include "dix.h" 574642e01fSmrg#include "privates.h" 5835c4bbdfSmrg#include <X11/extensions/randr.h> 5905b261ecSmrg 6005b261ecSmrgtypedef struct _PixmapFormat { 6135c4bbdfSmrg unsigned char depth; 6235c4bbdfSmrg unsigned char bitsPerPixel; 6335c4bbdfSmrg unsigned char scanlinePad; 6435c4bbdfSmrg} PixmapFormatRec; 6535c4bbdfSmrg 6605b261ecSmrgtypedef struct _Visual { 6735c4bbdfSmrg VisualID vid; 6835c4bbdfSmrg short class; 6935c4bbdfSmrg short bitsPerRGBValue; 7035c4bbdfSmrg short ColormapEntries; 7135c4bbdfSmrg short nplanes; /* = log2 (ColormapEntries). This does not 7235c4bbdfSmrg * imply that the screen has this many planes. 7335c4bbdfSmrg * it may have more or fewer */ 7435c4bbdfSmrg unsigned long redMask, greenMask, blueMask; 7535c4bbdfSmrg int offsetRed, offsetGreen, offsetBlue; 7635c4bbdfSmrg} VisualRec; 7705b261ecSmrg 7805b261ecSmrgtypedef struct _Depth { 7935c4bbdfSmrg unsigned char depth; 8035c4bbdfSmrg short numVids; 8135c4bbdfSmrg VisualID *vids; /* block of visual ids for this depth */ 8235c4bbdfSmrg} DepthRec; 8305b261ecSmrg 846747b715Smrgtypedef struct _ScreenSaverStuff { 856747b715Smrg WindowPtr pWindow; 8635c4bbdfSmrg XID wid; 8735c4bbdfSmrg char blanked; 8835c4bbdfSmrg Bool (*ExternalScreenSaver) (ScreenPtr /*pScreen */ , 8935c4bbdfSmrg int /*xstate */ , 9035c4bbdfSmrg Bool /*force */ ); 916747b715Smrg} ScreenSaverStuffRec; 926747b715Smrg 9305b261ecSmrg/* 9405b261ecSmrg * There is a typedef for each screen function pointer so that code that 9505b261ecSmrg * needs to declare a screen function pointer (e.g. in a screen private 9605b261ecSmrg * or as a local variable) can easily do so and retain full type checking. 9705b261ecSmrg */ 9805b261ecSmrg 9935c4bbdfSmrgtypedef Bool (*CloseScreenProcPtr) (ScreenPtr /*pScreen */ ); 10035c4bbdfSmrg 10135c4bbdfSmrgtypedef void (*QueryBestSizeProcPtr) (int /*class */ , 10235c4bbdfSmrg unsigned short * /*pwidth */ , 10335c4bbdfSmrg unsigned short * /*pheight */ , 10435c4bbdfSmrg ScreenPtr /*pScreen */ ); 10535c4bbdfSmrg 10635c4bbdfSmrgtypedef Bool (*SaveScreenProcPtr) (ScreenPtr /*pScreen */ , 10735c4bbdfSmrg int /*on */ ); 10835c4bbdfSmrg 10935c4bbdfSmrgtypedef void (*GetImageProcPtr) (DrawablePtr /*pDrawable */ , 11035c4bbdfSmrg int /*sx */ , 11135c4bbdfSmrg int /*sy */ , 11235c4bbdfSmrg int /*w */ , 11335c4bbdfSmrg int /*h */ , 11435c4bbdfSmrg unsigned int /*format */ , 11535c4bbdfSmrg unsigned long /*planeMask */ , 11635c4bbdfSmrg char * /*pdstLine */ ); 11735c4bbdfSmrg 11835c4bbdfSmrgtypedef void (*GetSpansProcPtr) (DrawablePtr /*pDrawable */ , 11935c4bbdfSmrg int /*wMax */ , 12035c4bbdfSmrg DDXPointPtr /*ppt */ , 12135c4bbdfSmrg int * /*pwidth */ , 12235c4bbdfSmrg int /*nspans */ , 12335c4bbdfSmrg char * /*pdstStart */ ); 12435c4bbdfSmrg 12535c4bbdfSmrgtypedef void (*SourceValidateProcPtr) (DrawablePtr /*pDrawable */ , 12635c4bbdfSmrg int /*x */ , 12735c4bbdfSmrg int /*y */ , 12835c4bbdfSmrg int /*width */ , 12935c4bbdfSmrg int /*height */ , 13035c4bbdfSmrg unsigned int /*subWindowMode */ ); 13135c4bbdfSmrg 13235c4bbdfSmrgtypedef Bool (*CreateWindowProcPtr) (WindowPtr /*pWindow */ ); 13335c4bbdfSmrg 13435c4bbdfSmrgtypedef Bool (*DestroyWindowProcPtr) (WindowPtr /*pWindow */ ); 13535c4bbdfSmrg 13635c4bbdfSmrgtypedef Bool (*PositionWindowProcPtr) (WindowPtr /*pWindow */ , 13735c4bbdfSmrg int /*x */ , 13835c4bbdfSmrg int /*y */ ); 13935c4bbdfSmrg 14035c4bbdfSmrgtypedef Bool (*ChangeWindowAttributesProcPtr) (WindowPtr /*pWindow */ , 14135c4bbdfSmrg unsigned long /*mask */ ); 14235c4bbdfSmrg 14335c4bbdfSmrgtypedef Bool (*RealizeWindowProcPtr) (WindowPtr /*pWindow */ ); 14435c4bbdfSmrg 14535c4bbdfSmrgtypedef Bool (*UnrealizeWindowProcPtr) (WindowPtr /*pWindow */ ); 14635c4bbdfSmrg 14735c4bbdfSmrgtypedef void (*RestackWindowProcPtr) (WindowPtr /*pWindow */ , 14835c4bbdfSmrg WindowPtr /*pOldNextSib */ ); 14935c4bbdfSmrg 15035c4bbdfSmrgtypedef int (*ValidateTreeProcPtr) (WindowPtr /*pParent */ , 15135c4bbdfSmrg WindowPtr /*pChild */ , 15235c4bbdfSmrg VTKind /*kind */ ); 15335c4bbdfSmrg 15435c4bbdfSmrgtypedef void (*PostValidateTreeProcPtr) (WindowPtr /*pParent */ , 15535c4bbdfSmrg WindowPtr /*pChild */ , 15635c4bbdfSmrg VTKind /*kind */ ); 15735c4bbdfSmrg 15835c4bbdfSmrgtypedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ , 15935c4bbdfSmrg RegionPtr /*prgn */); 16035c4bbdfSmrg 16135c4bbdfSmrgtypedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/, 16235c4bbdfSmrg RegionPtr /*pRegion*/, 16335c4bbdfSmrg int /*what*/); 16435c4bbdfSmrg 16535c4bbdfSmrgtypedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ , 16635c4bbdfSmrg DDXPointRec /*ptOldOrg */ , 16735c4bbdfSmrg RegionPtr /*prgnSrc */ ); 16835c4bbdfSmrg 16935c4bbdfSmrgtypedef void (*ClearToBackgroundProcPtr) (WindowPtr /*pWindow */ , 17035c4bbdfSmrg int /*x */ , 17135c4bbdfSmrg int /*y */ , 17235c4bbdfSmrg int /*w */ , 17335c4bbdfSmrg int /*h */ , 17435c4bbdfSmrg Bool /*generateExposures */ ); 17535c4bbdfSmrg 17635c4bbdfSmrgtypedef void (*ClipNotifyProcPtr) (WindowPtr /*pWindow */ , 17735c4bbdfSmrg int /*dx */ , 17835c4bbdfSmrg int /*dy */ ); 17905b261ecSmrg 1804642e01fSmrg/* pixmap will exist only for the duration of the current rendering operation */ 1814642e01fSmrg#define CREATE_PIXMAP_USAGE_SCRATCH 1 1824642e01fSmrg/* pixmap will be the backing pixmap for a redirected window */ 1834642e01fSmrg#define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2 1844642e01fSmrg/* pixmap will contain a glyph */ 1854642e01fSmrg#define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3 18635c4bbdfSmrg/* pixmap will be shared */ 18735c4bbdfSmrg#define CREATE_PIXMAP_USAGE_SHARED 4 18835c4bbdfSmrg 18935c4bbdfSmrgtypedef PixmapPtr (*CreatePixmapProcPtr) (ScreenPtr /*pScreen */ , 19035c4bbdfSmrg int /*width */ , 19135c4bbdfSmrg int /*height */ , 19235c4bbdfSmrg int /*depth */ , 19335c4bbdfSmrg unsigned /*usage_hint */ ); 19435c4bbdfSmrg 19535c4bbdfSmrgtypedef Bool (*DestroyPixmapProcPtr) (PixmapPtr /*pPixmap */ ); 19635c4bbdfSmrg 19735c4bbdfSmrgtypedef Bool (*RealizeFontProcPtr) (ScreenPtr /*pScreen */ , 19835c4bbdfSmrg FontPtr /*pFont */ ); 19935c4bbdfSmrg 20035c4bbdfSmrgtypedef Bool (*UnrealizeFontProcPtr) (ScreenPtr /*pScreen */ , 20135c4bbdfSmrg FontPtr /*pFont */ ); 20235c4bbdfSmrg 20335c4bbdfSmrgtypedef void (*ConstrainCursorProcPtr) (DeviceIntPtr /*pDev */ , 20435c4bbdfSmrg ScreenPtr /*pScreen */ , 20535c4bbdfSmrg BoxPtr /*pBox */ ); 20635c4bbdfSmrg 20735c4bbdfSmrgtypedef void (*CursorLimitsProcPtr) (DeviceIntPtr /* pDev */ , 20835c4bbdfSmrg ScreenPtr /*pScreen */ , 20935c4bbdfSmrg CursorPtr /*pCursor */ , 21035c4bbdfSmrg BoxPtr /*pHotBox */ , 21135c4bbdfSmrg BoxPtr /*pTopLeftBox */ ); 21235c4bbdfSmrg 21335c4bbdfSmrgtypedef Bool (*DisplayCursorProcPtr) (DeviceIntPtr /* pDev */ , 21435c4bbdfSmrg ScreenPtr /*pScreen */ , 21535c4bbdfSmrg CursorPtr /*pCursor */ ); 21635c4bbdfSmrg 21735c4bbdfSmrgtypedef Bool (*RealizeCursorProcPtr) (DeviceIntPtr /* pDev */ , 21835c4bbdfSmrg ScreenPtr /*pScreen */ , 21935c4bbdfSmrg CursorPtr /*pCursor */ ); 22035c4bbdfSmrg 22135c4bbdfSmrgtypedef Bool (*UnrealizeCursorProcPtr) (DeviceIntPtr /* pDev */ , 22235c4bbdfSmrg ScreenPtr /*pScreen */ , 22335c4bbdfSmrg CursorPtr /*pCursor */ ); 22435c4bbdfSmrg 22535c4bbdfSmrgtypedef void (*RecolorCursorProcPtr) (DeviceIntPtr /* pDev */ , 22635c4bbdfSmrg ScreenPtr /*pScreen */ , 22735c4bbdfSmrg CursorPtr /*pCursor */ , 22835c4bbdfSmrg Bool /*displayed */ ); 22935c4bbdfSmrg 23035c4bbdfSmrgtypedef Bool (*SetCursorPositionProcPtr) (DeviceIntPtr /* pDev */ , 23135c4bbdfSmrg ScreenPtr /*pScreen */ , 23235c4bbdfSmrg int /*x */ , 23335c4bbdfSmrg int /*y */ , 23435c4bbdfSmrg Bool /*generateEvent */ ); 23535c4bbdfSmrg 2361b5d61b8Smrgtypedef void (*CursorWarpedToProcPtr) (DeviceIntPtr /* pDev */ , 2371b5d61b8Smrg ScreenPtr /*pScreen */ , 2381b5d61b8Smrg ClientPtr /*pClient */ , 2391b5d61b8Smrg WindowPtr /*pWindow */ , 2401b5d61b8Smrg SpritePtr /*pSprite */ , 2411b5d61b8Smrg int /*x */ , 2421b5d61b8Smrg int /*y */ ); 2431b5d61b8Smrg 2441b5d61b8Smrgtypedef void (*CurserConfinedToProcPtr) (DeviceIntPtr /* pDev */ , 2451b5d61b8Smrg ScreenPtr /*pScreen */ , 2461b5d61b8Smrg WindowPtr /*pWindow */ ); 2471b5d61b8Smrg 24835c4bbdfSmrgtypedef Bool (*CreateGCProcPtr) (GCPtr /*pGC */ ); 24935c4bbdfSmrg 25035c4bbdfSmrgtypedef Bool (*CreateColormapProcPtr) (ColormapPtr /*pColormap */ ); 25135c4bbdfSmrg 25235c4bbdfSmrgtypedef void (*DestroyColormapProcPtr) (ColormapPtr /*pColormap */ ); 25335c4bbdfSmrg 25435c4bbdfSmrgtypedef void (*InstallColormapProcPtr) (ColormapPtr /*pColormap */ ); 25535c4bbdfSmrg 25635c4bbdfSmrgtypedef void (*UninstallColormapProcPtr) (ColormapPtr /*pColormap */ ); 25735c4bbdfSmrg 25835c4bbdfSmrgtypedef int (*ListInstalledColormapsProcPtr) (ScreenPtr /*pScreen */ , 25935c4bbdfSmrg XID * /*pmaps */ ); 26035c4bbdfSmrg 26135c4bbdfSmrgtypedef void (*StoreColorsProcPtr) (ColormapPtr /*pColormap */ , 26235c4bbdfSmrg int /*ndef */ , 26335c4bbdfSmrg xColorItem * /*pdef */ ); 26435c4bbdfSmrg 26535c4bbdfSmrgtypedef void (*ResolveColorProcPtr) (unsigned short * /*pred */ , 26635c4bbdfSmrg unsigned short * /*pgreen */ , 26735c4bbdfSmrg unsigned short * /*pblue */ , 26835c4bbdfSmrg VisualPtr /*pVisual */ ); 26935c4bbdfSmrg 27035c4bbdfSmrgtypedef RegionPtr (*BitmapToRegionProcPtr) (PixmapPtr /*pPix */ ); 27135c4bbdfSmrg 27235c4bbdfSmrgtypedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen, 2731b5d61b8Smrg void *timeout); 27435c4bbdfSmrg 2751b5d61b8Smrg/* result has three possible values: 2761b5d61b8Smrg * < 0 - error 2771b5d61b8Smrg * = 0 - timeout 2781b5d61b8Smrg * > 0 - activity 2791b5d61b8Smrg */ 28035c4bbdfSmrgtypedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen, 2811b5d61b8Smrg int result); 28235c4bbdfSmrg 28335c4bbdfSmrgtypedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ ); 28435c4bbdfSmrg 28535c4bbdfSmrgtypedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap, 28635c4bbdfSmrg int width, 28735c4bbdfSmrg int height, 28835c4bbdfSmrg int depth, 28935c4bbdfSmrg int bitsPerPixel, 29035c4bbdfSmrg int devKind, 29135c4bbdfSmrg void *pPixData); 29235c4bbdfSmrg 29335c4bbdfSmrgtypedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ ); 29435c4bbdfSmrg 29535c4bbdfSmrgtypedef void (*SetWindowPixmapProcPtr) (WindowPtr /*pWin */ , 29635c4bbdfSmrg PixmapPtr /*pPix */ ); 29735c4bbdfSmrg 29835c4bbdfSmrgtypedef PixmapPtr (*GetScreenPixmapProcPtr) (ScreenPtr /*pScreen */ ); 29935c4bbdfSmrg 30035c4bbdfSmrgtypedef void (*SetScreenPixmapProcPtr) (PixmapPtr /*pPix */ ); 30135c4bbdfSmrg 30235c4bbdfSmrgtypedef void (*MarkWindowProcPtr) (WindowPtr /*pWin */ ); 30335c4bbdfSmrg 30435c4bbdfSmrgtypedef Bool (*MarkOverlappedWindowsProcPtr) (WindowPtr /*parent */ , 30535c4bbdfSmrg WindowPtr /*firstChild */ , 30635c4bbdfSmrg WindowPtr * /*pLayerWin */ ); 30735c4bbdfSmrg 30835c4bbdfSmrgtypedef int (*ConfigNotifyProcPtr) (WindowPtr /*pWin */ , 30935c4bbdfSmrg int /*x */ , 31035c4bbdfSmrg int /*y */ , 31135c4bbdfSmrg int /*w */ , 31235c4bbdfSmrg int /*h */ , 31335c4bbdfSmrg int /*bw */ , 31435c4bbdfSmrg WindowPtr /*pSib */ ); 31535c4bbdfSmrg 31635c4bbdfSmrgtypedef void (*MoveWindowProcPtr) (WindowPtr /*pWin */ , 31735c4bbdfSmrg int /*x */ , 31835c4bbdfSmrg int /*y */ , 31935c4bbdfSmrg WindowPtr /*pSib */ , 32035c4bbdfSmrg VTKind /*kind */ ); 3214642e01fSmrg 32235c4bbdfSmrgtypedef void (*ResizeWindowProcPtr) (WindowPtr /*pWin */ , 32335c4bbdfSmrg int /*x */ , 32435c4bbdfSmrg int /*y */ , 32535c4bbdfSmrg unsigned int /*w */ , 32635c4bbdfSmrg unsigned int /*h */ , 32735c4bbdfSmrg WindowPtr /*pSib */ 32835c4bbdfSmrg ); 32935c4bbdfSmrg 33035c4bbdfSmrgtypedef WindowPtr (*GetLayerWindowProcPtr) (WindowPtr /*pWin */ 33135c4bbdfSmrg ); 33235c4bbdfSmrg 33335c4bbdfSmrgtypedef void (*HandleExposuresProcPtr) (WindowPtr /*pWin */ ); 33435c4bbdfSmrg 33535c4bbdfSmrgtypedef void (*ReparentWindowProcPtr) (WindowPtr /*pWin */ , 33635c4bbdfSmrg WindowPtr /*pPriorParent */ ); 33735c4bbdfSmrg 33835c4bbdfSmrgtypedef void (*SetShapeProcPtr) (WindowPtr /*pWin */ , 33935c4bbdfSmrg int /* kind */ ); 34035c4bbdfSmrg 34135c4bbdfSmrgtypedef void (*ChangeBorderWidthProcPtr) (WindowPtr /*pWin */ , 34235c4bbdfSmrg unsigned int /*width */ ); 34335c4bbdfSmrg 34435c4bbdfSmrgtypedef void (*MarkUnrealizedWindowProcPtr) (WindowPtr /*pChild */ , 34535c4bbdfSmrg WindowPtr /*pWin */ , 34635c4bbdfSmrg Bool /*fromConfigure */ ); 34735c4bbdfSmrg 34835c4bbdfSmrgtypedef Bool (*DeviceCursorInitializeProcPtr) (DeviceIntPtr /* pDev */ , 34935c4bbdfSmrg ScreenPtr /* pScreen */ ); 35035c4bbdfSmrg 35135c4bbdfSmrgtypedef void (*DeviceCursorCleanupProcPtr) (DeviceIntPtr /* pDev */ , 35235c4bbdfSmrg ScreenPtr /* pScreen */ ); 35335c4bbdfSmrg 35435c4bbdfSmrgtypedef void (*ConstrainCursorHarderProcPtr) (DeviceIntPtr, ScreenPtr, int, 35535c4bbdfSmrg int *, int *); 35635c4bbdfSmrg 35735c4bbdfSmrg 35835c4bbdfSmrgtypedef Bool (*SharePixmapBackingProcPtr)(PixmapPtr, ScreenPtr, void **); 35935c4bbdfSmrg 36035c4bbdfSmrgtypedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *); 36135c4bbdfSmrg 3621b5d61b8Smrg#define HAS_SYNC_SHARED_PIXMAP 1 3631b5d61b8Smrg/* The SyncSharedPixmap hook has two purposes: 3641b5d61b8Smrg * 365ed6184dfSmrg * 1. If the primary driver has it, the secondary driver can use it to 3661b5d61b8Smrg * synchronize the shared pixmap contents with the screen pixmap. 367ed6184dfSmrg * 2. If the secondary driver has it, the primary driver can expect the secondary 368ed6184dfSmrg * driver to call the primary screen's SyncSharedPixmap hook, so the primary 3691b5d61b8Smrg * driver doesn't have to synchronize the shared pixmap contents itself, 3701b5d61b8Smrg * e.g. from the BlockHandler. 3711b5d61b8Smrg * 3721b5d61b8Smrg * A driver must only set the hook if it handles both cases correctly. 3731b5d61b8Smrg * 374ed6184dfSmrg * The argument is the secondary screen's pixmap_dirty_list entry, the hook is 375ed6184dfSmrg * responsible for finding the corresponding entry in the primary screen's 3761b5d61b8Smrg * pixmap_dirty_list. 3771b5d61b8Smrg */ 3781b5d61b8Smrgtypedef void (*SyncSharedPixmapProcPtr)(PixmapDirtyUpdatePtr); 3791b5d61b8Smrg 3801b5d61b8Smrgtypedef Bool (*StartPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr, 38135c4bbdfSmrg int x, int y, 38235c4bbdfSmrg int dst_x, int dst_y, 38335c4bbdfSmrg Rotation rotation); 38435c4bbdfSmrg 3851b5d61b8Smrgtypedef Bool (*PresentSharedPixmapProcPtr)(PixmapPtr); 3861b5d61b8Smrg 3871b5d61b8Smrgtypedef Bool (*RequestSharedPixmapNotifyDamageProcPtr)(PixmapPtr); 3881b5d61b8Smrg 3891b5d61b8Smrgtypedef Bool (*StopPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr); 3901b5d61b8Smrg 3911b5d61b8Smrgtypedef Bool (*StopFlippingPixmapTrackingProcPtr)(DrawablePtr, 3921b5d61b8Smrg PixmapPtr, PixmapPtr); 3931b5d61b8Smrg 3941b5d61b8Smrgtypedef Bool (*SharedPixmapNotifyDamageProcPtr)(PixmapPtr); 39535c4bbdfSmrg 39635c4bbdfSmrgtypedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool); 39735c4bbdfSmrg 39835c4bbdfSmrgtypedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen, 39935c4bbdfSmrg SpritePtr pSprite, int x, int y); 40035c4bbdfSmrg 40135c4bbdfSmrgtypedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32); 40235c4bbdfSmrg 4031b5d61b8Smrgtypedef void (*DPMSProcPtr)(ScreenPtr pScreen, int level); 4041b5d61b8Smrg 40535c4bbdfSmrg/* Wrapping Screen procedures 40635c4bbdfSmrg 40735c4bbdfSmrg There are a few modules in the X server which dynamically add and 40835c4bbdfSmrg remove themselves from various screen procedure call chains. 40935c4bbdfSmrg 41035c4bbdfSmrg For example, the BlockHandler is dynamically modified by: 41135c4bbdfSmrg 41235c4bbdfSmrg * xf86Rotate 41335c4bbdfSmrg * miSprite 41435c4bbdfSmrg * composite 41535c4bbdfSmrg * render (for animated cursors) 41635c4bbdfSmrg 41735c4bbdfSmrg Correctly manipulating this chain is complicated by the fact that 41835c4bbdfSmrg the chain is constructed through a sequence of screen private 41935c4bbdfSmrg structures, each holding the next screen->proc pointer. 42035c4bbdfSmrg 42135c4bbdfSmrg To add a module to a screen->proc chain is fairly simple; just save 42235c4bbdfSmrg the current screen->proc value in the module screen private 42335c4bbdfSmrg and store the module's function in the screen->proc location. 42435c4bbdfSmrg 42535c4bbdfSmrg Removing a screen proc is a bit trickier. It seems like all you 42635c4bbdfSmrg need to do is set the screen->proc pointer back to the value saved 42735c4bbdfSmrg in your screen private. However, if some other module has come 42835c4bbdfSmrg along and wrapped on top of you, then the right place to store the 42935c4bbdfSmrg previous screen->proc value is actually in the wrapping module's 43035c4bbdfSmrg screen private structure(!). Of course, you have no idea what 43135c4bbdfSmrg other module may have wrapped on top, nor could you poke inside 43235c4bbdfSmrg its screen private in any case. 43335c4bbdfSmrg 43435c4bbdfSmrg To make this work, we restrict the unwrapping process to happen 43535c4bbdfSmrg during the invocation of the screen proc itself, and then we 43635c4bbdfSmrg require the screen proc to take some care when manipulating the 43735c4bbdfSmrg screen proc functions pointers. 43835c4bbdfSmrg 43935c4bbdfSmrg The requirements are: 44035c4bbdfSmrg 44135c4bbdfSmrg 1) The screen proc must set the screen->proc pointer back to the 44235c4bbdfSmrg value saved in its screen private before calling outside its 44335c4bbdfSmrg module. 44435c4bbdfSmrg 44535c4bbdfSmrg 2a) If the screen proc wants to be remove itself from the chain, 44635c4bbdfSmrg it must not manipulate screen->proc pointer again before 44735c4bbdfSmrg returning. 44835c4bbdfSmrg 44935c4bbdfSmrg 2b) If the screen proc wants to remain in the chain, it must: 45035c4bbdfSmrg 45135c4bbdfSmrg 2b.1) Re-fetch the screen->proc pointer and store that in 45235c4bbdfSmrg its screen private. This ensures that any changes 45335c4bbdfSmrg to the chain will be preserved. 45435c4bbdfSmrg 45535c4bbdfSmrg 2b.2) Set screen->proc back to itself 45635c4bbdfSmrg 45735c4bbdfSmrg One key requirement here is that these steps must wrap not just 45835c4bbdfSmrg any invocation of the nested screen->proc value, but must nest 45935c4bbdfSmrg essentially any calls outside the current module. This ensures 46035c4bbdfSmrg that other modules can reliably manipulate screen->proc wrapping 46135c4bbdfSmrg using these same rules. 46235c4bbdfSmrg 46335c4bbdfSmrg For example, the animated cursor code in render has two macros, 46435c4bbdfSmrg Wrap and Unwrap. 46535c4bbdfSmrg 46635c4bbdfSmrg #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) 46735c4bbdfSmrg 46835c4bbdfSmrg Unwrap takes the screen private (as), the screen (s) and the 46935c4bbdfSmrg member name (elt), and restores screen->proc to that saved in the 47035c4bbdfSmrg screen private. 47135c4bbdfSmrg 47235c4bbdfSmrg #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) 47335c4bbdfSmrg 47435c4bbdfSmrg Wrap takes the screen private (as), the screen (s), the member 47535c4bbdfSmrg name (elt) and the wrapping function (func). It saves the 47635c4bbdfSmrg current screen->proc value in the screen private, and then sets the 47735c4bbdfSmrg screen->proc to the local wrapping function. 47835c4bbdfSmrg 47935c4bbdfSmrg Within each of these functions, there's a pretty simple pattern: 48035c4bbdfSmrg 48135c4bbdfSmrg Unwrap(as, pScreen, UnrealizeCursor); 48235c4bbdfSmrg 48335c4bbdfSmrg // Do local stuff, including possibly calling down through 48435c4bbdfSmrg // pScreen->UnrealizeCursor 48535c4bbdfSmrg 48635c4bbdfSmrg Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); 48735c4bbdfSmrg 48835c4bbdfSmrg The wrapping block handler is a bit different; it does the Unwrap, 489ed6184dfSmrg the local operations, and then only re-Wraps if the hook is still 490ed6184dfSmrg required. Unwrap occurs at the top of each function, just after 491ed6184dfSmrg entry, and Wrap occurs at the bottom of each function, just 49235c4bbdfSmrg before returning. 49335c4bbdfSmrg */ 4949ace9065Smrg 49505b261ecSmrgtypedef struct _Screen { 49635c4bbdfSmrg int myNum; /* index of this instance in Screens[] */ 49735c4bbdfSmrg ATOM id; 49835c4bbdfSmrg short x, y, width, height; 49935c4bbdfSmrg short mmWidth, mmHeight; 50035c4bbdfSmrg short numDepths; 50135c4bbdfSmrg unsigned char rootDepth; 50235c4bbdfSmrg DepthPtr allowedDepths; 50335c4bbdfSmrg unsigned long rootVisual; 50435c4bbdfSmrg unsigned long defColormap; 50535c4bbdfSmrg short minInstalledCmaps, maxInstalledCmaps; 50635c4bbdfSmrg char backingStoreSupport, saveUnderSupport; 50735c4bbdfSmrg unsigned long whitePixel, blackPixel; 50835c4bbdfSmrg GCPtr GCperDepth[MAXFORMATS + 1]; 5091b5d61b8Smrg /* next field is a stipple to use as default in a GC. we don't build 5101b5d61b8Smrg * default tiles of all depths because they are likely to be of a color 5111b5d61b8Smrg * different from the default fg pixel, so we don't win anything by 5121b5d61b8Smrg * building a standard one. 51335c4bbdfSmrg */ 5141b5d61b8Smrg PixmapPtr defaultStipple; 51535c4bbdfSmrg void *devPrivate; 51635c4bbdfSmrg short numVisuals; 51735c4bbdfSmrg VisualPtr visuals; 51835c4bbdfSmrg WindowPtr root; 5196747b715Smrg ScreenSaverStuffRec screensaver; 52005b261ecSmrg 52135c4bbdfSmrg DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST]; 52235c4bbdfSmrg 52305b261ecSmrg /* Random screen procedures */ 52405b261ecSmrg 52535c4bbdfSmrg CloseScreenProcPtr CloseScreen; 52635c4bbdfSmrg QueryBestSizeProcPtr QueryBestSize; 52735c4bbdfSmrg SaveScreenProcPtr SaveScreen; 52835c4bbdfSmrg GetImageProcPtr GetImage; 52935c4bbdfSmrg GetSpansProcPtr GetSpans; 53035c4bbdfSmrg SourceValidateProcPtr SourceValidate; 53105b261ecSmrg 53205b261ecSmrg /* Window Procedures */ 53305b261ecSmrg 53435c4bbdfSmrg CreateWindowProcPtr CreateWindow; 53535c4bbdfSmrg DestroyWindowProcPtr DestroyWindow; 53635c4bbdfSmrg PositionWindowProcPtr PositionWindow; 53705b261ecSmrg ChangeWindowAttributesProcPtr ChangeWindowAttributes; 53835c4bbdfSmrg RealizeWindowProcPtr RealizeWindow; 53935c4bbdfSmrg UnrealizeWindowProcPtr UnrealizeWindow; 54035c4bbdfSmrg ValidateTreeProcPtr ValidateTree; 54135c4bbdfSmrg PostValidateTreeProcPtr PostValidateTree; 54235c4bbdfSmrg WindowExposuresProcPtr WindowExposures; 54335c4bbdfSmrg CopyWindowProcPtr CopyWindow; 54435c4bbdfSmrg ClearToBackgroundProcPtr ClearToBackground; 54535c4bbdfSmrg ClipNotifyProcPtr ClipNotify; 54635c4bbdfSmrg RestackWindowProcPtr RestackWindow; 54735c4bbdfSmrg PaintWindowProcPtr PaintWindow; 54805b261ecSmrg 54905b261ecSmrg /* Pixmap procedures */ 55005b261ecSmrg 55135c4bbdfSmrg CreatePixmapProcPtr CreatePixmap; 55235c4bbdfSmrg DestroyPixmapProcPtr DestroyPixmap; 55305b261ecSmrg 55405b261ecSmrg /* Font procedures */ 55505b261ecSmrg 55635c4bbdfSmrg RealizeFontProcPtr RealizeFont; 55735c4bbdfSmrg UnrealizeFontProcPtr UnrealizeFont; 55805b261ecSmrg 55905b261ecSmrg /* Cursor Procedures */ 56005b261ecSmrg 56135c4bbdfSmrg ConstrainCursorProcPtr ConstrainCursor; 5629ace9065Smrg ConstrainCursorHarderProcPtr ConstrainCursorHarder; 56335c4bbdfSmrg CursorLimitsProcPtr CursorLimits; 56435c4bbdfSmrg DisplayCursorProcPtr DisplayCursor; 56535c4bbdfSmrg RealizeCursorProcPtr RealizeCursor; 56635c4bbdfSmrg UnrealizeCursorProcPtr UnrealizeCursor; 56735c4bbdfSmrg RecolorCursorProcPtr RecolorCursor; 56835c4bbdfSmrg SetCursorPositionProcPtr SetCursorPosition; 5691b5d61b8Smrg CursorWarpedToProcPtr CursorWarpedTo; 5701b5d61b8Smrg CurserConfinedToProcPtr CursorConfinedTo; 57105b261ecSmrg 57205b261ecSmrg /* GC procedures */ 57305b261ecSmrg 57435c4bbdfSmrg CreateGCProcPtr CreateGC; 57505b261ecSmrg 57605b261ecSmrg /* Colormap procedures */ 57705b261ecSmrg 57835c4bbdfSmrg CreateColormapProcPtr CreateColormap; 57935c4bbdfSmrg DestroyColormapProcPtr DestroyColormap; 58035c4bbdfSmrg InstallColormapProcPtr InstallColormap; 58135c4bbdfSmrg UninstallColormapProcPtr UninstallColormap; 58205b261ecSmrg ListInstalledColormapsProcPtr ListInstalledColormaps; 58335c4bbdfSmrg StoreColorsProcPtr StoreColors; 58435c4bbdfSmrg ResolveColorProcPtr ResolveColor; 58505b261ecSmrg 58605b261ecSmrg /* Region procedures */ 58705b261ecSmrg 58835c4bbdfSmrg BitmapToRegionProcPtr BitmapToRegion; 58905b261ecSmrg 59005b261ecSmrg /* os layer procedures */ 59105b261ecSmrg 59235c4bbdfSmrg ScreenBlockHandlerProcPtr BlockHandler; 59335c4bbdfSmrg ScreenWakeupHandlerProcPtr WakeupHandler; 59405b261ecSmrg 59505b261ecSmrg /* anybody can get a piece of this array */ 59635c4bbdfSmrg PrivateRec *devPrivates; 59705b261ecSmrg 59805b261ecSmrg CreateScreenResourcesProcPtr CreateScreenResources; 59935c4bbdfSmrg ModifyPixmapHeaderProcPtr ModifyPixmapHeader; 60005b261ecSmrg 60135c4bbdfSmrg GetWindowPixmapProcPtr GetWindowPixmap; 60235c4bbdfSmrg SetWindowPixmapProcPtr SetWindowPixmap; 60335c4bbdfSmrg GetScreenPixmapProcPtr GetScreenPixmap; 60435c4bbdfSmrg SetScreenPixmapProcPtr SetScreenPixmap; 60535c4bbdfSmrg NameWindowPixmapProcPtr NameWindowPixmap; 60605b261ecSmrg 60735c4bbdfSmrg PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ 60805b261ecSmrg 60935c4bbdfSmrg unsigned int totalPixmapSize; 61005b261ecSmrg 61135c4bbdfSmrg MarkWindowProcPtr MarkWindow; 61205b261ecSmrg MarkOverlappedWindowsProcPtr MarkOverlappedWindows; 61335c4bbdfSmrg ConfigNotifyProcPtr ConfigNotify; 61435c4bbdfSmrg MoveWindowProcPtr MoveWindow; 61535c4bbdfSmrg ResizeWindowProcPtr ResizeWindow; 61635c4bbdfSmrg GetLayerWindowProcPtr GetLayerWindow; 61735c4bbdfSmrg HandleExposuresProcPtr HandleExposures; 61835c4bbdfSmrg ReparentWindowProcPtr ReparentWindow; 61905b261ecSmrg 62035c4bbdfSmrg SetShapeProcPtr SetShape; 62105b261ecSmrg 62235c4bbdfSmrg ChangeBorderWidthProcPtr ChangeBorderWidth; 62335c4bbdfSmrg MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; 62405b261ecSmrg 6254642e01fSmrg /* Device cursor procedures */ 6264642e01fSmrg DeviceCursorInitializeProcPtr DeviceCursorInitialize; 62735c4bbdfSmrg DeviceCursorCleanupProcPtr DeviceCursorCleanup; 6289ace9065Smrg 6299ace9065Smrg /* set it in driver side if X server can copy the framebuffer content. 6309ace9065Smrg * Meant to be used together with '-background none' option, avoiding 6319ace9065Smrg * malicious users to steal framebuffer's content if that would be the 6329ace9065Smrg * default */ 63335c4bbdfSmrg Bool canDoBGNoneRoot; 63435c4bbdfSmrg 63535c4bbdfSmrg Bool isGPU; 63635c4bbdfSmrg 637ed6184dfSmrg /* Info on this screen's secondarys (if any) */ 638ed6184dfSmrg struct xorg_list secondary_list; 639ed6184dfSmrg struct xorg_list secondary_head; 640ed6184dfSmrg int output_secondarys; 641ed6184dfSmrg /* Info for when this screen is a secondary */ 642ed6184dfSmrg ScreenPtr current_primary; 643ed6184dfSmrg Bool is_output_secondary; 644ed6184dfSmrg Bool is_offload_secondary; 64535c4bbdfSmrg 64635c4bbdfSmrg SharePixmapBackingProcPtr SharePixmapBacking; 64735c4bbdfSmrg SetSharedPixmapBackingProcPtr SetSharedPixmapBacking; 64835c4bbdfSmrg 64935c4bbdfSmrg StartPixmapTrackingProcPtr StartPixmapTracking; 65035c4bbdfSmrg StopPixmapTrackingProcPtr StopPixmapTracking; 6511b5d61b8Smrg SyncSharedPixmapProcPtr SyncSharedPixmap; 6521b5d61b8Smrg 6531b5d61b8Smrg SharedPixmapNotifyDamageProcPtr SharedPixmapNotifyDamage; 6541b5d61b8Smrg RequestSharedPixmapNotifyDamageProcPtr RequestSharedPixmapNotifyDamage; 6551b5d61b8Smrg PresentSharedPixmapProcPtr PresentSharedPixmap; 6561b5d61b8Smrg StopFlippingPixmapTrackingProcPtr StopFlippingPixmapTracking; 65735c4bbdfSmrg 65835c4bbdfSmrg struct xorg_list pixmap_dirty_list; 65935c4bbdfSmrg 66035c4bbdfSmrg ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap; 66135c4bbdfSmrg XYToWindowProcPtr XYToWindow; 6621b5d61b8Smrg DPMSProcPtr DPMS; 66305b261ecSmrg} ScreenRec; 66405b261ecSmrg 66535c4bbdfSmrgstatic inline RegionPtr 66635c4bbdfSmrgBitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) 66735c4bbdfSmrg{ 66835c4bbdfSmrg return (*(_pScreen)->BitmapToRegion) (pPix); /* no mi version?! */ 6696747b715Smrg} 6706747b715Smrg 67105b261ecSmrgtypedef struct _ScreenInfo { 67235c4bbdfSmrg int imageByteOrder; 67335c4bbdfSmrg int bitmapScanlineUnit; 67435c4bbdfSmrg int bitmapScanlinePad; 67535c4bbdfSmrg int bitmapBitOrder; 67635c4bbdfSmrg int numPixmapFormats; 67735c4bbdfSmrg PixmapFormatRec formats[MAXFORMATS]; 67835c4bbdfSmrg int numScreens; 67935c4bbdfSmrg ScreenPtr screens[MAXSCREENS]; 68035c4bbdfSmrg int numGPUScreens; 68135c4bbdfSmrg ScreenPtr gpuscreens[MAXGPUSCREENS]; 68235c4bbdfSmrg int x; /* origin */ 68335c4bbdfSmrg int y; /* origin */ 68435c4bbdfSmrg int width; /* total width of all screens together */ 68535c4bbdfSmrg int height; /* total height of all screens together */ 68605b261ecSmrg} ScreenInfo; 68705b261ecSmrg 6886747b715Smrgextern _X_EXPORT ScreenInfo screenInfo; 68905b261ecSmrg 69035c4bbdfSmrgextern _X_EXPORT void InitOutput(ScreenInfo * /*pScreenInfo */ , 69135c4bbdfSmrg int /*argc */ , 69235c4bbdfSmrg char ** /*argv */ ); 69305b261ecSmrg 69435c4bbdfSmrg#endif /* SCREENINTSTRUCT_H */ 695