diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 499d9c5e8..67aaf3395 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -253,6 +253,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin // of the last session from config.xml. ::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_PROJECT_PANEL_1, 0); } + ::SendMessage(_hSelf, WM_ACTIVATE, WA_ACTIVE, 0); // Notify plugins that Notepad++ is ready SCNotification scnN; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index 1e98fa857..929149c18 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -1185,6 +1185,7 @@ void DockingCont::showToolbar(tTbData* pTbData, BOOL state) int DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient) { int iItem = searchPosInTab(pTbData); + BOOL hadFocus = ::IsChild (pTbData->hClient, ::GetFocus()); // delete item if (TRUE == ::SendMessage(_hContTab, TCM_DELETEITEM, iItem, 0)) @@ -1218,6 +1219,9 @@ int DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient) { ::SendMessage(_hParent, WM_SIZE, 0, 0); } + // set focus to current edit window if the docking window had focus + if (hadFocus) + ::PostMessage(::GetParent(_hParent), WM_ACTIVATE, WA_ACTIVE, 0); } // keep sure, that client is hide!!! diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index 845fbd79c..6d859c37b 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -361,8 +361,6 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l { tTbData TbData = *(reinterpret_cast(lParam))->getDataOfActiveTb(); LRESULT res = SendNotify(TbData.hClient, DMN_CLOSE); // Be sure the active item is OK with closing - if (res == 0) // Item will be closing? - ::PostMessage(_hParent, WM_ACTIVATE, WA_ACTIVE, 0); // Tell editor to take back focus return res; } case DMM_FLOATALL: