mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 22:01:21 +00:00
properly initialize system menu items
svn path=/trunk/; revision=8951
This commit is contained in:
parent
eec82162fb
commit
23e366974c
2 changed files with 43 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: defwnd.c,v 1.127 2004/03/31 14:12:04 weiden Exp $
|
/* $Id: defwnd.c,v 1.128 2004/04/02 19:00:56 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -30,6 +30,7 @@ LRESULT DefWndNCActivate(HWND hWnd, WPARAM wParam);
|
||||||
LRESULT DefWndNCHitTest(HWND hWnd, POINT Point);
|
LRESULT DefWndNCHitTest(HWND hWnd, POINT Point);
|
||||||
LRESULT DefWndNCLButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
LRESULT DefWndNCLButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
LRESULT DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
||||||
|
void FASTCALL MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle, LONG HitTest );
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
@ -1044,9 +1045,9 @@ User32DefWindowProc(HWND hWnd,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LONG HitCode;
|
|
||||||
POINT Pt;
|
POINT Pt;
|
||||||
DWORD Style;
|
DWORD Style;
|
||||||
|
LONG HitCode;
|
||||||
|
|
||||||
Style = GetWindowLongW(hWnd, GWL_STYLE);
|
Style = GetWindowLongW(hWnd, GWL_STYLE);
|
||||||
|
|
||||||
|
@ -1062,18 +1063,19 @@ User32DefWindowProc(HWND hWnd,
|
||||||
if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
|
if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
|
||||||
{
|
{
|
||||||
HMENU SystemMenu;
|
HMENU SystemMenu;
|
||||||
UINT DefItem = SC_CLOSE;
|
UINT Flags;
|
||||||
|
|
||||||
if((SystemMenu = GetSystemMenu(hWnd, FALSE)))
|
if((SystemMenu = GetSystemMenu(hWnd, FALSE)))
|
||||||
{
|
{
|
||||||
|
MenuInitSysMenuPopup(SystemMenu, GetWindowLongW(hWnd, GWL_STYLE),
|
||||||
|
GetClassLongW(hWnd, GCL_STYLE), HitCode);
|
||||||
|
|
||||||
if(HitCode == HTCAPTION)
|
if(HitCode == HTCAPTION)
|
||||||
DefItem = ((Style & (WS_MAXIMIZE | WS_MINIMIZE)) ?
|
Flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON;
|
||||||
SC_RESTORE : SC_MAXIMIZE);
|
else
|
||||||
|
Flags = TPM_LEFTBUTTON;
|
||||||
|
|
||||||
SetMenuDefaultItem(SystemMenu, DefItem, MF_BYCOMMAND);
|
TrackPopupMenu(SystemMenu, Flags,
|
||||||
|
|
||||||
TrackPopupMenu(SystemMenu,
|
|
||||||
TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
|
||||||
Pt.x, Pt.y, 0, hWnd, NULL);
|
Pt.x, Pt.y, 0, hWnd, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: menu.c,v 1.59 2004/04/01 23:17:28 gvg Exp $
|
/* $Id: menu.c,v 1.60 2004/04/02 19:00:56 weiden Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/menu.c
|
* FILE: lib/user32/windows/menu.c
|
||||||
|
@ -1984,10 +1984,12 @@ MenuMoveSelection(HWND WndOwner, PROSMENUINFO MenuInfo, INT Offset)
|
||||||
*
|
*
|
||||||
* Grey the appropriate items in System menu.
|
* Grey the appropriate items in System menu.
|
||||||
*/
|
*/
|
||||||
static void FASTCALL
|
void FASTCALL
|
||||||
MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle )
|
MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle, LONG HitTest )
|
||||||
{
|
{
|
||||||
BOOL Gray;
|
BOOL Gray;
|
||||||
|
UINT DefItem;
|
||||||
|
MENUITEMINFOW mii;
|
||||||
|
|
||||||
Gray = 0 == (Style & WS_THICKFRAME) || 0 != (Style & (WS_MAXIMIZE | WS_MINIMIZE));
|
Gray = 0 == (Style & WS_THICKFRAME) || 0 != (Style & (WS_MAXIMIZE | WS_MINIMIZE));
|
||||||
EnableMenuItem(Menu, SC_SIZE, (Gray ? MF_GRAYED : MF_ENABLED));
|
EnableMenuItem(Menu, SC_SIZE, (Gray ? MF_GRAYED : MF_ENABLED));
|
||||||
|
@ -2006,6 +2008,31 @@ MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD ClsStyle )
|
||||||
{
|
{
|
||||||
EnableMenuItem(Menu, SC_CLOSE, MF_GRAYED);
|
EnableMenuItem(Menu, SC_CLOSE, MF_GRAYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set default menu item */
|
||||||
|
if(Style & WS_MINIMIZE)
|
||||||
|
{
|
||||||
|
DefItem = SC_RESTORE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(HitTest == HTCAPTION)
|
||||||
|
{
|
||||||
|
DefItem = ((Style & (WS_MAXIMIZE | WS_MINIMIZE)) ? SC_RESTORE : SC_MAXIMIZE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DefItem = SC_CLOSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mii.cbSize = sizeof(MENUITEMINFOW);
|
||||||
|
mii.fMask = MIIM_STATE;
|
||||||
|
if(GetMenuItemInfoW(Menu, DefItem, FALSE, &mii) &&
|
||||||
|
(mii.fState & (MFS_GRAYED | MFS_DISABLED)))
|
||||||
|
{
|
||||||
|
DefItem = SC_CLOSE;
|
||||||
|
}
|
||||||
|
SetMenuDefaultItem(Menu, DefItem, MF_BYCOMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2093,9 +2120,8 @@ MenuShowSubPopup(HWND WndOwner, PROSMENUINFO MenuInfo, BOOL SelectFirst, UINT Fl
|
||||||
|
|
||||||
if (IS_SYSTEM_MENU(MenuInfo))
|
if (IS_SYSTEM_MENU(MenuInfo))
|
||||||
{
|
{
|
||||||
MenuInitSysMenuPopup(ItemInfo.hSubMenu,
|
MenuInitSysMenuPopup(ItemInfo.hSubMenu, GetWindowLongW(MenuInfo->Wnd, GWL_STYLE),
|
||||||
GetWindowLongW(MenuInfo->Wnd, GWL_STYLE ),
|
GetClassLongW(MenuInfo->Wnd, GCL_STYLE), FALSE);
|
||||||
GetClassLongW(MenuInfo->Wnd, GCL_STYLE));
|
|
||||||
|
|
||||||
NcGetSysPopupPos(MenuInfo->Wnd, &Rect);
|
NcGetSysPopupPos(MenuInfo->Wnd, &Rect);
|
||||||
Rect.top = Rect.bottom;
|
Rect.top = Rect.bottom;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue