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
2bd0c872
Commit
2bd0c872
authored
Jun 26, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Move GetMenuDefaultItem implementation from user32.
parent
4e39188c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
35 deletions
+45
-35
menu.c
dlls/user32/menu.c
+2
-35
menu.c
dlls/win32u/menu.c
+42
-0
ntuser.h
include/ntuser.h
+1
-0
No files found.
dlls/user32/menu.c
View file @
2bd0c872
...
...
@@ -911,42 +911,9 @@ BOOL WINAPI SetMenuItemInfoW(HMENU hmenu, UINT item, BOOL bypos,
/**********************************************************************
* GetMenuDefaultItem (USER32.@)
*/
UINT
WINAPI
GetMenuDefaultItem
(
HMENU
hmenu
,
UINT
bypos
,
UINT
flags
)
UINT
WINAPI
GetMenuDefaultItem
(
HMENU
menu
,
UINT
bypos
,
UINT
flags
)
{
POPUPMENU
*
menu
;
MENUITEM
*
item
;
UINT
i
=
0
;
TRACE
(
"(%p,%d,%d)
\n
"
,
hmenu
,
bypos
,
flags
);
if
(
!
(
menu
=
MENU_GetMenu
(
hmenu
)))
return
-
1
;
/* find default item */
item
=
menu
->
items
;
/* empty menu */
if
(
!
item
)
return
-
1
;
while
(
!
(
item
->
fState
&
MFS_DEFAULT
)
)
{
i
++
;
item
++
;
if
(
i
>=
menu
->
nItems
)
return
-
1
;
}
/* default: don't return disabled items */
if
(
(
!
(
GMDI_USEDISABLED
&
flags
))
&&
(
item
->
fState
&
MFS_DISABLED
))
return
-
1
;
/* search rekursiv when needed */
if
(
(
item
->
fType
&
MF_POPUP
)
&&
(
flags
&
GMDI_GOINTOPOPUPS
)
)
{
UINT
ret
;
ret
=
GetMenuDefaultItem
(
item
->
hSubMenu
,
bypos
,
flags
);
if
(
-
1
!=
ret
)
return
ret
;
/* when item not found in submenu, return the popup item */
}
return
(
bypos
)
?
i
:
item
->
wID
;
return
NtUserThunkedMenuItemInfo
(
menu
,
bypos
,
flags
,
NtUserGetMenuDefaultItem
,
NULL
,
NULL
);
}
...
...
dlls/win32u/menu.c
View file @
2bd0c872
...
...
@@ -1170,6 +1170,45 @@ static HMENU get_sub_menu( HMENU handle, INT pos )
return
submenu
;
}
/* see GetMenuDefaultItem */
static
UINT
get_menu_default_item
(
HMENU
handle
,
UINT
bypos
,
UINT
flags
)
{
MENUITEM
*
item
=
NULL
;
POPUPMENU
*
menu
;
UINT
i
;
TRACE
(
"(%p,%d,%d)
\n
"
,
handle
,
bypos
,
flags
);
if
(
!
(
menu
=
grab_menu_ptr
(
handle
)))
return
-
1
;
for
(
i
=
0
;
i
<
menu
->
nItems
;
i
++
)
{
if
(
!
(
menu
->
items
[
i
].
fState
&
MFS_DEFAULT
))
continue
;
item
=
&
menu
->
items
[
i
];
break
;
}
/* default: don't return disabled items */
if
(
item
&&
(
!
(
GMDI_USEDISABLED
&
flags
))
&&
(
item
->
fState
&
MFS_DISABLED
))
item
=
NULL
;
/* search submenu when needed */
if
(
item
&&
(
item
->
fType
&
MF_POPUP
)
&&
(
flags
&
GMDI_GOINTOPOPUPS
))
{
UINT
ret
=
get_menu_default_item
(
item
->
hSubMenu
,
bypos
,
flags
);
if
(
ret
!=
-
1
)
{
release_menu_ptr
(
menu
);
return
ret
;
}
/* when item not found in submenu, return the popup item */
}
if
(
!
item
)
i
=
-
1
;
else
if
(
!
bypos
)
i
=
item
->
wID
;
release_menu_ptr
(
menu
);
return
i
;
}
/**********************************************************************
* NtUserThunkedMenuItemInfo (win32u.@)
*/
...
...
@@ -1185,6 +1224,9 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT
case
NtUserCheckMenuRadioItem
:
return
check_menu_radio_item
(
handle
,
pos
,
info
->
cch
,
info
->
fMask
,
flags
);
case
NtUserGetMenuDefaultItem
:
return
get_menu_default_item
(
handle
,
pos
,
flags
);
case
NtUserGetMenuItemID
:
if
(
!
(
menu
=
find_menu_item
(
handle
,
pos
,
flags
,
&
i
)))
return
-
1
;
ret
=
menu
->
items
[
i
].
fType
&
MF_POPUP
?
-
1
:
menu
->
items
[
i
].
wID
;
...
...
include/ntuser.h
View file @
2bd0c872
...
...
@@ -225,6 +225,7 @@ enum
NtUserInsertMenuItem
,
/* Wine extensions */
NtUserCheckMenuRadioItem
,
NtUserGetMenuDefaultItem
,
NtUserGetMenuItemID
,
NtUserGetMenuItemInfoA
,
NtUserGetMenuItemInfoW
,
...
...
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