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_EVENTS_H
29#define _DARWIN_EVENTS_H
30
31/* For extra precision of our cursor and other valuators */
32#define XQUARTZ_VALUATOR_LIMIT (1 << 16)
33
34Bool
35DarwinEQInit(void);
36void
37DarwinEQFini(void);
38void
39DarwinEQEnqueue(const xEventPtr e);
40void
41DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
42void
43DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
44void
45DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev);
46void
47DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
48                       double pointer_x, double pointer_y, double pressure,
49                       double tilt_x, double tilt_y);
50void
51DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
52                        double pointer_x, double pointer_y,
53                        double pointer_dx, double pointer_dy);
54void
55DarwinSendKeyboardEvents(int ev_type, int keycode);
56void
57DarwinSendScrollEvents(double scroll_x, double scroll_y);
58void
59DarwinUpdateModKeys(int flags);
60void
61DarwinListenOnOpenFD(int fd);
62
63/*
64 * Subtypes for the ET_XQuartz event type
65 */
66enum {
67    kXquartzReloadKeymap,     // Reload system keymap
68    kXquartzActivate,         // restore X drawing and cursor
69    kXquartzDeactivate,       // clip X drawing and switch to Aqua cursor
70    kXquartzSetRootClip,      // enable or disable drawing to the X screen
71    kXquartzQuit,             // kill the X server and release the display
72    kXquartzBringAllToFront,  // bring all X windows to front
73    kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
74    kXquartzSetRootless,      // Set rootless mode
75    kXquartzSpaceChanged,     // Spaces changed
76    kXquartzListenOnOpenFD,   // Listen to the launchd fd (passed as arg)
77    /*
78     * AppleWM events
79     */
80    kXquartzControllerNotify, // send an AppleWMControllerNotify event
81    kXquartzPasteboardNotify, // notify the WM to copy or paste
82    kXquartzReloadPreferences, // send AppleWMReloadPreferences
83    /*
84     * Xplugin notification events
85     */
86    kXquartzDisplayChanged,   // display configuration has changed
87    kXquartzWindowState,      // window visibility state has changed
88    kXquartzWindowMoved,      // window has moved on screen
89};
90
91/* Send one of the above events to the server thread. */
92void
93DarwinSendDDXEvent(int type, int argc, ...);
94
95/* A mask of the modifiers that are in our X11 keyboard layout:
96 * (Fn for example is just useful for 3button mouse emulation) */
97extern int darwin_all_modifier_mask;
98
99/* A mask of the modifiers that are in our X11 keyboard layout:
100 * (Fn for example is just useful for 3button mouse emulation) */
101extern int darwin_x11_modifier_mask;
102
103/* The current state of the above listed modifiers */
104extern int darwin_all_modifier_flags;
105
106#endif  /* _DARWIN_EVENTS_H */
107