1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (c) 2008 Apple, Inc. 3*4882a593Smuzhiyun * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 6*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 7*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 8*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 10*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 11*4882a593Smuzhiyun * 12*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in 13*4882a593Smuzhiyun * all copies or substantial portions of the Software. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*4882a593Smuzhiyun * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19*4882a593Smuzhiyun * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20*4882a593Smuzhiyun * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21*4882a593Smuzhiyun * DEALINGS IN THE SOFTWARE. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * Except as contained in this notice, the name(s) of the above copyright 24*4882a593Smuzhiyun * holders shall not be used in advertising or otherwise to promote the sale, 25*4882a593Smuzhiyun * use or other dealings in this Software without prior written authorization. 26*4882a593Smuzhiyun */ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun #ifndef _DARWIN_EVENTS_H 29*4882a593Smuzhiyun #define _DARWIN_EVENTS_H 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun /* For extra precision of our cursor and other valuators */ 32*4882a593Smuzhiyun #define XQUARTZ_VALUATOR_LIMIT (1 << 16) 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun Bool 35*4882a593Smuzhiyun DarwinEQInit(void); 36*4882a593Smuzhiyun void 37*4882a593Smuzhiyun DarwinEQFini(void); 38*4882a593Smuzhiyun void 39*4882a593Smuzhiyun DarwinEQEnqueue(const xEventPtr e); 40*4882a593Smuzhiyun void 41*4882a593Smuzhiyun DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e); 42*4882a593Smuzhiyun void 43*4882a593Smuzhiyun DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); 44*4882a593Smuzhiyun void 45*4882a593Smuzhiyun DarwinInputReleaseButtonsAndKeys(DeviceIntPtr pDev); 46*4882a593Smuzhiyun void 47*4882a593Smuzhiyun DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button, 48*4882a593Smuzhiyun double pointer_x, double pointer_y, double pressure, 49*4882a593Smuzhiyun double tilt_x, double tilt_y); 50*4882a593Smuzhiyun void 51*4882a593Smuzhiyun DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, 52*4882a593Smuzhiyun double pointer_x, double pointer_y, 53*4882a593Smuzhiyun double pointer_dx, double pointer_dy); 54*4882a593Smuzhiyun void 55*4882a593Smuzhiyun DarwinSendKeyboardEvents(int ev_type, int keycode); 56*4882a593Smuzhiyun void 57*4882a593Smuzhiyun DarwinSendScrollEvents(double scroll_x, double scroll_y); 58*4882a593Smuzhiyun void 59*4882a593Smuzhiyun DarwinUpdateModKeys(int flags); 60*4882a593Smuzhiyun void 61*4882a593Smuzhiyun DarwinListenOnOpenFD(int fd); 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun /* 64*4882a593Smuzhiyun * Subtypes for the ET_XQuartz event type 65*4882a593Smuzhiyun */ 66*4882a593Smuzhiyun enum { 67*4882a593Smuzhiyun kXquartzReloadKeymap, // Reload system keymap 68*4882a593Smuzhiyun kXquartzActivate, // restore X drawing and cursor 69*4882a593Smuzhiyun kXquartzDeactivate, // clip X drawing and switch to Aqua cursor 70*4882a593Smuzhiyun kXquartzSetRootClip, // enable or disable drawing to the X screen 71*4882a593Smuzhiyun kXquartzQuit, // kill the X server and release the display 72*4882a593Smuzhiyun kXquartzBringAllToFront, // bring all X windows to front 73*4882a593Smuzhiyun kXquartzToggleFullscreen, // Enable/Disable fullscreen mode 74*4882a593Smuzhiyun kXquartzSetRootless, // Set rootless mode 75*4882a593Smuzhiyun kXquartzSpaceChanged, // Spaces changed 76*4882a593Smuzhiyun kXquartzListenOnOpenFD, // Listen to the launchd fd (passed as arg) 77*4882a593Smuzhiyun /* 78*4882a593Smuzhiyun * AppleWM events 79*4882a593Smuzhiyun */ 80*4882a593Smuzhiyun kXquartzControllerNotify, // send an AppleWMControllerNotify event 81*4882a593Smuzhiyun kXquartzPasteboardNotify, // notify the WM to copy or paste 82*4882a593Smuzhiyun kXquartzReloadPreferences, // send AppleWMReloadPreferences 83*4882a593Smuzhiyun /* 84*4882a593Smuzhiyun * Xplugin notification events 85*4882a593Smuzhiyun */ 86*4882a593Smuzhiyun kXquartzDisplayChanged, // display configuration has changed 87*4882a593Smuzhiyun kXquartzWindowState, // window visibility state has changed 88*4882a593Smuzhiyun kXquartzWindowMoved, // window has moved on screen 89*4882a593Smuzhiyun }; 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun /* Send one of the above events to the server thread. */ 92*4882a593Smuzhiyun void 93*4882a593Smuzhiyun DarwinSendDDXEvent(int type, int argc, ...); 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun /* A mask of the modifiers that are in our X11 keyboard layout: 96*4882a593Smuzhiyun * (Fn for example is just useful for 3button mouse emulation) */ 97*4882a593Smuzhiyun extern int darwin_all_modifier_mask; 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun /* A mask of the modifiers that are in our X11 keyboard layout: 100*4882a593Smuzhiyun * (Fn for example is just useful for 3button mouse emulation) */ 101*4882a593Smuzhiyun extern int darwin_x11_modifier_mask; 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun /* The current state of the above listed modifiers */ 104*4882a593Smuzhiyun extern int darwin_all_modifier_flags; 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun #endif /* _DARWIN_EVENTS_H */ 107