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>
20 #include <X11/Xproto.h>
21 #include "screenint.h"
25 #include "scrnintstr.h"
27 #include "mipointer.h"
36 #include "xserver-properties.h"
37 #include "exevents.h" /* For XIGetKnownProperty */
39 DeviceIntPtr xnestPointerDevice
= NULL
;
42 xnestChangePointerControl(DeviceIntPtr pDev
, PtrCtrl
* ctrl
)
44 XChangePointerControl(xnestDisplay
, True
, True
,
45 ctrl
->num
, ctrl
->den
, ctrl
->threshold
);
49 xnestPointerProc(DeviceIntPtr pDev
, int onoff
)
51 CARD8 map
[MAXBUTTONS
];
52 Atom btn_labels
[MAXBUTTONS
] = { 0 };
53 Atom axes_labels
[2] = { 0 };
59 nmap
= XGetPointerMapping(xnestDisplay
, map
, MAXBUTTONS
);
60 for (i
= 0; i
<= nmap
; i
++)
61 map
[i
] = i
; /* buttons are already mapped */
63 btn_labels
[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT
);
64 btn_labels
[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE
);
65 btn_labels
[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT
);
66 btn_labels
[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP
);
67 btn_labels
[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN
);
68 btn_labels
[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT
);
69 btn_labels
[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT
);
71 axes_labels
[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X
);
72 axes_labels
[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y
);
74 XGetPointerControl(xnestDisplay
,
75 &defaultPointerControl
.num
,
76 &defaultPointerControl
.den
,
77 &defaultPointerControl
.threshold
);
78 InitPointerDeviceStruct(&pDev
->public, map
, nmap
, btn_labels
,
79 xnestChangePointerControl
,
80 GetMotionHistorySize(), 2, axes_labels
);
83 xnestEventMask
|= XNEST_POINTER_EVENT_MASK
;
84 for (i
= 0; i
< xnestNumScreens
; i
++)
85 XSelectInput(xnestDisplay
, xnestDefaultWindows
[i
], xnestEventMask
);
88 xnestEventMask
&= ~XNEST_POINTER_EVENT_MASK
;
89 for (i
= 0; i
< xnestNumScreens
; i
++)
90 XSelectInput(xnestDisplay
, xnestDefaultWindows
[i
], xnestEventMask
);