#4477 Only allow mouse buttons 1-10 for XTestFakeButtons call.

These are the only valid ones:
[~]>for i in `seq 0 1 11`; do echo Testing $i; xte "mouseclick $i"; done
Testing 0
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  132 (XTEST)
  Minor opcode of failed request:  2 (X_XTestFakeInput)
  Value in failed request:  0x0
  Serial number of failed request:  12
  Current serial number in output stream:  15
Testing 1
Testing 2
Testing 3
Testing 4
Testing 5
Testing 6
Testing 7
Testing 8
Testing 9
Testing 10
Testing 11
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  132 (XTEST)
  Minor opcode of failed request:  2 (X_XTestFakeInput)
  Value in failed request:  0xb
  Serial number of failed request:  12

And there are mice out there where buttons 11+ can be pressed accidentally,
terminating the synergy client and often leaving the system in a bad state.
This commit is contained in:
Christian Schmidt 2015-03-25 14:27:49 +01:00 committed by Andrew Nelless
parent f5944278ed
commit 21d4e6a908
1 changed files with 1 additions and 1 deletions

View File

@ -827,7 +827,7 @@ void
XWindowsScreen::fakeMouseButton(ButtonID button, bool press) XWindowsScreen::fakeMouseButton(ButtonID button, bool press)
{ {
const unsigned int xButton = mapButtonToX(button); const unsigned int xButton = mapButtonToX(button);
if (xButton != 0) { if (xButton > 0 && xButton < 11) {
XTestFakeButtonEvent(m_display, xButton, XTestFakeButtonEvent(m_display, xButton,
press ? True : False, CurrentTime); press ? True : False, CurrentTime);
XFlush(m_display); XFlush(m_display);