Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
556490d3
Commit
556490d3
authored
Nov 02, 2021
by
Ziqing Hui
Committed by
Alexandre Julliard
Nov 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add ALT+letter hotkey tests.
Signed-off-by:
Ziqing Hui
<
zhui@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
56dde41b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
2 deletions
+79
-2
msg.c
dlls/user32/tests/msg.c
+79
-2
No files found.
dlls/user32/tests/msg.c
View file @
556490d3
...
...
@@ -17359,6 +17359,29 @@ static const struct message WmHotkeyNew[] = {
{
WM_KEYUP
,
sent
,
0
,
0x80000001
},
/* lparam not checked so the sequence isn't a todo */
{
0
}
};
static
const
struct
message
WmHotkeyPressALT
[]
=
{
{
WM_SYSKEYDOWN
,
kbd_hook
|
wparam
|
lparam
,
VK_LMENU
,
LLKHF_INJECTED
|
LLKHF_ALTDOWN
},
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
VK_MENU
,
0x20000001
},
{
WM_SYSKEYDOWN
,
sent
|
wparam
|
lparam
,
VK_MENU
,
0x20000001
},
{
0
}
};
static
const
struct
message
WmHotkeyPressWithALT
[]
=
{
{
WM_SYSKEYDOWN
,
kbd_hook
,
0
,
LLKHF_INJECTED
|
LLKHF_ALTDOWN
},
/* lparam not checked */
{
WM_HOTKEY
,
sent
|
wparam
,
6
},
{
0
}
};
static
const
struct
message
WmHotkeyReleaseWithALT
[]
=
{
{
WM_SYSKEYUP
,
kbd_hook
|
lparam
,
0
,
LLKHF_INJECTED
|
LLKHF_UP
|
LLKHF_ALTDOWN
},
{
HCBT_KEYSKIPPED
,
hook
|
lparam
|
optional
,
0
,
0xa0000001
},
{
WM_SYSKEYUP
,
sent
|
lparam
,
0
,
0xa0000001
},
{
0
}
};
static
const
struct
message
WmHotkeyReleaseALT
[]
=
{
{
WM_KEYUP
,
kbd_hook
|
wparam
|
lparam
,
VK_LMENU
,
LLKHF_INJECTED
|
LLKHF_UP
},
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
VK_MENU
,
0xc0000001
},
{
WM_KEYUP
,
sent
|
wparam
|
lparam
,
VK_MENU
,
0xc0000001
},
{
0
}
};
static
int
hotkey_letter
;
...
...
@@ -17378,9 +17401,12 @@ static LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam
msg
.
descr
=
"KeyboardHookProc"
;
add_message
(
&
msg
);
if
(
wParam
==
WM_KEYUP
||
wParam
==
WM_KEYDOWN
)
if
(
wParam
==
WM_KEYUP
||
wParam
==
WM_KEYDOWN
||
wParam
==
WM_SYSKEYUP
||
wParam
==
WM_SYSKEYDOWN
)
{
ok
(
kdbhookstruct
->
vkCode
==
VK_LWIN
||
kdbhookstruct
->
vkCode
==
hotkey_letter
,
ok
(
kdbhookstruct
->
vkCode
==
VK_LWIN
||
kdbhookstruct
->
vkCode
==
VK_LMENU
||
kdbhookstruct
->
vkCode
==
hotkey_letter
,
"unexpected keycode %x
\n
"
,
kdbhookstruct
->
vkCode
);
}
}
...
...
@@ -17635,6 +17661,56 @@ static void test_hotkey(void)
}
ok_sequence
(
WmHotkeyReleaseLWIN
,
"thread hotkey release LWIN"
,
FALSE
);
/* Search for an ALT + letter combination that hasn't been registered */
for
(
hotkey_letter
=
0x41
;
hotkey_letter
<=
0x51
;
hotkey_letter
++
)
{
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
test_window
,
6
,
MOD_ALT
,
hotkey_letter
);
if
(
ret
==
TRUE
)
{
break
;
}
else
{
ok
(
GetLastError
()
==
ERROR_HOTKEY_ALREADY_REGISTERED
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"unexpected error %d
\n
"
,
GetLastError
());
}
}
if
(
hotkey_letter
==
0x52
)
{
ok
(
0
,
"Couldn't find any free ALT + letter combination
\n
"
);
goto
end
;
}
keybd_event
(
VK_LMENU
,
0
,
0
,
0
);
while
(
PeekMessageA
(
&
msg
,
NULL
,
0
,
0
,
PM_REMOVE
))
DispatchMessageA
(
&
msg
);
ok_sequence
(
WmHotkeyPressALT
,
"window hotkey press ALT"
,
TRUE
);
keybd_event
(
hotkey_letter
,
0
,
0
,
0
);
while
(
PeekMessageA
(
&
msg
,
NULL
,
0
,
0
,
PM_REMOVE
))
{
if
(
msg
.
message
==
WM_HOTKEY
)
{
ok
(
msg
.
hwnd
==
test_window
,
"unexpected hwnd %p
\n
"
,
msg
.
hwnd
);
ok
(
msg
.
lParam
==
MAKELPARAM
(
MOD_ALT
,
hotkey_letter
),
"unexpected WM_HOTKEY lparam %lx
\n
"
,
msg
.
lParam
);
}
DispatchMessageA
(
&
msg
);
}
ok_sequence
(
WmHotkeyPressWithALT
,
"window hotkey press with ALT"
,
TRUE
);
keybd_event
(
hotkey_letter
,
0
,
KEYEVENTF_KEYUP
,
0
);
while
(
PeekMessageA
(
&
msg
,
NULL
,
0
,
0
,
PM_REMOVE
))
DispatchMessageA
(
&
msg
);
ok_sequence
(
WmHotkeyReleaseWithALT
,
"window hotkey release with ALT"
,
TRUE
);
keybd_event
(
VK_LMENU
,
0
,
KEYEVENTF_KEYUP
,
0
);
while
(
PeekMessageA
(
&
msg
,
NULL
,
0
,
0
,
PM_REMOVE
))
DispatchMessageA
(
&
msg
);
ok_sequence
(
WmHotkeyReleaseALT
,
"window hotkey release ALT"
,
FALSE
);
/* Unregister thread hotkey */
ret
=
UnregisterHotKey
(
NULL
,
5
);
ok
(
ret
==
TRUE
,
"expected TRUE, got %i, err=%d
\n
"
,
ret
,
GetLastError
());
...
...
@@ -17645,6 +17721,7 @@ static void test_hotkey(void)
end:
UnregisterHotKey
(
NULL
,
5
);
UnregisterHotKey
(
test_window
,
5
);
UnregisterHotKey
(
test_window
,
6
);
DestroyWindow
(
test_window
);
flush_sequence
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment