Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
b0c45123
Commit
b0c45123
authored
Oct 05, 2004
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 05, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test case for accelerators, make the test pass on Wine.
parent
7c7693f8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
308 additions
and
43 deletions
+308
-43
menu.c
dlls/user/menu.c
+31
-29
msg.c
dlls/user/tests/msg.c
+244
-0
resource.rc
dlls/user/tests/resource.rc
+24
-10
keyboard.c
dlls/x11drv/keyboard.c
+6
-0
defwnd.c
windows/defwnd.c
+3
-4
No files found.
dlls/user/menu.c
View file @
b0c45123
...
...
@@ -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
;
}
}
if
(
hTrackMenu
)
else
{
MENU_SelectItem
(
hwnd
,
hTrackMenu
,
uItem
,
TRUE
,
0
);
/* 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
(
uItem
==
NO_SELECTED_ITEM
)
MENU_MoveSelection
(
hwnd
,
hTrackMenu
,
ITEM_NEXT
);
else
if
(
wChar
)
PostMessageW
(
hwnd
,
WM_KEYDOWN
,
VK_DOWN
,
0L
);
MENU_SelectItem
(
hwnd
,
hTrackMenu
,
uItem
,
TRUE
,
0
);
MENU_TrackMenu
(
hTrackMenu
,
wFlags
,
0
,
0
,
hwnd
,
NULL
);
}
if
(
uItem
==
NO_SELECTED_ITEM
)
MENU_MoveSelection
(
hwnd
,
hTrackMenu
,
ITEM_NEXT
);
else
PostMessageW
(
hwnd
,
WM_KEYDOWN
,
VK_DOWN
,
0L
);
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
&
F
ALT
)
&&
!
(
fVirt
&
FVIRTKEY
)
)
if
(
!
(
fVirt
&
F
VIRTKEY
)
&&
(
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
;
...
...
dlls/user/tests/msg.c
View file @
b0c45123
This diff is collapsed.
Click to expand it.
dlls/user/tests/resource.rc
View file @
b0c45123
...
...
@@ -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
{
}
dlls/x11drv/keyboard.c
View file @
b0c45123
...
...
@@ -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
;
...
...
windows/defwnd.c
View file @
b0c45123
...
...
@@ -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
:
...
...
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