1 | /*
|
---|
2 | * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
5 | * copy of this software and associated documentation files (the "Software"),
|
---|
6 | * to deal in the Software without restriction, including without limitation
|
---|
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
8 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
9 | * Software is furnished to do so, subject to the following conditions:
|
---|
10 | *
|
---|
11 | * The above copyright notice and this permission notice shall be included in
|
---|
12 | * all copies or substantial portions of the Software.
|
---|
13 | *
|
---|
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
17 | * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
---|
20 | * DEALINGS IN THE SOFTWARE.
|
---|
21 | *
|
---|
22 | * Except as contained in this notice, the name(s) of the above copyright
|
---|
23 | * holders shall not be used in advertising or otherwise to promote the sale,
|
---|
24 | * use or other dealings in this Software without prior written authorization.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef _DARWIN_H
|
---|
28 | #define _DARWIN_H
|
---|
29 |
|
---|
30 | #include <IOKit/IOTypes.h>
|
---|
31 | #include "inputstr.h"
|
---|
32 | #include "scrnintstr.h"
|
---|
33 | #include <X11/extensions/XKB.h>
|
---|
34 |
|
---|
35 | typedef struct {
|
---|
36 | void *framebuffer;
|
---|
37 | int x;
|
---|
38 | int y;
|
---|
39 | int width;
|
---|
40 | int height;
|
---|
41 | int pitch;
|
---|
42 | int colorType;
|
---|
43 | int bitsPerPixel;
|
---|
44 | int colorBitsPerPixel;
|
---|
45 | int bitsPerComponent;
|
---|
46 | } DarwinFramebufferRec, *DarwinFramebufferPtr;
|
---|
47 |
|
---|
48 |
|
---|
49 | // From darwin.c
|
---|
50 | void DarwinPrintBanner();
|
---|
51 | int DarwinParseModifierList(const char *constmodifiers);
|
---|
52 | void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
|
---|
53 | void xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
|
---|
54 |
|
---|
55 | // From darwinEvents.c
|
---|
56 | Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
|
---|
57 | void DarwinEQEnqueue(const xEvent *e);
|
---|
58 | void DarwinEQPointerPost(xEvent *e);
|
---|
59 | void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
---|
60 |
|
---|
61 | // From darwinKeyboard.c
|
---|
62 | int DarwinModifierNXKeyToNXKeycode(int key, int side);
|
---|
63 | void DarwinKeyboardInit(DeviceIntPtr pDev);
|
---|
64 | int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
|
---|
65 | int DarwinModifierNXKeyToNXMask(int key);
|
---|
66 | int DarwinModifierNXMaskToNXKey(int mask);
|
---|
67 | int DarwinModifierStringToNXKey(const char *string);
|
---|
68 |
|
---|
69 | // Mode specific functions
|
---|
70 | Bool DarwinModeAddScreen(int index, ScreenPtr pScreen);
|
---|
71 | Bool DarwinModeSetupScreen(int index, ScreenPtr pScreen);
|
---|
72 | void DarwinModeInitOutput(int argc,char **argv);
|
---|
73 | void DarwinModeInitInput(int argc, char **argv);
|
---|
74 | int DarwinModeProcessArgument(int argc, char *argv[], int i);
|
---|
75 | void DarwinModeProcessEvent(xEvent *xe);
|
---|
76 | void DarwinModeGiveUp(void);
|
---|
77 | void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
|
---|
78 |
|
---|
79 |
|
---|
80 | #undef assert
|
---|
81 | #define assert(x) { if ((x) == 0) \
|
---|
82 | FatalError("assert failed on line %d of %s!\n", __LINE__, __FILE__); }
|
---|
83 | #define kern_assert(x) { if ((x) != KERN_SUCCESS) \
|
---|
84 | FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \
|
---|
85 | __LINE__, __FILE__, x); }
|
---|
86 | #define SCREEN_PRIV(pScreen) \
|
---|
87 | ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
|
---|
88 |
|
---|
89 |
|
---|
90 | #define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
|
---|
91 |
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * Global variables from darwin.c
|
---|
95 | */
|
---|
96 | extern int darwinScreenIndex; // index into pScreen.devPrivates
|
---|
97 | extern int darwinScreensFound;
|
---|
98 | extern io_connect_t darwinParamConnect;
|
---|
99 | extern int darwinEventReadFD;
|
---|
100 | extern int darwinEventWriteFD;
|
---|
101 | extern DeviceIntPtr darwinPointer;
|
---|
102 | extern DeviceIntPtr darwinKeyboard;
|
---|
103 |
|
---|
104 | // User preferences
|
---|
105 | extern int darwinMouseAccelChange;
|
---|
106 | extern int darwinFakeButtons;
|
---|
107 | extern int darwinFakeMouse2Mask;
|
---|
108 | extern int darwinFakeMouse3Mask;
|
---|
109 | extern int darwinSwapAltMeta;
|
---|
110 | extern char *darwinKeymapFile;
|
---|
111 | extern int darwinSyncKeymap;
|
---|
112 | extern unsigned int darwinDesiredWidth, darwinDesiredHeight;
|
---|
113 | extern int darwinDesiredDepth;
|
---|
114 | extern int darwinDesiredRefresh;
|
---|
115 |
|
---|
116 | // location of X11's (0,0) point in global screen coordinates
|
---|
117 | extern int darwinMainScreenX;
|
---|
118 | extern int darwinMainScreenY;
|
---|
119 |
|
---|
120 |
|
---|
121 | /*
|
---|
122 | * Special ddx events understood by the X server
|
---|
123 | */
|
---|
124 | enum {
|
---|
125 | kXDarwinUpdateModifiers // update all modifier keys
|
---|
126 | = LASTEvent+1, // (from X.h list of event names)
|
---|
127 | kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
|
---|
128 | kXDarwinScrollWheel, // scroll wheel event
|
---|
129 |
|
---|
130 | /*
|
---|
131 | * Quartz-specific events -- not used in IOKit mode
|
---|
132 | */
|
---|
133 | kXDarwinActivate, // restore X drawing and cursor
|
---|
134 | kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor
|
---|
135 | kXDarwinSetRootClip, // enable or disable drawing to the X screen
|
---|
136 | kXDarwinQuit, // kill the X server and release the display
|
---|
137 | kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
|
---|
138 | kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
|
---|
139 | /*
|
---|
140 | * AppleWM events
|
---|
141 | */
|
---|
142 | kXDarwinControllerNotify, // send an AppleWMControllerNotify event
|
---|
143 | kXDarwinPasteboardNotify, // notify the WM to copy or paste
|
---|
144 | /*
|
---|
145 | * Xplugin notification events
|
---|
146 | */
|
---|
147 | kXDarwinDisplayChanged, // display configuration has changed
|
---|
148 | kXDarwinWindowState, // window visibility state has changed
|
---|
149 | kXDarwinWindowMoved // window has moved on screen
|
---|
150 | };
|
---|
151 |
|
---|
152 | #endif /* _DARWIN_H */
|
---|