Avoid unnecessary notifications

This is an enhancement of PR #8475 which fixed (and still fixes) #8466.

It takes into account, that `WM_ACTIVATE` is not called only, when the window is being activated, but also, when the window is being **de**activated. In the latter case it is not necessary to do the activation actions.

This was pointed out to me by @Predelnik, who had a problem with the additional `SCN_UPDATEUI/SC_UPDATE_H_SCROLL` notification occurring when the window is being deactivated, see https://github.com/Predelnik/DSpellCheck/issues/221#issuecomment-696652074 for details.
This commit is contained in:
Udo Hoffmann 2020-09-22 16:48:28 +02:00 committed by Don HO
parent 2f90a0de18
commit 1a37b64fe6
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
1 changed files with 8 additions and 5 deletions

View File

@ -1645,11 +1645,14 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_ACTIVATE: case WM_ACTIVATE:
{ {
_pEditView->getFocus(); if (wParam != WA_INACTIVE)
auto x = _pEditView->execute(SCI_GETXOFFSET); {
_pEditView->execute(SCI_SETXOFFSET, x); _pEditView->getFocus();
x = _pNonEditView->execute(SCI_GETXOFFSET); auto x = _pEditView->execute(SCI_GETXOFFSET);
_pNonEditView->execute(SCI_SETXOFFSET, x); _pEditView->execute(SCI_SETXOFFSET, x);
x = _pNonEditView->execute(SCI_GETXOFFSET);
_pNonEditView->execute(SCI_SETXOFFSET, x);
}
return TRUE; return TRUE;
} }