From d99165260070ce9668f3eeac8bb010393f490c0a Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 26 Jan 2012 09:27:48 +0100 Subject: turn on -emulate3buttons if less than 3 mouse buttons are reported Added -noemulate3buttons --- xorg-server/hw/xwin/InitOutput.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'xorg-server/hw/xwin/InitOutput.c') diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 5941a2116..a40446d98 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -676,6 +676,34 @@ OsVendorInit (void) /* We have to flag this as an explicit screen, even though it isn't */ g_ScreenInfo[0].fExplicitScreen = TRUE; } + + /* Work out what the default emulate3buttons setting should be, and apply + it if nothing was explicitly specified */ + { + int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); + int j; + + for (j = 0; j < g_iNumScreens; j++) + { + if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT) + { + if (mouseButtons < 3) + { + static Bool reportOnce = TRUE; + g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME; + if (reportOnce) + { + reportOnce = FALSE; + winDebug("Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n", mouseButtons); + } + } + else + { + g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF; + } + } + } + } } @@ -713,7 +741,7 @@ winUseMsg (void) "\tSpecify an optional bitdepth to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); - ErrorF ("-emulate3buttons [timeout]\n" + ErrorF ("-[no]emulate3buttons [timeout]\n" "\tEmulate 3 button mouse with an optional timeout in\n" "\tmilliseconds.\n"); -- cgit v1.2.3