1 /************************************************************ 2 3 Copyright 1996 by Thomas E. Dickey <dickey@clark.net> 4 5 All Rights Reserved 6 7 Permission to use, copy, modify, and distribute this software and its 8 documentation for any purpose and without fee is hereby granted, 9 provided that the above copyright notice appear in all copies and that 10 both that copyright notice and this permission notice appear in 11 supporting documentation, and that the name of the above listed 12 copyright holder(s) not be used in advertising or publicity pertaining 13 to distribution of the software without specific, written prior 14 permission. 15 16 THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD 17 TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 18 AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE 19 LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 23 24 ********************************************************/ 25 26 /******************************************************************** 27 * Interface of 'exevents.c' 28 */ 29 30 #ifndef EXEVENTS_H 31 #define EXEVENTS_H 32 33 #include <X11/extensions/XIproto.h> 34 #include "inputstr.h" 35 36 /*************************************************************** 37 * Interface available to drivers * 38 ***************************************************************/ 39 40 /** 41 * Scroll flags for ::SetScrollValuator. 42 */ 43 enum ScrollFlags { 44 SCROLL_FLAG_NONE = 0, 45 /** 46 * Do not emulate legacy button events for valuator events on this axis. 47 */ 48 SCROLL_FLAG_DONT_EMULATE = (1 << 1), 49 /** 50 * This axis is the preferred axis for valuator emulation for this axis' 51 * scroll type. 52 */ 53 SCROLL_FLAG_PREFERRED = (1 << 2) 54 }; 55 56 extern _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr /* dev */ ); 57 58 extern _X_EXPORT Bool InitValuatorAxisStruct(DeviceIntPtr /* dev */ , 59 int /* axnum */ , 60 Atom /* label */ , 61 int /* minval */ , 62 int /* maxval */ , 63 int /* resolution */ , 64 int /* min_res */ , 65 int /* max_res */ , 66 int /* mode */ ); 67 68 extern _X_EXPORT Bool SetScrollValuator(DeviceIntPtr /* dev */ , 69 int /* axnum */ , 70 enum ScrollType /* type */ , 71 double /* increment */ , 72 int /* flags */ ); 73 74 /* Input device properties */ 75 extern _X_EXPORT void XIDeleteAllDeviceProperties(DeviceIntPtr /* device */ 76 ); 77 78 extern _X_EXPORT int XIDeleteDeviceProperty(DeviceIntPtr /* device */ , 79 Atom /* property */ , 80 Bool /* fromClient */ 81 ); 82 83 extern _X_EXPORT int XIChangeDeviceProperty(DeviceIntPtr /* dev */ , 84 Atom /* property */ , 85 Atom /* type */ , 86 int /* format */ , 87 int /* mode */ , 88 unsigned long /* len */ , 89 const void * /* value */ , 90 Bool /* sendevent */ 91 ); 92 93 extern _X_EXPORT int XIGetDeviceProperty(DeviceIntPtr /* dev */ , 94 Atom /* property */ , 95 XIPropertyValuePtr * /* value */ 96 ); 97 98 extern _X_EXPORT int XISetDevicePropertyDeletable(DeviceIntPtr /* dev */ , 99 Atom /* property */ , 100 Bool /* deletable */ 101 ); 102 103 extern _X_EXPORT long XIRegisterPropertyHandler(DeviceIntPtr dev, 104 int (*SetProperty) (DeviceIntPtr 105 dev, 106 Atom 107 property, 108 XIPropertyValuePtr 109 prop, 110 BOOL 111 checkonly), 112 int (*GetProperty) (DeviceIntPtr 113 dev, 114 Atom 115 property), 116 int (*DeleteProperty) 117 (DeviceIntPtr dev, 118 Atom property) 119 ); 120 121 extern _X_EXPORT void XIUnregisterPropertyHandler(DeviceIntPtr dev, long id); 122 123 extern _X_EXPORT Atom XIGetKnownProperty(const char *name); 124 125 extern _X_EXPORT DeviceIntPtr XIGetDevice(xEvent *ev); 126 127 extern _X_EXPORT int XIPropToInt(XIPropertyValuePtr val, 128 int *nelem_return, int **buf_return); 129 130 extern _X_EXPORT int XIPropToFloat(XIPropertyValuePtr val, 131 int *nelem_return, float **buf_return); 132 133 /**************************************************************************** 134 * End of driver interface * 135 ****************************************************************************/ 136 137 /** 138 * Attached to the devPrivates of each client. Specifies the version number as 139 * supported by the client. 140 */ 141 typedef struct _XIClientRec { 142 int major_version; 143 int minor_version; 144 } XIClientRec, *XIClientPtr; 145 146 typedef struct _GrabParameters { 147 int grabtype; /* CORE, etc. */ 148 unsigned int ownerEvents; 149 unsigned int this_device_mode; 150 unsigned int other_devices_mode; 151 Window grabWindow; 152 Window confineTo; 153 Cursor cursor; 154 unsigned int modifiers; 155 } GrabParameters; 156 157 extern int 158 UpdateDeviceState(DeviceIntPtr /* device */ , 159 DeviceEvent * /* xE */ ); 160 161 extern void 162 ProcessOtherEvent(InternalEvent * /* ev */ , 163 DeviceIntPtr /* other */ ); 164 165 extern int 166 CheckGrabValues(ClientPtr /* client */ , 167 GrabParameters * /* param */ ); 168 169 extern int 170 GrabButton(ClientPtr /* client */ , 171 DeviceIntPtr /* dev */ , 172 DeviceIntPtr /* modifier_device */ , 173 int /* button */ , 174 GrabParameters * /* param */ , 175 enum InputLevel /* grabtype */ , 176 GrabMask * /* eventMask */ ); 177 178 extern int 179 GrabKey(ClientPtr /* client */ , 180 DeviceIntPtr /* dev */ , 181 DeviceIntPtr /* modifier_device */ , 182 int /* key */ , 183 GrabParameters * /* param */ , 184 enum InputLevel /* grabtype */ , 185 GrabMask * /* eventMask */ ); 186 187 extern int 188 GrabWindow(ClientPtr /* client */ , 189 DeviceIntPtr /* dev */ , 190 int /* type */ , 191 GrabParameters * /* param */ , 192 GrabMask * /* eventMask */ ); 193 194 extern int 195 GrabTouch(ClientPtr /* client */ , 196 DeviceIntPtr /* dev */ , 197 DeviceIntPtr /* mod_dev */ , 198 GrabParameters * /* param */ , 199 GrabMask * /* eventMask */ ); 200 201 extern int 202 SelectForWindow(DeviceIntPtr /* dev */ , 203 WindowPtr /* pWin */ , 204 ClientPtr /* client */ , 205 Mask /* mask */ , 206 Mask /* exclusivemasks */ ); 207 208 extern int 209 AddExtensionClient(WindowPtr /* pWin */ , 210 ClientPtr /* client */ , 211 Mask /* mask */ , 212 int /* mskidx */ ); 213 214 extern void 215 RecalculateDeviceDeliverableEvents(WindowPtr /* pWin */ ); 216 217 extern int 218 InputClientGone(WindowPtr /* pWin */ , 219 XID /* id */ ); 220 221 extern void 222 WindowGone(WindowPtr /* win */ ); 223 224 extern int 225 SendEvent(ClientPtr /* client */ , 226 DeviceIntPtr /* d */ , 227 Window /* dest */ , 228 Bool /* propagate */ , 229 xEvent * /* ev */ , 230 Mask /* mask */ , 231 int /* count */ ); 232 233 extern int 234 SetButtonMapping(ClientPtr /* client */ , 235 DeviceIntPtr /* dev */ , 236 int /* nElts */ , 237 BYTE * /* map */ ); 238 239 extern int 240 ChangeKeyMapping(ClientPtr /* client */ , 241 DeviceIntPtr /* dev */ , 242 unsigned /* len */ , 243 int /* type */ , 244 KeyCode /* firstKeyCode */ , 245 CARD8 /* keyCodes */ , 246 CARD8 /* keySymsPerKeyCode */ , 247 KeySym * /* map */ ); 248 249 extern void 250 DeleteWindowFromAnyExtEvents(WindowPtr /* pWin */ , 251 Bool /* freeResources */ ); 252 253 extern int 254 MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * /* pEvents */ , 255 Mask /* mask */ ); 256 257 extern void 258 CheckDeviceGrabAndHintWindow(WindowPtr /* pWin */ , 259 int /* type */ , 260 deviceKeyButtonPointer * /* xE */ , 261 GrabPtr /* grab */ , 262 ClientPtr /* client */ , 263 Mask /* deliveryMask */ ); 264 265 extern void 266 MaybeStopDeviceHint(DeviceIntPtr /* dev */ , 267 ClientPtr /* client */ ); 268 269 extern int 270 DeviceEventSuppressForWindow(WindowPtr /* pWin */ , 271 ClientPtr /* client */ , 272 Mask /* mask */ , 273 int /* maskndx */ ); 274 275 extern void 276 SendEventToAllWindows(DeviceIntPtr /* dev */ , 277 Mask /* mask */ , 278 xEvent * /* ev */ , 279 int /* count */ ); 280 281 extern void 282 TouchRejected(DeviceIntPtr /* sourcedev */ , 283 TouchPointInfoPtr /* ti */ , 284 XID /* resource */ , 285 TouchOwnershipEvent * /* ev */ ); 286 287 extern _X_HIDDEN void XI2EventSwap(xGenericEvent * /* from */ , 288 xGenericEvent * /* to */ ); 289 290 /* For an event such as MappingNotify which affects client interpretation 291 * of input events sent by device dev, should we notify the client, or 292 * would it merely be irrelevant and confusing? */ 293 extern int 294 XIShouldNotify(ClientPtr client, DeviceIntPtr dev); 295 296 extern void 297 XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce); 298 299 extern int 300 301 XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, 302 unsigned int len, unsigned char *mask); 303 304 extern int 305 XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len); 306 307 #endif /* EXEVENTS_H */ 308