Pointer.c revision 4642e01f
1/* 2 3Copyright 1993 by Davor Matic 4 5Permission to use, copy, modify, distribute, and sell this software 6and its documentation for any purpose is hereby granted without fee, 7provided that the above copyright notice appear in all copies and that 8both that copyright notice and this permission notice appear in 9supporting documentation. Davor Matic makes no representations about 10the suitability of this software for any purpose. It is provided "as 11is" without express or implied warranty. 12 13*/ 14 15#ifdef HAVE_XNEST_CONFIG_H 16#include <xnest-config.h> 17#endif 18 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" 28 29#include "Xnest.h" 30 31#include "Display.h" 32#include "Screen.h" 33#include "Pointer.h" 34#include "Args.h" 35 36DeviceIntPtr xnestPointerDevice = NULL; 37 38void 39xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl) 40{ 41 XChangePointerControl(xnestDisplay, True, True, 42 ctrl->num, ctrl->den, ctrl->threshold); 43} 44 45int 46xnestPointerProc(DeviceIntPtr pDev, int onoff) 47{ 48 CARD8 map[MAXBUTTONS]; 49 int nmap; 50 int i; 51 52 switch (onoff) 53 { 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 xnestChangePointerControl, 60 GetMotionHistorySize(), 2); 61 break; 62 case DEVICE_ON: 63 xnestEventMask |= XNEST_POINTER_EVENT_MASK; 64 for (i = 0; i < xnestNumScreens; i++) 65 XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask); 66 break; 67 case DEVICE_OFF: 68 xnestEventMask &= ~XNEST_POINTER_EVENT_MASK; 69 for (i = 0; i < xnestNumScreens; i++) 70 XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask); 71 break; 72 case DEVICE_CLOSE: 73 break; 74 } 75 return Success; 76} 77