Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
pull_request:
workflow_dispatch:

# This workflow only builds and uploads an artifact; it makes no repository
# writes. release.yml needs contents: write for `gh release create` — do not
# copy this block there.
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand Down
12 changes: 5 additions & 7 deletions src/primary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ INT_PTR CALLBACK OptionsDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
// Start or stop monitoring based on setting
if (autoSwitchEnabled) {
StartAutoSwitchMonitoring(g_hwndMain);
CheckAndApplyAutoSwitch(); // Apply immediately (will detect change and apply)
} else {
StopAutoSwitchMonitoring(g_hwndMain);
}
Expand All @@ -529,16 +528,15 @@ INT_PTR CALLBACK OptionsDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
L"Failed to update base mouse count. Please check your permissions.",
L"Error",
MB_ICONERROR | MB_OK);
} else {
// Re-check if auto-switch is enabled, to apply new settings immediately
if (autoSwitchEnabled) {
CheckAndApplyAutoSwitch();
}
}

// Single re-apply point: every setting the check reads —
// direction, auto-switch flag, base device count — is
// persisted by now, so one pass covers them all.
//
// Settings may have changed the mapping without the device
// state changing, so discard the cached state to force the
// next check to apply the new configuration.
// check to apply the new configuration.
if (autoSwitchEnabled && autoSwitchWritten) {
g_lastExternalMouseState = EXTERNAL_MOUSE_UNKNOWN;
CheckAndApplyAutoSwitch();
Expand Down
Loading