mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-06-14 11:26:38 +10:00
Don't close menu(s) on certain operations
In several cases we don't want menu(s) to close when an action on menu was done. For example on drag-n-drop or menu item deletion (where confirmation dialog is shown). In such situations `s_bPreventClosing` was set to true (and then back to false when closing was allowed again). Though original code honored this variable only in certain situations and typically (at least on Win10) menus were hidden/closed despite of it. This patch changes the behavior and menus(s) are not closed when `s_bPreventClosing` is set to true. Basically now menu(s) stay visible until there is an action that changes active window. Following functionality was also removed because it is not needed now: * CMenuContainer::HideTemp * COwnerWindow::OnClear WM_CLEAR was sent to the window only by already removed `HideTemp`
This commit is contained in:
@@ -2396,7 +2396,6 @@ void CMenuContainer::ActivateItem( int index, TActivateType type, const POINT *p
|
||||
}
|
||||
}
|
||||
DestroyMenu(menu2);
|
||||
HideTemp(false);
|
||||
s_bPreventClosing=false;
|
||||
|
||||
PITEMID_CHILD newPidl=NULL;
|
||||
@@ -2485,7 +2484,6 @@ void CMenuContainer::ActivateItem( int index, TActivateType type, const POINT *p
|
||||
Invalidate();
|
||||
if (m_HotItem<0) SetHotItem(index);
|
||||
}
|
||||
HideTemp(false);
|
||||
s_bPreventClosing=false;
|
||||
}
|
||||
SetContextItem(-1);
|
||||
@@ -2742,7 +2740,6 @@ void CMenuContainer::ActivateItem( int index, TActivateType type, const POINT *p
|
||||
else
|
||||
SetFocus();
|
||||
}
|
||||
HideTemp(false);
|
||||
s_bPreventClosing=false;
|
||||
s_HotPos=GetMessagePos();
|
||||
res=CMD_RENAME;
|
||||
@@ -2802,8 +2799,7 @@ void CMenuContainer::ActivateItem( int index, TActivateType type, const POINT *p
|
||||
if (bRefresh || bRefreshMain)
|
||||
info.fMask|=CMIC_MASK_NOASYNC; // wait for delete/link commands to finish so we can refresh the menu
|
||||
|
||||
if ((type!=ACTIVATE_MENU && type!=ACTIVATE_DELETE) || GetWinVersion()<WIN_VER_WIN8)
|
||||
s_bPreventClosing=true;
|
||||
s_bPreventClosing=true;
|
||||
for (std::vector<CMenuContainer*>::iterator it=s_Menus.begin();it!=s_Menus.end();++it)
|
||||
(*it)->EnableWindow(FALSE); // disable all menus
|
||||
bool bAllPrograms=s_bAllPrograms;
|
||||
@@ -2880,7 +2876,6 @@ void CMenuContainer::ActivateItem( int index, TActivateType type, const POINT *p
|
||||
else
|
||||
SetFocus();
|
||||
}
|
||||
HideTemp(false);
|
||||
s_bPreventClosing=false;
|
||||
|
||||
if (!bKeepOpen && !bRefresh && !bRefreshMain)
|
||||
|
||||
Reference in New Issue
Block a user