fix: Send extra mouse buttons on mac os servers to clients
This commit is contained in:
parent
4200de66ee
commit
84e1e722c0
1 changed files with 47 additions and 44 deletions
|
|
@ -1185,9 +1185,13 @@ ButtonID OSXScreen::mapDeskflowButtonToMac(uint16_t button) const
|
||||||
return kMacButtonMiddle;
|
return kMacButtonMiddle;
|
||||||
case 3:
|
case 3:
|
||||||
return kMacButtonRight;
|
return kMacButtonRight;
|
||||||
|
case 4:
|
||||||
|
return kButtonExtra0;
|
||||||
|
case 5:
|
||||||
|
return kButtonExtra1;
|
||||||
|
default:
|
||||||
|
return kButtonNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<ButtonID>(button);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonID OSXScreen::mapMacButtonToDeskflow(uint16_t macButton) const
|
ButtonID OSXScreen::mapMacButtonToDeskflow(uint16_t macButton) const
|
||||||
|
|
@ -1195,15 +1199,17 @@ ButtonID OSXScreen::mapMacButtonToDeskflow(uint16_t macButton) const
|
||||||
switch (macButton) {
|
switch (macButton) {
|
||||||
case 1:
|
case 1:
|
||||||
return kButtonLeft;
|
return kButtonLeft;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return kButtonRight;
|
return kButtonRight;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
return kButtonMiddle;
|
return kButtonMiddle;
|
||||||
|
case 4:
|
||||||
|
return kButtonExtra0;
|
||||||
|
case 5:
|
||||||
|
return kButtonExtra1;
|
||||||
|
default:
|
||||||
|
return kButtonNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<ButtonID>(macButton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t OSXScreen::mapScrollWheelToDeskflow(int32_t x) const
|
int32_t OSXScreen::mapScrollWheelToDeskflow(int32_t x) const
|
||||||
|
|
@ -1493,8 +1499,8 @@ extern "C" {
|
||||||
|
|
||||||
typedef int CGSConnection;
|
typedef int CGSConnection;
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CGSGlobalHotKeyEnable = 0,
|
CGSGlobalHotKeyEnable = 0,
|
||||||
CGSGlobalHotKeyDisable = 1,
|
CGSGlobalHotKeyDisable = 1,
|
||||||
} CGSGlobalHotKeyOperatingMode;
|
} CGSGlobalHotKeyOperatingMode;
|
||||||
|
|
||||||
extern CGSConnection _CGSDefaultConnection(void) WEAK_IMPORT_ATTRIBUTE;
|
extern CGSConnection _CGSDefaultConnection(void) WEAK_IMPORT_ATTRIBUTE;
|
||||||
|
|
@ -1519,51 +1525,48 @@ static CGSSetGlobalHotKeyOperatingMode_t s_CGSSetGlobalHotKeyOperatingMode;
|
||||||
s_##name_ = (name_##_t)NSAddressOfSymbol(NSLookupAndBindSymbolWithHint("_" #name_, "CoreGraphics")); \
|
s_##name_ = (name_##_t)NSAddressOfSymbol(NSLookupAndBindSymbolWithHint("_" #name_, "CoreGraphics")); \
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool OSXScreen::isGlobalHotKeyOperatingModeAvailable()
|
||||||
OSXScreen::isGlobalHotKeyOperatingModeAvailable()
|
|
||||||
{
|
{
|
||||||
if (!s_testedForGHOM) {
|
if (!s_testedForGHOM) {
|
||||||
s_testedForGHOM = true;
|
s_testedForGHOM = true;
|
||||||
LOOKUP(_CGSDefaultConnection);
|
LOOKUP(_CGSDefaultConnection);
|
||||||
LOOKUP(CGSGetGlobalHotKeyOperatingMode);
|
LOOKUP(CGSGetGlobalHotKeyOperatingMode);
|
||||||
LOOKUP(CGSSetGlobalHotKeyOperatingMode);
|
LOOKUP(CGSSetGlobalHotKeyOperatingMode);
|
||||||
s_hasGHOM = (s__CGSDefaultConnection != nullptr &&
|
s_hasGHOM = (s__CGSDefaultConnection != nullptr &&
|
||||||
s_CGSGetGlobalHotKeyOperatingMode != nullptr &&
|
s_CGSGetGlobalHotKeyOperatingMode != nullptr &&
|
||||||
s_CGSSetGlobalHotKeyOperatingMode != nullptr);
|
s_CGSSetGlobalHotKeyOperatingMode != nullptr);
|
||||||
}
|
}
|
||||||
return s_hasGHOM;
|
return s_hasGHOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void OSXScreen::setGlobalHotKeysEnabled(bool enabled)
|
||||||
OSXScreen::setGlobalHotKeysEnabled(bool enabled)
|
|
||||||
{
|
{
|
||||||
if (isGlobalHotKeyOperatingModeAvailable()) {
|
if (isGlobalHotKeyOperatingModeAvailable()) {
|
||||||
CGSConnection conn = s__CGSDefaultConnection();
|
CGSConnection conn = s__CGSDefaultConnection();
|
||||||
|
|
||||||
CGSGlobalHotKeyOperatingMode mode;
|
CGSGlobalHotKeyOperatingMode mode;
|
||||||
s_CGSGetGlobalHotKeyOperatingMode(conn, &mode);
|
s_CGSGetGlobalHotKeyOperatingMode(conn, &mode);
|
||||||
|
|
||||||
if (enabled && mode == CGSGlobalHotKeyDisable) {
|
if (enabled && mode == CGSGlobalHotKeyDisable) {
|
||||||
s_CGSSetGlobalHotKeyOperatingMode(conn, CGSGlobalHotKeyEnable);
|
s_CGSSetGlobalHotKeyOperatingMode(conn, CGSGlobalHotKeyEnable);
|
||||||
}
|
}
|
||||||
else if (!enabled && mode == CGSGlobalHotKeyEnable) {
|
else if (!enabled && mode == CGSGlobalHotKeyEnable) {
|
||||||
s_CGSSetGlobalHotKeyOperatingMode(conn, CGSGlobalHotKeyDisable);
|
s_CGSSetGlobalHotKeyOperatingMode(conn, CGSGlobalHotKeyDisable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool OSXScreen::getGlobalHotKeysEnabled()
|
||||||
OSXScreen::getGlobalHotKeysEnabled()
|
|
||||||
{
|
{
|
||||||
CGSGlobalHotKeyOperatingMode mode;
|
CGSGlobalHotKeyOperatingMode mode;
|
||||||
if (isGlobalHotKeyOperatingModeAvailable()) {
|
if (isGlobalHotKeyOperatingModeAvailable()) {
|
||||||
CGSConnection conn = s__CGSDefaultConnection();
|
CGSConnection conn = s__CGSDefaultConnection();
|
||||||
s_CGSGetGlobalHotKeyOperatingMode(conn, &mode);
|
s_CGSGetGlobalHotKeyOperatingMode(conn, &mode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mode = CGSGlobalHotKeyEnable;
|
mode = CGSGlobalHotKeyEnable;
|
||||||
}
|
}
|
||||||
return (mode == CGSGlobalHotKeyEnable);
|
return (mode == CGSGlobalHotKeyEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue