First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xnest / Pointer.c
blobb0de13b5f3f25291cebd7ddf4f052d3a76fe27ca
1 /*
3 Copyright 1993 by Davor Matic
5 Permission to use, copy, modify, distribute, and sell this software
6 and its documentation for any purpose is hereby granted without fee,
7 provided that the above copyright notice appear in all copies and that
8 both that copyright notice and this permission notice appear in
9 supporting documentation. Davor Matic makes no representations about
10 the suitability of this software for any purpose. It is provided "as
11 is" without express or implied warranty.
15 #ifdef HAVE_XNEST_CONFIG_H
16 #include <xnest-config.h>
17 #endif
19 #include <X11/X.h>
20 #include <X11/Xproto.h>
21 #include "screenint.h"
22 #include "inputstr.h"
23 #include "input.h"
24 #include "misc.h"
25 #include "scrnintstr.h"
26 #include "servermd.h"
27 #include "mipointer.h"
29 #include "Xnest.h"
31 #include "Display.h"
32 #include "Screen.h"
33 #include "Pointer.h"
34 #include "Args.h"
36 DeviceIntPtr xnestPointerDevice = NULL;
38 void
39 xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
41 XChangePointerControl(xnestDisplay, True, True,
42 ctrl->num, ctrl->den, ctrl->threshold);
45 int
46 xnestPointerProc(DeviceIntPtr pDev, int onoff)
48 CARD8 map[MAXBUTTONS];
49 int nmap;
50 int i;
52 switch (onoff)
54 case DEVICE_INIT:
55 nmap = XGetPointerMapping(xnestDisplay, map, MAXBUTTONS);
56 for (i = 0; i <= nmap; i++)
57 map[i] = i; /* buttons are already mapped */
58 InitPointerDeviceStruct(&pDev->public, map, nmap,
59 GetMotionHistory,
60 xnestChangePointerControl,
61 GetMotionHistorySize(), 2);
62 break;
63 case DEVICE_ON:
64 xnestEventMask |= XNEST_POINTER_EVENT_MASK;
65 for (i = 0; i < xnestNumScreens; i++)
66 XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
67 break;
68 case DEVICE_OFF:
69 xnestEventMask &= ~XNEST_POINTER_EVENT_MASK;
70 for (i = 0; i < xnestNumScreens; i++)
71 XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
72 break;
73 case DEVICE_CLOSE:
74 break;
76 return Success;