diff --git a/README.md b/README.md index 5d05abd..79b8eaf 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,10 @@ If Windows reports an existing button or an already added direction, the dialog selects that event in the list. Extra device controls need to emit a supported Windows mouse signal before KSwitcher can bind them. +When you move the pointer to another PC using KSwitcher Computers or Mouse Without +Borders, the receiving PC uses its own mouse profiles. Configure the actions in +**Settings → Mouse** on that PC. + Choose **Global** to set up fallback actions. Use **+** beside **Profiles** to create a named profile and set its applications. Double-click a profile or choose **Edit…** in its context menu to change its name or applications. The diff --git a/src/app.cpp b/src/app.cpp index c5fc855..ff9b0d1 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1415,9 +1415,10 @@ LRESULT CALLBACK App::mouseProc(int code, WPARAM wp, LPARAM lp) { auto &app = *current; const auto &mouse = *reinterpret_cast(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(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); } diff --git a/src/ui_mouse_buttons.inl b/src/ui_mouse_buttons.inl index bab20fe..a23b270 100644 --- a/src/ui_mouse_buttons.inl +++ b/src/ui_mouse_buttons.inl @@ -824,7 +824,7 @@ LRESULT CALLBACK captureMouseWheelProc(int code, WPARAM wp, LPARAM lp) { const auto &mouse = *reinterpret_cast(lp); const int signal = mouseWheelEvent(static_cast(wp), static_cast(HIWORD(mouse.mouseData))); - if (signal >= 0 && !(mouse.flags & LLMHF_INJECTED) && inMouseEventCapture(mouseEventCaptureWindow, mouse.pt)) + if (signal >= 0 && inMouseEventCapture(mouseEventCaptureWindow, mouse.pt)) PostMessageW(mouseEventCaptureWindow, CapturedMouseWheel, signal, 0); } return CallNextHookEx(nullptr, code, wp, lp);