From ad63d63ea22597a95ea048e708b2511fa4631c2a Mon Sep 17 00:00:00 2001 From: LIU Hao Date: Mon, 11 Nov 2024 10:09:23 +0800 Subject: [PATCH] fix: Do not bring main window to foreground upon file change It's very disrupting, especially when tail mode or auto reload has been turned on. Signed-off-by: LIU Hao --- src/Notepad3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 159ce7845..2742e659f 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -12778,6 +12778,7 @@ void CALLBACK PasteBoardTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD // LRESULT MsgFileChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) { + UNREFERENCED_PARAMETER(hwnd); UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); @@ -12797,7 +12798,6 @@ LRESULT MsgFileChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) break; case FWM_MSGBOX: { - SetForegroundWindow(hwnd); /// LONG const answer = MessageBoxExW(Globals.hwndMain, L"File change, Cancel, Retry, Continue", L"NP3", MB_ABORTRETRYIGNORE, GetLangIdByLocaleName(Globals.CurrentLngLocaleName)); LONG const answer = InfoBoxLng(MB_FILECHANGEDNOTIFY | MB_ICONWARNING, NULL, IDS_MUI_FILECHANGENOTIFY); switch (LOWORD(answer)) { @@ -12846,7 +12846,6 @@ LRESULT MsgFileChangeNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) } if (bRevertFile) { - SetForegroundWindow(hwnd); FileRevert(Paths.CurrentFile, false); if (FileWatching.MonitoringLog || (s_flagChangeNotify == FWM_AUTORELOAD)) { SciCall_SetReadOnly(FileWatching.MonitoringLog);