xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/darwin.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2008-2012 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 <asl.h>
36 
37 #include "darwinfb.h"
38 
39 // From darwin.c
40 void
41 DarwinPrintBanner(void);
42 int
43 DarwinParseModifierList(const char *constmodifiers, int separatelr);
44 void
45 DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
46 
47 #define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
48                               dixLookupPrivate(&pScreen->devPrivates, \
49                                                darwinScreenKey))
50 
51 /*
52  * Global variables from darwin.c
53  */
54 extern DevPrivateKeyRec darwinScreenKeyRec;
55 #define darwinScreenKey (&darwinScreenKeyRec)
56 extern int darwinScreensFound;
57 extern io_connect_t darwinParamConnect;
58 extern int darwinEventReadFD;
59 extern int darwinEventWriteFD;
60 extern DeviceIntPtr darwinPointer;
61 extern DeviceIntPtr darwinTabletCursor;
62 extern DeviceIntPtr darwinTabletStylus;
63 extern DeviceIntPtr darwinTabletEraser;
64 extern DeviceIntPtr darwinKeyboard;
65 
66 // User preferences
67 extern int darwinMouseAccelChange;
68 extern int darwinFakeButtons;
69 extern int darwinFakeMouse2Mask;
70 extern int darwinFakeMouse3Mask;
71 extern unsigned int darwinAppKitModMask;
72 extern unsigned int windowItemModMask;
73 extern int darwinSyncKeymap;
74 extern int darwinDesiredDepth;
75 
76 // location of X11's (0,0) point in global screen coordinates
77 extern int darwinMainScreenX;
78 extern int darwinMainScreenY;
79 
80 // bundle-main.c
81 extern char *bundle_id_prefix;
82 
83 _X_ATTRIBUTE_PRINTF(6, 7)
84 extern void
85 xq_asl_log(int level, const char *subsystem, const char *file,
86            const char *function, int line, const char *fmt,
87            ...);
88 
89 #define ASL_LOG(level, subsystem, msg, args ...) xq_asl_log(level, subsystem, \
90                                                             __FILE__, \
91                                                             __FUNCTION__, \
92                                                             __LINE__, msg, \
93                                                             ## args)
94 #define DEBUG_LOG(msg, args ...)                 ASL_LOG(ASL_LEVEL_DEBUG, \
95                                                          "XQuartz", msg, \
96                                                          ## args)
97 #define TRACE()                                  DEBUG_LOG("TRACE")
98 
99 #endif  /* _DARWIN_H */
100