- Fix loop when using arrow keys in menu mode, other miscellaneous code changes.

svn path=/trunk/; revision=51574
This commit is contained in:
James Tabor 2011-05-04 12:18:57 +00:00
parent 40222f1c75
commit 0c937e4c37

View file

@ -2913,8 +2913,8 @@ MenuDoNextMenu(MTRACKER* Mt, UINT Vk, UINT wFlags)
if (NewWnd != Mt->OwnerWnd) if (NewWnd != Mt->OwnerWnd)
{ {
Mt->OwnerWnd = NewWnd; Mt->OwnerWnd = NewWnd;
SetCapture(Mt->OwnerWnd); (void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, Mt->OwnerWnd); // 1
(void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, Mt->OwnerWnd); SetCapture(Mt->OwnerWnd); // 2
} }
Mt->TopMenu = Mt->CurrentMenu = NewMenu; /* all subpopups are hidden */ Mt->TopMenu = Mt->CurrentMenu = NewMenu; /* all subpopups are hidden */
@ -2936,25 +2936,25 @@ MenuDoNextMenu(MTRACKER* Mt, UINT Vk, UINT wFlags)
* going to hide it anyway. * going to hide it anyway.
*/ */
static BOOL FASTCALL static BOOL FASTCALL
MenuSuspendPopup(MTRACKER* Mt, UINT Message) MenuSuspendPopup(MTRACKER* Mt, UINT uMsg)
{ {
MSG Msg; MSG msg;
Msg.hwnd = Mt->OwnerWnd; msg.hwnd = Mt->OwnerWnd;
PeekMessageW(&Msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE); PeekMessageW( &msg, 0, uMsg, uMsg, PM_NOYIELD | PM_REMOVE); // ported incorrectly since 8317 GvG
Mt->TrackFlags |= TF_SKIPREMOVE; // Mt->TrackFlags |= TF_SKIPREMOVE; // This sends TrackMenu into a loop with arrow keys!!!!
switch (Message) switch( uMsg )
{ {
case WM_KEYDOWN: case WM_KEYDOWN:
PeekMessageW(&Msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE); PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE);
if (WM_KEYUP == Msg.message || WM_PAINT == Msg.message) if( msg.message == WM_KEYUP || msg.message == WM_PAINT )
{ {
PeekMessageW(&Msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE); PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE);
PeekMessageW(&Msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE); PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE);
if (WM_KEYDOWN == Msg.message if( msg.message == WM_KEYDOWN &&
&& (VK_LEFT == Msg.wParam || VK_RIGHT == Msg.wParam)) (msg.wParam == VK_LEFT || msg.wParam == VK_RIGHT))
{ {
Mt->TrackFlags |= TF_SUSPENDPOPUP; Mt->TrackFlags |= TF_SUSPENDPOPUP;
return TRUE; return TRUE;
@ -2962,10 +2962,8 @@ MenuSuspendPopup(MTRACKER* Mt, UINT Message)
} }
break; break;
} }
/* failures go through this */ /* failures go through this */
Mt->TrackFlags &= ~TF_SUSPENDPOPUP; Mt->TrackFlags &= ~TF_SUSPENDPOPUP;
return FALSE; return FALSE;
} }
@ -3029,7 +3027,7 @@ MenuKeyLeft(MTRACKER* Mt, UINT Flags)
} }
/* Try to move 1 column left (if possible) */ /* Try to move 1 column left (if possible) */
if (NO_SELECTED_ITEM != (PrevCol = MenuGetStartOfPrevColumn(&MenuInfo))) if ( (PrevCol = MenuGetStartOfPrevColumn(&MenuInfo)) != NO_SELECTED_ITEM)
{ {
if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu)) if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu))
{ {
@ -3056,7 +3054,7 @@ MenuKeyLeft(MTRACKER* Mt, UINT Flags)
{ {
return; return;
} }
if ((MenuPrev == Mt->TopMenu) && 0 == (TopMenuInfo.Flags & MF_POPUP)) if ((MenuPrev == Mt->TopMenu) && !(TopMenuInfo.Flags & MF_POPUP))
{ {
/* move menu bar selection if no more popups are left */ /* move menu bar selection if no more popups are left */
@ -3065,7 +3063,7 @@ MenuKeyLeft(MTRACKER* Mt, UINT Flags)
MenuMoveSelection(Mt->OwnerWnd, &TopMenuInfo, ITEM_PREV); MenuMoveSelection(Mt->OwnerWnd, &TopMenuInfo, ITEM_PREV);
} }
if (MenuPrev != MenuTmp || 0 != (Mt->TrackFlags & TF_SUSPENDPOPUP)) if (MenuPrev != MenuTmp || Mt->TrackFlags & TF_SUSPENDPOPUP)
{ {
/* A sublevel menu was displayed - display the next one /* A sublevel menu was displayed - display the next one
* unless there is another displacement coming up */ * unless there is another displacement coming up */
@ -3116,7 +3114,7 @@ static void FASTCALL MenuKeyRight(MTRACKER *Mt, UINT Flags)
} }
/* Check to see if there's another column */ /* Check to see if there's another column */
if (NO_SELECTED_ITEM != (NextCol = MenuGetStartOfNextColumn(&CurrentMenuInfo))) if ( (NextCol = MenuGetStartOfNextColumn(&CurrentMenuInfo)) != NO_SELECTED_ITEM)
{ {
TRACE("Going to %d.\n", NextCol); TRACE("Going to %d.\n", NextCol);
if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu)) if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu))
@ -3126,7 +3124,7 @@ static void FASTCALL MenuKeyRight(MTRACKER *Mt, UINT Flags)
return; return;
} }
if (0 == (MenuInfo.Flags & MF_POPUP)) /* menu bar tracking */ if (!(MenuInfo.Flags & MF_POPUP)) /* menu bar tracking */
{ {
if (Mt->CurrentMenu != Mt->TopMenu) if (Mt->CurrentMenu != Mt->TopMenu)
{ {
@ -3668,7 +3666,6 @@ VOID MenuTrackKbdMenuBar(HWND hwnd, UINT wParam, WCHAR wChar)
track_menu: track_menu:
MenuTrackMenu( hTrackMenu, wFlags, 0, 0, hwnd, NULL ); MenuTrackMenu( hTrackMenu, wFlags, 0, 0, hwnd, NULL );
MenuExitTracking( hwnd, FALSE ); MenuExitTracking( hwnd, FALSE );
} }
/********************************************************************** /**********************************************************************