1/*
2 * quartzRandR.h
3 *
4 * Copyright (c) 2010 Jan Hauffa.
5 *               2010 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
36typedef 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
44typedef 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
57void QuartzCopyDisplayIDs(ScreenPtr pScreen,
58                          int displayCount, CGDirectDisplayID *displayIDs);
59
60Bool QuartzRandRUpdateFakeModes (BOOL force_update);
61Bool QuartzRandRInit (ScreenPtr pScreen);
62
63/* These two functions provide functionality expected by the legacy
64 * mode switching.  They are equivalent to a client requesting one
65 * of the modes corresponding to these "fake" modes.
66 * QuartzRandRSetFakeFullscreen takes an argument which is used to determine
67 * the visibility of the windows after the change.
68 */
69void QuartzRandRSetFakeRootless (void);
70void QuartzRandRSetFakeFullscreen (BOOL state);
71
72
73/* Toggle fullscreen mode.  If "fake" fullscreen is the current mode,
74 * this will just show/hide the X11 windows.  If we are in a RandR fullscreen
75 * mode, this will toggles us to the default fake mode and hide windows if
76 * it is fullscreen
77 */
78void QuartzRandRToggleFullscreen (void);
79
80#endif
81