darwin.h revision 4642e01f
1/*
2 * Copyright (C) 2008 Apple, Inc.
3 * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Except as contained in this notice, the name(s) of the above copyright
24 * holders shall not be used in advertising or otherwise to promote the sale,
25 * use or other dealings in this Software without prior written authorization.
26 */
27
28#ifndef _DARWIN_H
29#define _DARWIN_H
30
31#include <IOKit/IOTypes.h>
32#include "inputstr.h"
33#include "scrnintstr.h"
34#include <X11/extensions/XKB.h>
35#include <assert.h>
36
37#include "threadSafety.h"
38
39typedef struct {
40    void                *framebuffer;
41    int                 x;
42    int                 y;
43    int                 width;
44    int                 height;
45    int                 pitch;
46    int                 depth;
47    int                 visuals;
48    int                 bitsPerRGB;
49    int                 bitsPerPixel;
50    int                 preferredCVC;
51    Pixel               redMask;
52    Pixel               greenMask;
53    Pixel               blueMask;
54} DarwinFramebufferRec, *DarwinFramebufferPtr;
55
56// From darwin.c
57void DarwinPrintBanner(void);
58int DarwinParseModifierList(const char *constmodifiers, int separatelr);
59void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
60void xf86SetRootClip (ScreenPtr pScreen, int enable);
61
62#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
63    dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
64
65/*
66 * Global variables from darwin.c
67 */
68extern DevPrivateKey    darwinScreenKey; // index into pScreen.devPrivates
69extern int              darwinScreensFound;
70extern io_connect_t     darwinParamConnect;
71extern int              darwinEventReadFD;
72extern int              darwinEventWriteFD;
73extern DeviceIntPtr     darwinPointer;
74extern DeviceIntPtr     darwinTabletCurrent;
75extern DeviceIntPtr     darwinTabletCursor;
76extern DeviceIntPtr     darwinTabletStylus;
77extern DeviceIntPtr     darwinTabletEraser;
78extern DeviceIntPtr     darwinKeyboard;
79
80// User preferences
81extern int              darwinMouseAccelChange;
82extern int              darwinFakeButtons;
83extern int              darwinFakeMouse2Mask;
84extern int              darwinFakeMouse3Mask;
85extern unsigned int     darwinAppKitModMask;
86extern unsigned int     windowItemModMask;
87extern int              darwinSyncKeymap;
88extern unsigned int     darwinDesiredWidth, darwinDesiredHeight;
89extern int              darwinDesiredDepth;
90extern int              darwinDesiredRefresh;
91
92// location of X11's (0,0) point in global screen coordinates
93extern int              darwinMainScreenX;
94extern int              darwinMainScreenY;
95
96#define ENABLE_DEBUG_LOG 1
97
98#ifdef ENABLE_DEBUG_LOG
99extern FILE *debug_log_fp;
100#define DEBUG_LOG_NAME "x11-debug.txt"
101#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
102#else
103#define DEBUG_LOG(msg, args...)
104#endif
105
106#define TRACE() DEBUG_LOG("\n")
107
108#endif  /* _DARWIN_H */
109