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