Apply mouse bindings to forwarded input
This commit is contained in:
1 parent
4926871177
commit
80adc2bd7d
3 files changed
+12
-3
No files matched your search
+7
-2
@@ -1415,9 +1415,10 @@ LRESULT CALLBACK App::mouseProc(int code, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
auto &app = *current;
|
||||
const auto &mouse = *reinterpret_cast<const MSLLHOOKSTRUCT *>(lp);
|
||||
const int button = mouse.flags & LLMHF_INJECTED ? -1 : mouseButton(UINT(wp), HIWORD(mouse.mouseData));
|
||||
// Forwarded mouse events use the same bindings as local events on this PC.
|
||||
const int button = mouseButton(UINT(wp), HIWORD(mouse.mouseData));
|
||||
const auto wheelDelta = static_cast<SHORT>(HIWORD(mouse.mouseData));
|
||||
const int wheel = mouse.flags & LLMHF_INJECTED ? -1 : mouseWheelEvent(UINT(wp), wheelDelta);
|
||||
const int wheel = mouseWheelEvent(UINT(wp), wheelDelta);
|
||||
const bool down = mouseButtonDown(UINT(wp));
|
||||
if (button >= 0 && app.mousePresses[button].held)
|
||||
{
|
||||
@@ -1449,6 +1450,9 @@ LRESULT CALLBACK App::mouseProc(int code, WPARAM wp, LPARAM lp)
|
||||
if (app.lanService->takeInputChange()) app.resetLanInput();
|
||||
if (consumed) return 1;
|
||||
}
|
||||
// Mouse Without Borders can consume the source event while forwarding it.
|
||||
const auto routed = CallNextHookEx(nullptr, code, wp, lp);
|
||||
if (routed) return routed;
|
||||
if (((button >= 0 && down) || mouseEventEnabled(app.settings, wheel)) &&
|
||||
!app.settings.mouseBindings.empty() && !app.busy && !app.suspended &&
|
||||
!app.installingUpdate && !app.hotkeyCapture && modifiersReleased())
|
||||
@@ -1534,6 +1538,7 @@ LRESULT CALLBACK App::mouseProc(int code, WPARAM wp, LPARAM lp)
|
||||
if (app.busy) diagnosticEvent(L"Input context changed: mouse message=" + std::to_wstring(wp));
|
||||
app.resetInput();
|
||||
}
|
||||
return routed;
|
||||
}
|
||||
return CallNextHookEx(nullptr, code, wp, lp);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user