Correctly translate mouse events to the right and middle buttons #2975
This commit is contained in:
parent
aa178a356f
commit
5901fa8aed
|
@ -466,9 +466,9 @@ OSXScreen::constructMouseButtonEventMap()
|
||||||
{
|
{
|
||||||
const CGEventType source[NumButtonIDs][3] = {
|
const CGEventType source[NumButtonIDs][3] = {
|
||||||
{kCGEventLeftMouseUp, kCGEventLeftMouseDragged, kCGEventLeftMouseDown},
|
{kCGEventLeftMouseUp, kCGEventLeftMouseDragged, kCGEventLeftMouseDown},
|
||||||
{kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown},
|
|
||||||
{kCGEventRightMouseUp, kCGEventRightMouseDragged, kCGEventRightMouseDown},
|
{kCGEventRightMouseUp, kCGEventRightMouseDragged, kCGEventRightMouseDown},
|
||||||
{kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown},
|
{kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown},
|
||||||
|
{kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown},
|
||||||
{kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown}
|
{kCGEventOtherMouseUp, kCGEventOtherMouseDragged, kCGEventOtherMouseDown}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ void
|
||||||
OSXScreen::fakeMouseButton(ButtonID id, bool press)
|
OSXScreen::fakeMouseButton(ButtonID id, bool press)
|
||||||
{
|
{
|
||||||
// Buttons are indexed from one, but the button down array is indexed from zero
|
// Buttons are indexed from one, but the button down array is indexed from zero
|
||||||
UInt32 index = id - kButtonLeft;
|
UInt32 index = mapSynergyButtonToMac(id) - kButtonLeft;
|
||||||
if (index >= NumButtonIDs) {
|
if (index >= NumButtonIDs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1444,6 +1444,21 @@ OSXScreen::onHotKey(EventRef event) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ButtonID
|
||||||
|
OSXScreen::mapSynergyButtonToMac(UInt16 button) const
|
||||||
|
{
|
||||||
|
switch (button) {
|
||||||
|
case 1:
|
||||||
|
return kButtonLeft;
|
||||||
|
case 2:
|
||||||
|
return kMacButtonMiddle;
|
||||||
|
case 3:
|
||||||
|
return kMacButtonRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return static_cast<ButtonID>(button);
|
||||||
|
}
|
||||||
|
|
||||||
ButtonID
|
ButtonID
|
||||||
OSXScreen::mapMacButtonToSynergy(UInt16 macButton) const
|
OSXScreen::mapMacButtonToSynergy(UInt16 macButton) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,6 +138,9 @@ private:
|
||||||
void showCursor();
|
void showCursor();
|
||||||
void hideCursor();
|
void hideCursor();
|
||||||
|
|
||||||
|
// map mac mouse button to synergy buttons
|
||||||
|
ButtonID mapSynergyButtonToMac(UInt16) const;
|
||||||
|
|
||||||
// map mac mouse button to synergy buttons
|
// map mac mouse button to synergy buttons
|
||||||
ButtonID mapMacButtonToSynergy(UInt16) const;
|
ButtonID mapMacButtonToSynergy(UInt16) const;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,9 @@ static const ButtonID kButtonLeft = 1;
|
||||||
static const ButtonID kButtonMiddle = 2;
|
static const ButtonID kButtonMiddle = 2;
|
||||||
static const ButtonID kButtonRight = 3;
|
static const ButtonID kButtonRight = 3;
|
||||||
static const ButtonID kButtonExtra0 = 4;
|
static const ButtonID kButtonExtra0 = 4;
|
||||||
|
|
||||||
|
static const ButtonID kMacButtonRight = 2;
|
||||||
|
static const ButtonID kMacButtonMiddle = 3;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
static const UInt8 NumButtonIDs = 5;
|
static const UInt8 NumButtonIDs = 5;
|
||||||
|
|
Loading…
Reference in New Issue