1706f2543Smrg/*
2706f2543Smrg * quartzRandR.h
3706f2543Smrg *
4706f2543Smrg * Copyright (c) 2010 Jan Hauffa.
5706f2543Smrg *               2010 Apple Inc.
6706f2543Smrg *                 All Rights Reserved.
7706f2543Smrg *
8706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
9706f2543Smrg * copy of this software and associated documentation files (the "Software"),
10706f2543Smrg * to deal in the Software without restriction, including without limitation
11706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
13706f2543Smrg * Software is furnished to do so, subject to the following conditions:
14706f2543Smrg *
15706f2543Smrg * The above copyright notice and this permission notice shall be included in
16706f2543Smrg * all copies or substantial portions of the Software.
17706f2543Smrg *
18706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19706f2543Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21706f2543Smrg * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22706f2543Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23706f2543Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24706f2543Smrg * DEALINGS IN THE SOFTWARE.
25706f2543Smrg *
26706f2543Smrg * Except as contained in this notice, the name(s) of the above copyright
27706f2543Smrg * holders shall not be used in advertising or otherwise to promote the sale,
28706f2543Smrg * use or other dealings in this Software without prior written authorization.
29706f2543Smrg */
30706f2543Smrg
31706f2543Smrg#ifndef _QUARTZRANDR_H_
32706f2543Smrg#define _QUARTZRANDR_H_
33706f2543Smrg
34706f2543Smrg#include "randrstr.h"
35706f2543Smrg
36706f2543Smrgtypedef struct {
37706f2543Smrg    size_t width, height;
38706f2543Smrg    int refresh;
39706f2543Smrg    RRScreenSizePtr pSize;
40706f2543Smrg    void *ref; /* CGDisplayModeRef or CFDictionaryRef */
41706f2543Smrg} QuartzModeInfo, *QuartzModeInfoPtr;
42706f2543Smrg
43706f2543Smrg// Quartz specific per screen storage structure
44706f2543Smrgtypedef struct {
45706f2543Smrg    // List of CoreGraphics displays that this X11 screen covers.
46706f2543Smrg    // This is more than one CG display for video mirroring and
47706f2543Smrg    // rootless PseudoramiX mode.
48706f2543Smrg    // No CG display will be covered by more than one X11 screen.
49706f2543Smrg    int displayCount;
50706f2543Smrg    CGDirectDisplayID *displayIDs;
51706f2543Smrg    QuartzModeInfo rootlessMode, fullscreenMode, currentMode;
52706f2543Smrg} QuartzScreenRec, *QuartzScreenPtr;
53706f2543Smrg
54706f2543Smrg#define QUARTZ_PRIV(pScreen) \
55706f2543Smrg    ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
56706f2543Smrg
57706f2543Smrgvoid QuartzCopyDisplayIDs(ScreenPtr pScreen,
58706f2543Smrg                          int displayCount, CGDirectDisplayID *displayIDs);
59706f2543Smrg
60706f2543SmrgBool QuartzRandRUpdateFakeModes (BOOL force_update);
61706f2543SmrgBool QuartzRandRInit (ScreenPtr pScreen);
62706f2543Smrg
63706f2543Smrg/* These two functions provide functionality expected by the legacy
64706f2543Smrg * mode switching.  They are equivalent to a client requesting one
65706f2543Smrg * of the modes corresponding to these "fake" modes.
66706f2543Smrg * QuartzRandRSetFakeFullscreen takes an argument which is used to determine
67706f2543Smrg * the visibility of the windows after the change.
68706f2543Smrg */
69706f2543Smrgvoid QuartzRandRSetFakeRootless (void);
70706f2543Smrgvoid QuartzRandRSetFakeFullscreen (BOOL state);
71706f2543Smrg
72706f2543Smrg
73706f2543Smrg/* Toggle fullscreen mode.  If "fake" fullscreen is the current mode,
74706f2543Smrg * this will just show/hide the X11 windows.  If we are in a RandR fullscreen
75706f2543Smrg * mode, this will toggles us to the default fake mode and hide windows if
76706f2543Smrg * it is fullscreen
77706f2543Smrg */
78706f2543Smrgvoid QuartzRandRToggleFullscreen (void);
79706f2543Smrg
80706f2543Smrg#endif
81