Added proper support for 32-bit WM_NEXTMENU.

This commit is contained in:
Alexandre Julliard 2001-08-18 18:10:04 +00:00
parent 4ff32c8aef
commit b3ec03092f
2 changed files with 41 additions and 8 deletions

View File

@ -2323,16 +2323,20 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
if( (vk == VK_LEFT && menu->FocusedItem == 0 ) || if( (vk == VK_LEFT && menu->FocusedItem == 0 ) ||
(vk == VK_RIGHT && menu->FocusedItem == menu->nItems - 1)) (vk == VK_RIGHT && menu->FocusedItem == menu->nItems - 1))
{ {
MDINEXTMENU next_menu;
HMENU hNewMenu; HMENU hNewMenu;
HWND hNewWnd; HWND hNewWnd;
UINT id = 0; UINT id = 0;
LRESULT l = SendMessageA( pmt->hOwnerWnd, WM_NEXTMENU, vk,
(IS_SYSTEM_MENU(menu)) ? GetSubMenu(pmt->hTopMenu,0) : pmt->hTopMenu ); next_menu.hmenuIn = (IS_SYSTEM_MENU(menu)) ? GetSubMenu(pmt->hTopMenu,0) : pmt->hTopMenu;
next_menu.hmenuNext = 0;
next_menu.hwndNext = 0;
SendMessageW( pmt->hOwnerWnd, WM_NEXTMENU, vk, (LPARAM)&next_menu );
TRACE("%04x [%04x] -> %04x [%04x]\n", TRACE("%04x [%04x] -> %04x [%04x]\n",
(UINT16)pmt->hCurrentMenu, (UINT16)pmt->hOwnerWnd, LOWORD(l), HIWORD(l) ); pmt->hCurrentMenu, pmt->hOwnerWnd, next_menu.hmenuNext, next_menu.hwndNext );
if( l == 0 ) if (!next_menu.hmenuNext || !next_menu.hwndNext)
{ {
DWORD style = GetWindowLongA( pmt->hOwnerWnd, GWL_STYLE ); DWORD style = GetWindowLongA( pmt->hOwnerWnd, GWL_STYLE );
hNewWnd = pmt->hOwnerWnd; hNewWnd = pmt->hOwnerWnd;
@ -2357,8 +2361,8 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
} }
else /* application returned a new menu to switch to */ else /* application returned a new menu to switch to */
{ {
hNewMenu = LOWORD(l); hNewMenu = next_menu.hmenuNext;
hNewWnd = HIWORD(l); hNewWnd = next_menu.hwndNext;
if( IsMenu(hNewMenu) && IsWindow(hNewWnd) ) if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
{ {

View File

@ -1309,9 +1309,18 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
*plparam = (LPARAM) idThread; *plparam = (LPARAM) idThread;
} }
return 0; return 0;
case WM_NEXTMENU:
{
MDINEXTMENU *next = HeapAlloc( GetProcessHeap(), 0, sizeof(*next) );
if (!next) return -1;
next->hmenuIn = *plparam;
next->hmenuNext = 0;
next->hwndNext = 0;
*plparam = (LPARAM)next;
return 1;
}
case WM_PAINTCLIPBOARD: case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD: case WM_SIZECLIPBOARD:
case WM_NEXTMENU:
FIXME_(msg)("message %04x needs translation\n",msg16 ); FIXME_(msg)("message %04x needs translation\n",msg16 );
return -1; return -1;
@ -1415,6 +1424,13 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
HeapFree( GetProcessHeap(), 0, msg32 ); HeapFree( GetProcessHeap(), 0, msg32 );
} }
break; break;
case WM_NEXTMENU:
{
MDINEXTMENU *next = (MDINEXTMENU *)lParam;
result = MAKELONG( next->hmenuNext, next->hwndNext );
HeapFree( GetProcessHeap(), 0, next );
}
break;
} }
return result; return result;
} }
@ -2036,9 +2052,14 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32,
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
if (*plparam) *plparam = (LPARAM)THREAD_IdToTEB((DWORD) *plparam)->htask16; if (*plparam) *plparam = (LPARAM)THREAD_IdToTEB((DWORD) *plparam)->htask16;
return 0; return 0;
case WM_NEXTMENU:
{
MDINEXTMENU *next = (MDINEXTMENU *)*plparam;
*plparam = next->hmenuIn;
return 1;
}
case WM_PAINTCLIPBOARD: case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD: case WM_SIZECLIPBOARD:
case WM_NEXTMENU:
FIXME_(msg)("message %04x needs translation\n", msg32 ); FIXME_(msg)("message %04x needs translation\n", msg32 );
return -1; return -1;
/* following messages should not be sent to 16-bit apps */ /* following messages should not be sent to 16-bit apps */
@ -2207,6 +2228,14 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
SEGPTR_FREE(msg16); SEGPTR_FREE(msg16);
} }
break; break;
case WM_NEXTMENU:
{
MDINEXTMENU *next = (MDINEXTMENU *)lParam;
next->hmenuNext = LOWORD(p16->lResult);
next->hwndNext = HIWORD(p16->lResult);
p16->lResult = 0;
}
break;
} }
} }