xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/quartzRandR.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * quartzRandR.h
3  *
4  * Copyright (c) 2010 Jan Hauffa.
5  *               2010-2012 Apple Inc.
6  *                 All Rights Reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  *
26  * Except as contained in this notice, the name(s) of the above copyright
27  * holders shall not be used in advertising or otherwise to promote the sale,
28  * use or other dealings in this Software without prior written authorization.
29  */
30 
31 #ifndef _QUARTZRANDR_H_
32 #define _QUARTZRANDR_H_
33 
34 #include "randrstr.h"
35 
36 typedef struct {
37     size_t width, height;
38     int refresh;
39     RRScreenSizePtr pSize;
40     void *ref; /* CGDisplayModeRef or CFDictionaryRef */
41 } QuartzModeInfo, *QuartzModeInfoPtr;
42 
43 // Quartz specific per screen storage structure
44 typedef struct {
45     // List of CoreGraphics displays that this X11 screen covers.
46     // This is more than one CG display for video mirroring and
47     // rootless PseudoramiX mode.
48     // No CG display will be covered by more than one X11 screen.
49     int displayCount;
50     CGDirectDisplayID *displayIDs;
51     QuartzModeInfo rootlessMode, fullscreenMode, currentMode;
52 } QuartzScreenRec, *QuartzScreenPtr;
53 
54 #define QUARTZ_PRIV(pScreen) \
55     ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
56 
57 void
58 QuartzCopyDisplayIDs(ScreenPtr pScreen, int displayCount,
59                      CGDirectDisplayID *displayIDs);
60 
61 Bool
62 QuartzRandRUpdateFakeModes(BOOL force_update);
63 Bool
64 QuartzRandRInit(ScreenPtr pScreen);
65 
66 /* These two functions provide functionality expected by the legacy
67  * mode switching.  They are equivalent to a client requesting one
68  * of the modes corresponding to these "fake" modes.
69  * QuartzRandRSetFakeFullscreen takes an argument which is used to determine
70  * the visibility of the windows after the change.
71  */
72 void
73 QuartzRandRSetFakeRootless(void);
74 void
75 QuartzRandRSetFakeFullscreen(BOOL state);
76 
77 /* Toggle fullscreen mode.  If "fake" fullscreen is the current mode,
78  * this will just show/hide the X11 windows.  If we are in a RandR fullscreen
79  * mode, this will toggles us to the default fake mode and hide windows if
80  * it is fullscreen
81  */
82 void
83 QuartzRandRToggleFullscreen(void);
84 
85 #endif
86