/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c,v 3.17 2002/05/31 18:46:02 dawes Exp $ */ /* * (c) Copyright 1994,1999,2000 by Holger Veit * * Modified (c) 1996 Sebastien Marineau * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Holger Veit shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Holger Veit. * */ /* $XConsortium: os2_mouse.c /main/10 1996/10/27 11:48:51 kaleb $ */ #define I_NEED_OS2_H #define NEED_EVENTS #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include #include "misc.h" #include "inputstr.h" #include "scrnintstr.h" #include "compiler.h" #define INCL_DOSFILEMGR #define INCL_DOSQUEUES #define INCL_MOU #undef RT_FONT #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86Config.h" #include "xf86Xinput.h" #include "xf86OSmouse.h" #include "mipointer.h" /* The following support code was copied from mouse.c */ /********************************************************************** * * Emulate3Button support code * **********************************************************************/ /* * Lets create a simple finite-state machine for 3 button emulation: * * We track buttons 1 and 3 (left and right). There are 11 states: * 0 ground - initial state * 1 delayed left - left pressed, waiting for right * 2 delayed right - right pressed, waiting for left * 3 pressed middle - right and left pressed, emulated middle sent * 4 pressed left - left pressed and sent * 5 pressed right - right pressed and sent * 6 released left - left released after emulated middle * 7 released right - right released after emulated middle * 8 repressed left - left pressed after released left * 9 repressed right - right pressed after released right * 10 pressed both - both pressed, not emulating middle * * At each state, we need handlers for the following events * 0: no buttons down * 1: left button down * 2: right button down * 3: both buttons down * 4: emulate3Timeout passed without a button change * Note that button events are not deltas, they are the set of buttons being * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) * left down to right down without anything in between, so all cases must be * handled. * * a handler consists of three values: * 0: action1 * 1: action2 * 2: new emulation state * * action > 0: ButtonPress * action = 0: nothing * action < 0: ButtonRelease * * The comment preceeding each section is the current emulation state. * The comments to the right are of the form *