Add a test case for accelerators, make the test pass on Wine.
This commit is contained in:
parent
7c7693f8d0
commit
b0c45123e5
|
@ -679,7 +679,6 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
|
|||
{
|
||||
UINT i;
|
||||
|
||||
key = toupperW(key);
|
||||
for (i = 0; i < menu->nItems; i++, item++)
|
||||
{
|
||||
if (IS_STRING_ITEM(item->fType) && item->text)
|
||||
|
@ -690,7 +689,7 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
|
|||
p = strchrW (p + 2, '&');
|
||||
}
|
||||
while (p != NULL && p [1] == '&');
|
||||
if (p && (toupperW(p[1]) == key)) return i;
|
||||
if (p && (toupperW(p[1]) == toupperW(key))) return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1476,7 +1475,6 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
|
|||
/* store the owner for DrawItem */
|
||||
menu->hwndOwner = hwndOwner;
|
||||
|
||||
|
||||
MENU_PopupMenuCalcSize( menu, hwndOwner );
|
||||
|
||||
/* adjust popup menu pos so that it fits within the desktop */
|
||||
|
@ -2848,13 +2846,9 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
|
|||
if (!(wFlags & TPM_NONOTIFY))
|
||||
{
|
||||
SendMessageW( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 );
|
||||
if ((menu = MENU_GetMenu( hMenu )) && (!menu->Height))
|
||||
{ /* app changed/recreated menu bar entries in WM_INITMENU
|
||||
Recalculate menu sizes else clicks will not work */
|
||||
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
||||
|
||||
}
|
||||
/* If an app changed/recreated menu bar entries in WM_INITMENU
|
||||
* menu sizes will be recalculated once the menu created/shown.
|
||||
*/
|
||||
}
|
||||
|
||||
/* This makes the menus of applications built with Delphi work.
|
||||
|
@ -2927,7 +2921,6 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
|
|||
if (!hTrackMenu || IsIconic(hwnd) || wChar == ' ' )
|
||||
{
|
||||
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_SYSMENU)) return;
|
||||
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_MANAGED) return;
|
||||
hTrackMenu = get_win_sys_menu( hwnd );
|
||||
uItem = 0;
|
||||
wParam |= HTSYSMENU; /* prevent item lookup */
|
||||
|
@ -2940,24 +2933,34 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
|
|||
if( wChar && wChar != ' ' )
|
||||
{
|
||||
uItem = MENU_FindItemByKey( hwnd, hTrackMenu, wChar, (wParam & HTSYSMENU) );
|
||||
if( uItem >= (UINT)(-2) )
|
||||
if ( uItem >= (UINT)(-2) )
|
||||
{
|
||||
if( uItem == (UINT)(-1) ) MessageBeep(0);
|
||||
hTrackMenu = 0;
|
||||
/* schedule end of menu tracking */
|
||||
PostMessageW( hwnd, WM_CANCELMODE, 0, 0 );
|
||||
goto track_menu;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* prevent sysmenu activation for managed windows on Alt down/up */
|
||||
if ((wParam & HTSYSMENU) && (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
|
||||
{
|
||||
/* schedule end of menu tracking */
|
||||
PostMessageW( hwnd, WM_CANCELMODE, 0, 0 );
|
||||
goto track_menu;
|
||||
}
|
||||
}
|
||||
|
||||
if( hTrackMenu )
|
||||
{
|
||||
MENU_SelectItem( hwnd, hTrackMenu, uItem, TRUE, 0 );
|
||||
MENU_SelectItem( hwnd, hTrackMenu, uItem, TRUE, 0 );
|
||||
|
||||
if( uItem == NO_SELECTED_ITEM )
|
||||
MENU_MoveSelection( hwnd, hTrackMenu, ITEM_NEXT );
|
||||
else if( wChar )
|
||||
PostMessageW( hwnd, WM_KEYDOWN, VK_DOWN, 0L );
|
||||
if( uItem == NO_SELECTED_ITEM )
|
||||
MENU_MoveSelection( hwnd, hTrackMenu, ITEM_NEXT );
|
||||
else
|
||||
PostMessageW( hwnd, WM_KEYDOWN, VK_DOWN, 0L );
|
||||
|
||||
MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hwnd, NULL );
|
||||
}
|
||||
track_menu:
|
||||
MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hwnd, NULL );
|
||||
MENU_ExitTracking( hwnd );
|
||||
}
|
||||
|
||||
|
@ -4518,13 +4521,17 @@ INT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen)
|
|||
static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam,
|
||||
BYTE fVirt, WORD key, WORD cmd )
|
||||
{
|
||||
INT mask = 0;
|
||||
UINT mesg = 0;
|
||||
|
||||
if (wParam != key) return FALSE;
|
||||
|
||||
if (GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
|
||||
if (GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
|
||||
|
||||
if (message == WM_CHAR || message == WM_SYSCHAR)
|
||||
{
|
||||
if ( !(fVirt & FALT) && !(fVirt & FVIRTKEY) )
|
||||
if ( !(fVirt & FVIRTKEY) && (mask & FALT) == (fVirt & FALT) )
|
||||
{
|
||||
TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", wParam & 0xff);
|
||||
goto found;
|
||||
|
@ -4534,12 +4541,9 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
|
|||
{
|
||||
if(fVirt & FVIRTKEY)
|
||||
{
|
||||
INT mask = 0;
|
||||
TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n",
|
||||
wParam, 0xff & HIWORD(lParam));
|
||||
if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
|
||||
if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
|
||||
if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
|
||||
|
||||
if(mask == (fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
|
||||
TRACE_(accel)(", but incorrect SHIFT/CTRL/ALT-state\n");
|
||||
}
|
||||
|
@ -4693,9 +4697,7 @@ INT WINAPI TranslateAcceleratorW( HWND hWnd, HACCEL hAccel, LPMSG msg )
|
|||
return 0;
|
||||
}
|
||||
if ( msg->message != WM_KEYDOWN &&
|
||||
msg->message != WM_KEYUP &&
|
||||
msg->message != WM_SYSKEYDOWN &&
|
||||
msg->message != WM_SYSKEYUP &&
|
||||
msg->message != WM_SYSCHAR &&
|
||||
msg->message != WM_CHAR ) return 0;
|
||||
|
||||
|
|
|
@ -2267,6 +2267,7 @@ static void test_messages(void)
|
|||
ok(!(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should not be set\n");
|
||||
ok(!IsWindowVisible(hchild), "IsWindowVisible() should return FALSE\n");
|
||||
|
||||
DestroyWindow(hchild);
|
||||
DestroyWindow(hparent);
|
||||
flush_sequence();
|
||||
|
||||
|
@ -2308,6 +2309,7 @@ static void test_messages(void)
|
|||
EnableWindow(hparent, FALSE);
|
||||
ok_sequence(WmEnableWindowSeq, "EnableWindow", FALSE);
|
||||
|
||||
DestroyWindow(hchild);
|
||||
DestroyWindow(hparent);
|
||||
flush_sequence();
|
||||
}
|
||||
|
@ -2790,6 +2792,247 @@ static void test_interthread_messages(void)
|
|||
CloseHandle(hThread);
|
||||
}
|
||||
|
||||
|
||||
static const struct message WmVkN[] = {
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_N, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_N, 1 },
|
||||
{ WM_CHAR, wparam|lparam, 'n', 1 },
|
||||
{ WM_COMMAND, sent|wparam|lparam, MAKEWPARAM(1002,1), 0 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
static const struct message WmShiftVkN[] = {
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_SHIFT, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_SHIFT, 1 },
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_N, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_N, 1 },
|
||||
{ WM_CHAR, wparam|lparam, 'N', 1 },
|
||||
{ WM_COMMAND, sent|wparam|lparam, MAKEWPARAM(1001,1), 0 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_SHIFT, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_SHIFT, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
static const struct message WmCtrlVkN[] = {
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_CONTROL, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_CONTROL, 1 },
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_N, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_N, 1 },
|
||||
{ WM_CHAR, wparam|lparam, 0x000e, 1 },
|
||||
{ WM_COMMAND, sent|wparam|lparam, MAKEWPARAM(1000,1), 0 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_CONTROL, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_CONTROL, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
static const struct message WmCtrlVkN_2[] = {
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_CONTROL, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_CONTROL, 1 },
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_N, 1 },
|
||||
{ WM_COMMAND, sent|wparam|lparam, MAKEWPARAM(1000,1), 0 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_N, 0xc0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_CONTROL, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_CONTROL, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
static const struct message WmAltVkN[] = {
|
||||
{ WM_SYSKEYDOWN, wparam|lparam, VK_MENU, 0x20000001 },
|
||||
{ WM_SYSKEYDOWN, sent|wparam|lparam, VK_MENU, 0x20000001 },
|
||||
{ WM_SYSKEYDOWN, wparam|lparam, VK_N, 0x20000001 },
|
||||
{ WM_SYSKEYDOWN, sent|wparam|lparam, VK_N, 0x20000001 },
|
||||
{ WM_SYSCHAR, wparam|lparam, 'n', 0x20000001 },
|
||||
{ WM_SYSCHAR, sent|wparam|lparam, 'n', 0x20000001 },
|
||||
{ WM_SYSCOMMAND, sent|defwinproc|wparam|lparam, SC_KEYMENU, 'n' },
|
||||
{ HCBT_SYSCOMMAND, hook },
|
||||
{ WM_ENTERMENULOOP, sent|defwinproc|wparam|lparam, 0, 0 },
|
||||
{ WM_SETCURSOR, sent|defwinproc },
|
||||
{ WM_INITMENU, sent|defwinproc },
|
||||
{ WM_MENUCHAR, sent|defwinproc|wparam, MAKEWPARAM('n',MF_SYSMENU) },
|
||||
{ WM_CAPTURECHANGED, sent|defwinproc },
|
||||
{ WM_MENUSELECT, sent|defwinproc|wparam, MAKEWPARAM(0,0xffff) },
|
||||
{ WM_EXITMENULOOP, sent|defwinproc },
|
||||
{ WM_MENUSELECT, sent|defwinproc|wparam|optional, MAKEWPARAM(0,0xffff) }, /* Win95 bug */
|
||||
{ WM_EXITMENULOOP, sent|defwinproc|optional }, /* Win95 bug */
|
||||
{ WM_SYSKEYUP, wparam|lparam, VK_N, 0xe0000001 },
|
||||
{ WM_SYSKEYUP, sent|wparam|lparam, VK_N, 0xe0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_MENU, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_MENU, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
static const struct message WmAltVkN_2[] = {
|
||||
{ WM_SYSKEYDOWN, wparam|lparam, VK_MENU, 0x20000001 },
|
||||
{ WM_SYSKEYDOWN, sent|wparam|lparam, VK_MENU, 0x20000001 },
|
||||
{ WM_SYSKEYDOWN, wparam|lparam, VK_N, 0x20000001 },
|
||||
{ WM_COMMAND, sent|wparam|lparam, MAKEWPARAM(1003,1), 0 },
|
||||
{ WM_SYSKEYUP, wparam|lparam, VK_N, 0xe0000001 },
|
||||
{ WM_SYSKEYUP, sent|wparam|lparam, VK_N, 0xe0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_MENU, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_MENU, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
static const struct message WmCtrlAltVkN[] = {
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_CONTROL, 1 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_CONTROL, 1 },
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_MENU, 0x20000001 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_MENU, 0x20000001 },
|
||||
{ WM_KEYDOWN, wparam|lparam, VK_N, 0x20000001 },
|
||||
{ WM_KEYDOWN, sent|wparam|lparam, VK_N, 0x20000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_N, 0xe0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_N, 0xe0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_MENU, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_MENU, 0xc0000001 },
|
||||
{ WM_KEYUP, wparam|lparam, VK_CONTROL, 0xc0000001 },
|
||||
{ WM_KEYUP, sent|wparam|lparam, VK_CONTROL, 0xc0000001 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void pump_msg_loop(HWND hwnd, HACCEL hAccel)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
struct message log_msg;
|
||||
|
||||
trace("accel: %p, %04x, %08x, %08lx\n", msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
|
||||
log_msg.message = msg.message;
|
||||
log_msg.flags = wparam|lparam;
|
||||
log_msg.wParam = msg.wParam;
|
||||
log_msg.lParam = msg.lParam;
|
||||
add_message(&log_msg);
|
||||
|
||||
if (!TranslateAccelerator(hwnd, hAccel, &msg))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test_accelerators(void)
|
||||
{
|
||||
SHORT state;
|
||||
HACCEL hAccel;
|
||||
HWND hwnd = CreateWindowExA(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW,
|
||||
100, 100, 200, 200, 0, 0, 0, NULL);
|
||||
assert(hwnd != 0);
|
||||
|
||||
SetFocus(hwnd);
|
||||
ok(GetFocus() == hwnd, "wrong focus window %p\n", GetFocus());
|
||||
|
||||
state = GetKeyState(VK_SHIFT);
|
||||
ok(!(state & 0x8000), "wrong Shift state %04x\n", state);
|
||||
state = GetKeyState(VK_CAPITAL);
|
||||
ok(state == 0, "wrong CapsLock state %04x\n", state);
|
||||
|
||||
hAccel = LoadAccelerators(GetModuleHandleA(0), MAKEINTRESOURCE(1));
|
||||
assert(hAccel != 0);
|
||||
|
||||
trace("testing VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmVkN, "VK_N press/release", FALSE);
|
||||
|
||||
trace("testing Shift+VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_SHIFT, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmShiftVkN, "Shift+VK_N press/release", FALSE);
|
||||
|
||||
trace("testing Ctrl+VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_CONTROL, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmCtrlVkN, "Ctrl+VK_N press/release", FALSE);
|
||||
|
||||
trace("testing Alt+VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_MENU, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmAltVkN, "Alt+VK_N press/release", FALSE);
|
||||
|
||||
trace("testing Ctrl+Alt+VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_CONTROL, 0, 0, 0);
|
||||
keybd_event(VK_MENU, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmCtrlAltVkN, "Ctrl+Alt+VK_N press/release 1", FALSE);
|
||||
|
||||
ok(DestroyAcceleratorTable(hAccel), "DestroyAcceleratorTable error %ld\n", GetLastError());
|
||||
|
||||
hAccel = LoadAccelerators(GetModuleHandleA(0), MAKEINTRESOURCE(2));
|
||||
assert(hAccel != 0);
|
||||
|
||||
trace("testing VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmVkN, "VK_N press/release", FALSE);
|
||||
|
||||
trace("testing Shift+VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_SHIFT, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmShiftVkN, "Shift+VK_N press/release", FALSE);
|
||||
|
||||
trace("testing Ctrl+VK_N press/release 2\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_CONTROL, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmCtrlVkN_2, "Ctrl+VK_N press/release 2", FALSE);
|
||||
|
||||
trace("testing Alt+VK_N press/release 2\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_MENU, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmAltVkN_2, "Alt+VK_N press/release 2", FALSE);
|
||||
|
||||
trace("testing Ctrl+Alt+VK_N press/release\n");
|
||||
flush_sequence();
|
||||
keybd_event(VK_CONTROL, 0, 0, 0);
|
||||
keybd_event(VK_MENU, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, 0, 0);
|
||||
keybd_event(VK_N, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
|
||||
pump_msg_loop(hwnd, hAccel);
|
||||
ok_sequence(WmCtrlAltVkN, "Ctrl+Alt+VK_N press/release 2", FALSE);
|
||||
|
||||
ok(DestroyAcceleratorTable(hAccel), "DestroyAcceleratorTable error %ld\n", GetLastError());
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
/************* window procedures ********************/
|
||||
|
||||
static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -3159,6 +3402,7 @@ START_TEST(msg)
|
|||
test_paint_messages();
|
||||
test_interthread_messages();
|
||||
test_message_conversion();
|
||||
test_accelerators();
|
||||
|
||||
UnhookWindowsHookEx(hCBT_hook);
|
||||
}
|
||||
|
|
|
@ -20,36 +20,50 @@
|
|||
#include "windef.h"
|
||||
#include "winuser.h"
|
||||
|
||||
STRINGTABLE {
|
||||
0 "String resource"
|
||||
1 ACCELERATORS
|
||||
{
|
||||
"^N", 1000 /* Ctrl+'N' */
|
||||
"N", 1001 /* Shift+'n' */
|
||||
"n", 1002 /* 'n' */
|
||||
}
|
||||
|
||||
2 ACCELERATORS
|
||||
{
|
||||
78, 1000, VIRTKEY, CONTROL /* Ctrl+'N' */
|
||||
78, 1001, ASCII /* 'N' */
|
||||
110, 1002, ASCII /* 'n' */
|
||||
78, 1003, VIRTKEY, ALT /* Alt+'N' */
|
||||
}
|
||||
|
||||
STRINGTABLE
|
||||
{
|
||||
0 "String resource"
|
||||
}
|
||||
|
||||
TEST_DIALOG DIALOG DISCARDABLE 0, 0, 60, 30
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
|
||||
CAPTION "Test dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
{
|
||||
DEFPUSHBUTTON "OK", IDOK,4,4,50,14, WS_TABSTOP | WS_GROUP
|
||||
END
|
||||
}
|
||||
|
||||
RADIO_TEST_DIALOG DIALOGEX 0, 0, 160, 80
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Radio Button Test Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
{
|
||||
GROUPBOX "Static", 100,6,5,92,70
|
||||
CONTROL "Radio1", 200,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP | WS_TABSTOP,17,27,39,10
|
||||
CONTROL "Radio2", 201,"Button",BS_AUTORADIOBUTTON,17,40,39,10
|
||||
PUSHBUTTON "Cancel", IDCANCEL,109,20,50,14, WS_TABSTOP | WS_GROUP
|
||||
END
|
||||
|
||||
|
||||
}
|
||||
|
||||
CLASS_TEST_DIALOG DIALOG DISCARDABLE 0, 0, 91, 28
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CreateDialogParams Test"
|
||||
CLASS "TestDialog"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
END
|
||||
{
|
||||
}
|
||||
|
|
|
@ -2061,6 +2061,12 @@ INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|||
if (hkl != X11DRV_GetKeyboardLayout(0))
|
||||
FIXME("keyboard layout %p is not supported\n", hkl);
|
||||
|
||||
if ((lpKeyState[VK_MENU] & 0x80) && (lpKeyState[VK_CONTROL] & 0x80))
|
||||
{
|
||||
TRACE("Ctrl+Alt+[key] won't generate a character\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
e.display = display;
|
||||
e.keycode = 0;
|
||||
e.state = 0;
|
||||
|
|
|
@ -553,10 +553,9 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
|
|||
}
|
||||
}
|
||||
else if( wParam == VK_F10 )
|
||||
iF10Key = 1;
|
||||
else
|
||||
if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
|
||||
SendMessageW( hwnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
|
||||
iF10Key = 1;
|
||||
else if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
|
||||
SendMessageW( hwnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
|
|
Loading…
Reference in New Issue