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
39#include "darwinfb.h"
40
41// From darwin.c
42void DarwinPrintBanner(void);
43int DarwinParseModifierList(const char *constmodifiers, int separatelr);
44void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
45void xf86SetRootClip (ScreenPtr pScreen, int enable);
46
47#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
48    dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
49
50/*
51 * Global variables from darwin.c
52 */
53extern DevPrivateKeyRec darwinScreenKeyRec;
54#define darwinScreenKey (&darwinScreenKeyRec)
55extern int              darwinScreensFound;
56extern io_connect_t     darwinParamConnect;
57extern int              darwinEventReadFD;
58extern int              darwinEventWriteFD;
59extern DeviceIntPtr     darwinPointer;
60extern DeviceIntPtr     darwinTabletCurrent;
61extern DeviceIntPtr     darwinTabletCursor;
62extern DeviceIntPtr     darwinTabletStylus;
63extern DeviceIntPtr     darwinTabletEraser;
64extern DeviceIntPtr     darwinKeyboard;
65
66// User preferences
67extern int              darwinMouseAccelChange;
68extern int              darwinFakeButtons;
69extern int              darwinFakeMouse2Mask;
70extern int              darwinFakeMouse3Mask;
71extern unsigned int     darwinAppKitModMask;
72extern unsigned int     windowItemModMask;
73extern int              darwinSyncKeymap;
74extern int              darwinDesiredDepth;
75
76// location of X11's (0,0) point in global screen coordinates
77extern int              darwinMainScreenX;
78extern int              darwinMainScreenY;
79
80#define ENABLE_DEBUG_LOG 1
81
82#ifdef ENABLE_DEBUG_LOG
83extern FILE *debug_log_fp;
84#define DEBUG_LOG_NAME "x11-debug.txt"
85#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);
86#else
87#define DEBUG_LOG(msg, args...)
88#endif
89
90#define TRACE() DEBUG_LOG("\n")
91
92#endif  /* _DARWIN_H */
93