1/* 2 3Copyright 1993, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included 12in all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20OTHER DEALINGS IN THE SOFTWARE. 21 22Except as contained in this notice, the name of The Open Group shall 23not be used in advertising or otherwise to promote the sale, use or 24other dealings in this Software without prior written authorization 25from The Open Group. 26 27*/ 28 29#ifdef HAVE_DIX_CONFIG_H 30#include <dix-config.h> 31#endif 32 33#include <X11/X.h> 34#include "mi.h" 35#include <X11/Xproto.h> 36#include "scrnintstr.h" 37#include "inputstr.h" 38#include <X11/Xos.h> 39#include "mibstore.h" 40#include "mipointer.h" 41#include "xkbsrv.h" 42#include <X11/keysym.h> 43#include "xserver-properties.h" 44#include "exevents.h" 45#include "extinit.h" 46 47Bool 48LegalModifier(unsigned int key, DeviceIntPtr pDev) 49{ 50 return TRUE; 51} 52 53void 54ProcessInputEvents(void) 55{ 56 mieqProcessInputEvents(); 57} 58 59void DDXRingBell(int volume, int pitch, int duration) 60{ 61} 62 63#define VFB_MIN_KEY 8 64#define VFB_MAX_KEY 255 65 66static int 67vfbKeybdProc(DeviceIntPtr pDevice, int onoff) 68{ 69 DevicePtr pDev = (DevicePtr)pDevice; 70 71 switch (onoff) 72 { 73 case DEVICE_INIT: 74 InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL); 75 break; 76 case DEVICE_ON: 77 pDev->on = TRUE; 78 break; 79 case DEVICE_OFF: 80 pDev->on = FALSE; 81 break; 82 case DEVICE_CLOSE: 83 break; 84 } 85 return Success; 86} 87 88static int 89vfbMouseProc(DeviceIntPtr pDevice, int onoff) 90{ 91#define NBUTTONS 3 92#define NAXES 2 93 94 BYTE map[NBUTTONS + 1]; 95 DevicePtr pDev = (DevicePtr)pDevice; 96 Atom btn_labels[NBUTTONS] = {0}; 97 Atom axes_labels[NAXES] = {0}; 98 99 switch (onoff) 100 { 101 case DEVICE_INIT: 102 map[1] = 1; 103 map[2] = 2; 104 map[3] = 3; 105 106 btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); 107 btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); 108 btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); 109 110 axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); 111 axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); 112 113 InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels, 114 (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), NAXES, axes_labels); 115 break; 116 117 case DEVICE_ON: 118 pDev->on = TRUE; 119 break; 120 121 case DEVICE_OFF: 122 pDev->on = FALSE; 123 break; 124 125 case DEVICE_CLOSE: 126 break; 127 } 128 return Success; 129 130#undef NBUTTONS 131#undef NAXES 132} 133 134void 135InitInput(int argc, char *argv[]) 136{ 137 DeviceIntPtr p, k; 138 Atom xiclass; 139 p = AddInputDevice(serverClient, vfbMouseProc, TRUE); 140 k = AddInputDevice(serverClient, vfbKeybdProc, TRUE); 141 xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE); 142 AssignTypeAndName(p, xiclass, "Xvfb mouse"); 143 xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE); 144 AssignTypeAndName(k, xiclass, "Xvfb keyboard"); 145 (void)mieqInit(); 146} 147 148void 149CloseInput (void) 150{ 151} 152