Fix wrong dropped file view

Fix #14951, close #14953
This commit is contained in:
xomx 2024-04-07 21:22:45 +02:00 committed by Don Ho
parent 161bb41425
commit a92a9fd7c7

View File

@ -4280,15 +4280,17 @@ void Notepad_plus::dropFiles(HDROP hdrop)
if (hdrop) if (hdrop)
{ {
// Determinate in which view the file(s) is (are) dropped // Determinate in which view the file(s) is (are) dropped
POINT p; POINT p{};
::DragQueryPoint(hdrop, &p); ::DragQueryPoint(hdrop, &p);
HWND hWin = ::ChildWindowFromPointEx(_pPublicInterface->getHSelf(), p, CWP_SKIPINVISIBLE); HWND hWin = ::ChildWindowFromPointEx(_pPublicInterface->getHSelf(), p, CWP_SKIPINVISIBLE);
if (!hWin) return; if (!hWin) return;
if ((_subEditView.getHSelf() == hWin) || (_subDocTab.getHSelf() == hWin) || currentView() == SUB_VIEW) if ((_mainEditView.getHSelf() == hWin) || (_mainDocTab.getHSelf() == hWin))
switchEditViewTo(SUB_VIEW);
else
switchEditViewTo(MAIN_VIEW); switchEditViewTo(MAIN_VIEW);
else if ((_subEditView.getHSelf() == hWin) || (_subDocTab.getHSelf() == hWin))
switchEditViewTo(SUB_VIEW);
//else
// do not change the current Notepad++ edit-view
int filesDropped = ::DragQueryFile(hdrop, 0xffffffff, NULL, 0); int filesDropped = ::DragQueryFile(hdrop, 0xffffffff, NULL, 0);