aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-26 09:27:48 +0100
committermarha <marha@users.sourceforge.net>2012-01-26 09:27:48 +0100
commitd99165260070ce9668f3eeac8bb010393f490c0a (patch)
treeafdd34a5707eee117c9827aeb8bb5237cc9d14fa /xorg-server
parent5283d47a3bf49ffbf972465908f1e30aa6698509 (diff)
downloadvcxsrv-d99165260070ce9668f3eeac8bb010393f490c0a.tar.gz
vcxsrv-d99165260070ce9668f3eeac8bb010393f490c0a.tar.bz2
vcxsrv-d99165260070ce9668f3eeac8bb010393f490c0a.zip
turn on -emulate3buttons if less than 3 mouse buttons are reported
Added -noemulate3buttons
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/hw/xwin/InitOutput.c30
-rw-r--r--xorg-server/hw/xwin/win.h1
-rw-r--r--xorg-server/hw/xwin/winmouse.c2
-rw-r--r--xorg-server/hw/xwin/winprocarg.c13
4 files changed, 43 insertions, 3 deletions
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");
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 5de97af85..5ec7e3bee 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -97,6 +97,7 @@
#define MOUSE_POLLING_INTERVAL 50
#define WIN_E3B_OFF -1
+#define WIN_E3B_DEFAULT 0
#define WIN_FD_INVALID -1
#define WIN_SERVER_NONE 0x0L /* 0 */
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index 75e51c2f9..9debead0d 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -71,6 +71,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
case DEVICE_INIT:
/* Get number of mouse buttons */
lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+ winDebug("%d mouse buttons found\n", lngMouseButtons);
/* Mapping of windows events to X events:
* LEFT:1 MIDDLE:2 RIGHT:3
@@ -81,7 +82,6 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
*/
if (lngMouseButtons < 3)
lngMouseButtons = 3;
- winDebug("%d mouse buttons found\n", lngMouseButtons);
/* allocate memory:
* number of buttons + 2x mouse wheel event + 1 extra (offset for map)
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index 7cce026c1..3db9a1c3e 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -144,7 +144,7 @@ winInitializeScreenDefaults(void)
defaultScreenInfo.fLessPointer = FALSE;
defaultScreenInfo.iResizeMode = notAllowed;
defaultScreenInfo.fNoTrayIcon = FALSE;
- defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
+ defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
defaultScreenInfo.fIgnoreInput = FALSE;
@@ -813,6 +813,17 @@ ddxProcessArgument (int argc, char *argv[], int i)
return iArgsProcessed;
}
+ /*
+ * Look for the '-noemulate3buttons' argument
+ */
+ if (IS_OPTION ("-noemulate3buttons"))
+ {
+ screenInfoPtr->iE3BTimeout = WIN_E3B_OFF;
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
/*
* Look for the '-depth n' argument
*/