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 | #include <assert.h>
|
---|
35 |
|
---|
36 | typedef struct {
|
---|
37 | void *framebuffer;
|
---|
38 | int x;
|
---|
39 | int y;
|
---|
40 | int width;
|
---|
41 | int height;
|
---|
42 | int pitch;
|
---|
43 | int colorType;
|
---|
44 | int bitsPerPixel;
|
---|
45 | int colorBitsPerPixel;
|
---|
46 | int bitsPerComponent;
|
---|
47 | } DarwinFramebufferRec, *DarwinFramebufferPtr;
|
---|
48 |
|
---|
49 |
|
---|
50 | // From darwin.c
|
---|
51 | void DarwinPrintBanner();
|
---|
52 | int DarwinParseModifierList(const char *constmodifiers);
|
---|
53 | void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
|
---|
54 | void xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
|
---|
55 |
|
---|
56 | // From darwinEvents.c
|
---|
57 | Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
|
---|
58 | void DarwinEQEnqueue(const xEvent *e);
|
---|
59 | void DarwinEQPointerPost(xEvent *e);
|
---|
60 | void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
---|
61 | void DarwinPokeEQ(void);
|
---|
62 | void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
|
---|
63 | void DarwinSendKeyboardEvents(int ev_type, int keycode);
|
---|
64 | void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
|
---|
65 |
|
---|
66 | // From darwinKeyboard.c
|
---|
67 | int DarwinModifierNXKeyToNXKeycode(int key, int side);
|
---|
68 | void DarwinKeyboardInit(DeviceIntPtr pDev);
|
---|
69 | int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
|
---|
70 | int DarwinModifierNXKeyToNXMask(int key);
|
---|
71 | int DarwinModifierNXMaskToNXKey(int mask);
|
---|
72 | int DarwinModifierStringToNXKey(const char *string);
|
---|
73 |
|
---|
74 | // Mode specific functions
|
---|
75 | Bool DarwinModeAddScreen(int index, ScreenPtr pScreen);
|
---|
76 | Bool DarwinModeSetupScreen(int index, ScreenPtr pScreen);
|
---|
77 | void DarwinModeInitOutput(int argc,char **argv);
|
---|
78 | void DarwinModeInitInput(int argc, char **argv);
|
---|
79 | int DarwinModeProcessArgument(int argc, char *argv[], int i);
|
---|
80 | void DarwinModeProcessEvent(xEvent *xe);
|
---|
81 | void DarwinModeGiveUp(void);
|
---|
82 | void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
|
---|
83 |
|
---|
84 |
|
---|
85 | #undef assert
|
---|
86 | #define assert(x) { if ((x) == 0) \
|
---|
87 | FatalError("assert failed on line %d of %s!\n", __LINE__, __FILE__); }
|
---|
88 | #define kern_assert(x) { if ((x) != KERN_SUCCESS) \
|
---|
89 | FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \
|
---|
90 | __LINE__, __FILE__, x); }
|
---|
91 | #define SCREEN_PRIV(pScreen) \
|
---|
92 | ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
|
---|
93 |
|
---|
94 |
|
---|
95 | #define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
|
---|
96 |
|
---|
97 |
|
---|
98 | /*
|
---|
99 | * Global variables from darwin.c
|
---|
100 | */
|
---|
101 | extern int darwinScreenIndex; // index into pScreen.devPrivates
|
---|
102 | extern int darwinScreensFound;
|
---|
103 | extern io_connect_t darwinParamConnect;
|
---|
104 | extern int darwinEventReadFD;
|
---|
105 | extern int darwinEventWriteFD;
|
---|
106 | extern DeviceIntPtr darwinPointer;
|
---|
107 | extern DeviceIntPtr darwinKeyboard;
|
---|
108 |
|
---|
109 | // User preferences
|
---|
110 | extern int darwinMouseAccelChange;
|
---|
111 | extern int darwinFakeButtons;
|
---|
112 | extern int darwinFakeMouse2Mask;
|
---|
113 | extern int darwinFakeMouse3Mask;
|
---|
114 | extern int darwinSwapAltMeta;
|
---|
115 | extern char *darwinKeymapFile;
|
---|
116 | extern int darwinSyncKeymap;
|
---|
117 | extern unsigned int darwinDesiredWidth, darwinDesiredHeight;
|
---|
118 | extern int darwinDesiredDepth;
|
---|
119 | extern int darwinDesiredRefresh;
|
---|
120 |
|
---|
121 | // location of X11's (0,0) point in global screen coordinates
|
---|
122 | extern int darwinMainScreenX;
|
---|
123 | extern int darwinMainScreenY;
|
---|
124 |
|
---|
125 |
|
---|
126 | /*
|
---|
127 | * Special ddx events understood by the X server
|
---|
128 | */
|
---|
129 | enum {
|
---|
130 | kXDarwinUpdateModifiers // update all modifier keys
|
---|
131 | = LASTEvent+1, // (from X.h list of event names)
|
---|
132 | kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
|
---|
133 | kXDarwinScrollWheel, // scroll wheel event
|
---|
134 |
|
---|
135 | /*
|
---|
136 | * Quartz-specific events -- not used in IOKit mode
|
---|
137 | */
|
---|
138 | kXDarwinActivate, // restore X drawing and cursor
|
---|
139 | kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor
|
---|
140 | kXDarwinSetRootClip, // enable or disable drawing to the X screen
|
---|
141 | kXDarwinQuit, // kill the X server and release the display
|
---|
142 | kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
|
---|
143 | kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
|
---|
144 | /*
|
---|
145 | * AppleWM events
|
---|
146 | */
|
---|
147 | kXDarwinControllerNotify, // send an AppleWMControllerNotify event
|
---|
148 | kXDarwinPasteboardNotify, // notify the WM to copy or paste
|
---|
149 | /*
|
---|
150 | * Xplugin notification events
|
---|
151 | */
|
---|
152 | kXDarwinDisplayChanged, // display configuration has changed
|
---|
153 | kXDarwinWindowState, // window visibility state has changed
|
---|
154 | kXDarwinWindowMoved // window has moved on screen
|
---|
155 | };
|
---|
156 |
|
---|
157 | #endif /* _DARWIN_H */
|
---|