]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/include/input.h
Support RDP5 logon packets.
[rdpsrv] / Xserver / programs / Xserver / include / input.h
1 /* $XConsortium: input.h /main/22 1996/09/25 00:50:39 dpw $ */
2 /* $XFree86: xc/programs/Xserver/include/input.h,v 3.4 1996/12/23 07:09:28 dawes Exp $ */
3 /************************************************************
4
5 Copyright (c) 1987  X Consortium
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
27
28
29 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
30
31                         All Rights Reserved
32
33 Permission to use, copy, modify, and distribute this software and its 
34 documentation for any purpose and without fee is hereby granted, 
35 provided that the above copyright notice appear in all copies and that
36 both that copyright notice and this permission notice appear in 
37 supporting documentation, and that the name of Digital not be
38 used in advertising or publicity pertaining to distribution of the
39 software without specific, written prior permission.  
40
41 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
47 SOFTWARE.
48
49 ********************************************************/
50 #ifndef INPUT_H
51 #define INPUT_H
52
53 #include "misc.h"
54 #include "screenint.h"
55 #include "X11/Xmd.h"
56 #include "X11/Xproto.h"
57 #include "window.h"     /* for WindowPtr */
58
59 #define DEVICE_INIT     0
60 #define DEVICE_ON       1
61 #define DEVICE_OFF      2
62 #define DEVICE_CLOSE    3
63
64 #define MAP_LENGTH      256
65 #define DOWN_LENGTH     32      /* 256/8 => number of bytes to hold 256 bits */
66 #define NullGrab ((GrabPtr)NULL)
67 #define PointerRootWin ((WindowPtr)PointerRoot)
68 #define NoneWin ((WindowPtr)None)
69 #define NullDevice ((DevicePtr)NULL)
70
71 #ifndef FollowKeyboard
72 #define FollowKeyboard          3
73 #endif
74 #ifndef FollowKeyboardWin
75 #define FollowKeyboardWin  ((WindowPtr) FollowKeyboard)
76 #endif
77 #ifndef RevertToFollowKeyboard
78 #define RevertToFollowKeyboard  3
79 #endif
80
81 typedef unsigned long Leds;
82 typedef struct _OtherClients *OtherClientsPtr;
83 typedef struct _InputClients *InputClientsPtr;
84 typedef struct _DeviceIntRec *DeviceIntPtr;
85
86 typedef int (*DeviceProc)(
87 #if NeedNestedPrototypes
88     DeviceIntPtr /*device*/,
89     int /*what*/
90 #endif
91 );
92
93 typedef void (*ProcessInputProc)(
94 #if NeedNestedPrototypes
95     xEventPtr /*events*/,
96     DeviceIntPtr /*device*/,
97     int /*count*/
98 #endif
99 );
100
101 typedef struct _DeviceRec {
102     pointer     devicePrivate;
103     ProcessInputProc processInputProc;  /* current */
104     ProcessInputProc realInputProc;     /* deliver */
105     ProcessInputProc enqueueInputProc;  /* enqueue */
106     Bool        on;                     /* used by DDX to keep state */
107 } DeviceRec, *DevicePtr;
108
109 typedef struct {
110     int                 click, bell, bell_pitch, bell_duration;
111     Bool                autoRepeat;
112     unsigned char       autoRepeats[32];
113     Leds                leds;
114     unsigned char       id;
115 } KeybdCtrl;
116
117 typedef struct {
118     KeySym  *map;
119     KeyCode minKeyCode,
120             maxKeyCode;
121     int     mapWidth;
122 } KeySymsRec, *KeySymsPtr;
123
124 typedef struct {
125     int         num, den, threshold;
126     unsigned char id;
127 } PtrCtrl;
128
129 typedef struct {
130     int         resolution, min_value, max_value;
131     int         integer_displayed;
132     unsigned char id;
133 } IntegerCtrl;
134
135 typedef struct {
136     int         max_symbols, num_symbols_supported;
137     int         num_symbols_displayed;
138     KeySym      *symbols_supported;
139     KeySym      *symbols_displayed;
140     unsigned char id;
141 } StringCtrl;
142
143 typedef struct {
144     int         percent, pitch, duration;
145     unsigned char id;
146 } BellCtrl;
147
148 typedef struct {
149     Leds        led_values;
150     Mask        led_mask;
151     unsigned char id;
152 } LedCtrl;
153
154 extern KeybdCtrl        defaultKeyboardControl;
155 extern PtrCtrl          defaultPointerControl;
156
157 #undef  AddInputDevice
158 extern DevicePtr AddInputDevice(
159 #if NeedFunctionPrototypes
160     DeviceProc /*deviceProc*/,
161     Bool /*autoStart*/
162 #endif
163 );
164
165 #define AddInputDevice(deviceProc, autoStart) \
166        _AddInputDevice(deviceProc, autoStart)
167
168 extern DeviceIntPtr _AddInputDevice(
169 #if NeedFunctionPrototypes
170     DeviceProc /*deviceProc*/,
171     Bool /*autoStart*/
172 #endif
173 );
174
175 extern Bool EnableDevice(
176 #if NeedFunctionPrototypes
177     DeviceIntPtr /*device*/
178 #endif
179 );
180
181 extern Bool DisableDevice(
182 #if NeedFunctionPrototypes
183     DeviceIntPtr /*device*/
184 #endif
185 );
186
187 extern int InitAndStartDevices(
188 #if NeedFunctionPrototypes
189     void
190 #endif
191 );
192
193 extern void CloseDownDevices(
194 #if NeedFunctionPrototypes
195     void
196 #endif
197 );
198
199 extern void RemoveDevice(
200 #if NeedFunctionPrototypes
201     DeviceIntPtr /*dev*/
202 #endif
203 );
204
205 extern int NumMotionEvents(
206 #if NeedFunctionPrototypes
207     void
208 #endif
209 );
210
211 #undef  RegisterPointerDevice
212 extern void RegisterPointerDevice(
213 #if NeedFunctionPrototypes
214     DevicePtr /*device*/
215 #endif
216 );
217
218 #define RegisterPointerDevice(device) \
219        _RegisterPointerDevice(device)
220
221 extern void _RegisterPointerDevice(
222 #if NeedFunctionPrototypes
223     DeviceIntPtr /*device*/
224 #endif
225 );
226
227 #undef  RegisterKeyboardDevice
228 extern void RegisterKeyboardDevice(
229 #if NeedFunctionPrototypes
230     DevicePtr /*device*/
231 #endif
232 );
233
234 #define RegisterKeyboardDevice(device) \
235        _RegisterKeyboardDevice(device)
236
237 extern void _RegisterKeyboardDevice(
238 #if NeedFunctionPrototypes
239     DeviceIntPtr /*device*/
240 #endif
241 );
242
243 extern DevicePtr LookupKeyboardDevice(
244 #if NeedFunctionPrototypes
245     void
246 #endif
247 );
248
249 extern DevicePtr LookupPointerDevice(
250 #if NeedFunctionPrototypes
251     void
252 #endif
253 );
254
255 extern DevicePtr LookupDevice(
256 #if NeedFunctionPrototypes
257     int /* id */
258 #endif
259 );
260
261 extern void QueryMinMaxKeyCodes(
262 #if NeedFunctionPrototypes
263     KeyCode* /*minCode*/,
264     KeyCode* /*maxCode*/
265 #endif
266 );
267
268 extern Bool SetKeySymsMap(
269 #if NeedFunctionPrototypes
270     KeySymsPtr /*dst*/,
271     KeySymsPtr /*src*/
272 #endif
273 );
274
275 extern Bool InitKeyClassDeviceStruct(
276 #if NeedFunctionPrototypes
277     DeviceIntPtr /*device*/,
278     KeySymsPtr /*pKeySyms*/,
279     CARD8 /*pModifiers*/[]
280 #endif
281 );
282
283 extern Bool InitButtonClassDeviceStruct(
284 #if NeedFunctionPrototypes
285     DeviceIntPtr /*device*/,
286     int /*numButtons*/,
287     CARD8* /*map*/
288 #endif
289 );
290
291 typedef int (*ValuatorMotionProcPtr)(
292 #if NeedNestedPrototypes
293                 DeviceIntPtr /*pdevice*/,
294                 xTimecoord * /*coords*/,
295                 unsigned long /*start*/,
296                 unsigned long /*stop*/,
297                 ScreenPtr /*pScreen*/
298 #endif
299 );
300
301 extern Bool InitValuatorClassDeviceStruct(
302 #if NeedFunctionPrototypes
303     DeviceIntPtr /*device*/,
304     int /*numAxes*/,
305     ValuatorMotionProcPtr /* motionProc */,
306     int /*numMotionEvents*/,
307     int /*mode*/
308 #endif
309 );
310
311 extern Bool InitFocusClassDeviceStruct(
312 #if NeedFunctionPrototypes
313     DeviceIntPtr /*device*/
314 #endif
315 );
316
317 typedef void (*BellProcPtr)(
318 #if NeedNestedPrototypes
319     int /*percent*/,
320     DeviceIntPtr /*device*/,
321     pointer /*ctrl*/,
322     int
323 #endif
324 );
325
326 typedef void (*KbdCtrlProcPtr)(
327 #if NeedNestedPrototypes
328     DeviceIntPtr /*device*/,
329     KeybdCtrl * /*ctrl*/
330 #endif                               
331 );
332
333 extern Bool InitKbdFeedbackClassDeviceStruct(
334 #if NeedFunctionPrototypes
335     DeviceIntPtr /*device*/,
336     BellProcPtr /*bellProc*/,
337     KbdCtrlProcPtr /*controlProc*/
338 #endif
339 );
340
341 typedef void (*PtrCtrlProcPtr)(
342 #if NeedNestedPrototypes
343     DeviceIntPtr /*device*/,
344     PtrCtrl * /*ctrl*/
345 #endif                               
346 );
347
348 extern Bool InitPtrFeedbackClassDeviceStruct(
349 #if NeedFunctionPrototypes
350     DeviceIntPtr /*device*/,
351     PtrCtrlProcPtr /*controlProc*/
352 #endif
353 );
354
355 typedef void (*StringCtrlProcPtr)(
356 #if NeedNestedPrototypes
357     DeviceIntPtr /*device*/,
358     StringCtrl * /*ctrl*/
359 #endif                               
360 );
361
362 extern Bool InitStringFeedbackClassDeviceStruct(
363 #if NeedFunctionPrototypes
364     DeviceIntPtr /*device*/,
365     StringCtrlProcPtr /*controlProc*/,
366     int /*max_symbols*/,
367     int /*num_symbols_supported*/,
368     KeySym* /*symbols*/
369 #endif
370 );
371
372 typedef void (*BellCtrlProcPtr)(
373 #if NeedNestedPrototypes
374     DeviceIntPtr /*device*/,
375     BellCtrl * /*ctrl*/
376 #endif                               
377 );
378
379 extern Bool InitBellFeedbackClassDeviceStruct(
380 #if NeedFunctionPrototypes
381     DeviceIntPtr /*device*/,
382     BellProcPtr /*bellProc*/,
383     BellCtrlProcPtr /*controlProc*/
384 #endif
385 );
386
387 typedef void (*LedCtrlProcPtr)(
388 #if NeedNestedPrototypes
389     DeviceIntPtr /*device*/,
390     LedCtrl * /*ctrl*/
391 #endif                               
392 );
393
394 extern Bool InitLedFeedbackClassDeviceStruct(
395 #if NeedFunctionPrototypes
396     DeviceIntPtr /*device*/,
397     LedCtrlProcPtr /*controlProc*/
398 #endif
399 );
400
401 typedef void (*IntegerCtrlProcPtr)(
402 #if NeedNestedPrototypes
403     DeviceIntPtr /*device*/,
404     IntegerCtrl * /*ctrl*/
405 #endif
406 );
407
408
409 extern Bool InitIntegerFeedbackClassDeviceStruct(
410 #if NeedFunctionPrototypes
411     DeviceIntPtr /*device*/,
412     IntegerCtrlProcPtr /*controlProc*/
413 #endif
414 );
415
416 extern Bool InitPointerDeviceStruct(
417 #if NeedFunctionPrototypes
418     DevicePtr /*device*/,
419     CARD8* /*map*/,
420     int /*numButtons*/,
421     ValuatorMotionProcPtr /*motionProc*/,
422     PtrCtrlProcPtr /*controlProc*/,
423     int /*numMotionEvents*/
424 #endif
425 );
426
427 extern Bool InitKeyboardDeviceStruct(
428 #if NeedFunctionPrototypes
429     DevicePtr /*device*/,
430     KeySymsPtr /*pKeySyms*/,
431     CARD8 /*pModifiers*/[],
432     BellProcPtr /*bellProc*/,
433     KbdCtrlProcPtr /*controlProc*/
434 #endif
435 );
436
437 extern void SendMappingNotify(
438 #if NeedFunctionPrototypes
439     unsigned int /*request*/,
440     unsigned int /*firstKeyCode*/,
441     unsigned int /*count*/,
442     ClientPtr   /* client */
443 #endif
444 );
445
446 extern Bool BadDeviceMap(
447 #if NeedFunctionPrototypes
448     BYTE* /*buff*/,
449     int /*length*/,
450     unsigned /*low*/,
451     unsigned /*high*/,
452     XID* /*errval*/
453 #endif
454 );
455
456 extern Bool AllModifierKeysAreUp(
457 #if NeedFunctionPrototypes
458     DeviceIntPtr /*device*/,
459     CARD8* /*map1*/,
460     int /*per1*/,
461     CARD8* /*map2*/,
462     int /*per2*/
463 #endif
464 );
465
466 extern void NoteLedState(
467 #if NeedFunctionPrototypes
468     DeviceIntPtr /*keybd*/,
469     int /*led*/,
470     Bool /*on*/
471 #endif
472 );
473
474 extern void MaybeStopHint(
475 #if NeedFunctionPrototypes
476     DeviceIntPtr /*device*/,
477     ClientPtr /*client*/
478 #endif
479 );
480
481 extern void ProcessPointerEvent(
482 #if NeedFunctionPrototypes
483     xEventPtr /*xE*/,
484     DeviceIntPtr /*mouse*/,
485     int /*count*/
486 #endif
487 );
488
489 extern void ProcessKeyboardEvent(
490 #if NeedFunctionPrototypes
491     xEventPtr /*xE*/,
492     DeviceIntPtr /*keybd*/,
493     int /*count*/
494 #endif
495 );
496
497 #ifdef XKB
498 extern void CoreProcessPointerEvent(
499 #if NeedFunctionPrototypes
500     xEventPtr /*xE*/,
501     DeviceIntPtr /*mouse*/,
502     int /*count*/
503 #endif
504 );
505
506 extern void CoreProcessKeyboardEvent(
507 #if NeedFunctionPrototypes
508     xEventPtr /*xE*/,
509     DeviceIntPtr /*keybd*/,
510     int /*count*/
511 #endif
512 );
513 #endif
514
515 extern Bool LegalModifier(
516 #if NeedFunctionPrototypes
517     unsigned int /*key*/, 
518     DevicePtr /*pDev*/
519 #endif
520 );
521
522 extern void ProcessInputEvents(
523 #if NeedFunctionPrototypes
524     void
525 #endif
526 );
527
528 extern void InitInput(
529 #if NeedFunctionPrototypes
530     int  /*argc*/,
531     char ** /*argv*/
532 #endif
533 );
534
535 #endif /* INPUT_H */