summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2000-10-08 02:08:39 +0000
committerKeith Packard <keithp@keithp.com>2000-10-08 02:08:39 +0000
commit5f5b9ed1ad0591d70354c2b90609051d169fc33e (patch)
treef25d36b14d4599e9e60cdfa0cc417df4cbd5f2a8
parentfb8b58270fcaee236337d3818df04e651acbcea9 (diff)
kdrive: Add timeout to screen switching to avoid unintentional flipping
-rw-r--r--hw/kdrive/src/kinput.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 02c3ec5d6..bc93f634e 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.8 2000/10/06 05:54:09 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.9 2000/10/06 22:05:53 keithp Exp $ */
#include "kdrive.h"
#include "inputstr.h"
@@ -45,6 +45,8 @@ static int kdBellPitch;
static int kdBellDuration;
static int kdLeds;
static Bool kdInputEnabled;
+static Bool kdOffScreen;
+static unsigned long kdOffScreenTime;
static KdMouseMatrix kdMouseMatrix = {
1, 0, 0,
0, 1, 0
@@ -1371,11 +1373,18 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
ScreenPtr pScreen = *ppScreen;
int n;
+ CARD32 ms;
if (kdDisableZaphod || screenInfo.numScreens <= 1)
return FALSE;
if (*x < 0 || *y < 0)
{
+ ms = GetTimeInMillis ();
+ if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
+ return FALSE;
+ kdOffScreen = TRUE;
+ kdOffScreenTime = ms;
+
n = pScreen->myNum - 1;
if (n < 0)
n = screenInfo.numScreens - 1;
@@ -1389,6 +1398,12 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
}
else if (*x >= pScreen->width || *y >= pScreen->height)
{
+ ms = GetTimeInMillis ();
+ if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
+ return FALSE;
+ kdOffScreen = TRUE;
+ kdOffScreenTime = ms;
+
n = pScreen->myNum + 1;
if (n >= screenInfo.numScreens)
n = 0;