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
e64b8753
Commit
e64b8753
authored
Mar 25, 2005
by
Ulrich Czekalla
Committed by
Alexandre Julliard
Mar 25, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Child windows with the WS_POPUP style are allowed to have a menu.
parent
6f9ddc3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
menu.c
dlls/user/menu.c
+8
-4
win.c
dlls/user/tests/win.c
+11
-0
No files found.
dlls/user/menu.c
View file @
e64b8753
...
@@ -161,6 +161,8 @@ typedef struct
...
@@ -161,6 +161,8 @@ typedef struct
MF_POPUP | MF_SYSMENU | MF_HELP)
MF_POPUP | MF_SYSMENU | MF_HELP)
#define STATE_MASK (~TYPE_MASK)
#define STATE_MASK (~TYPE_MASK)
#define WIN_ALLOWED_MENU(style) ((style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
/* Dimension of the menu bitmaps */
/* Dimension of the menu bitmaps */
static
WORD
arrow_bitmap_width
=
0
,
arrow_bitmap_height
=
0
;
static
WORD
arrow_bitmap_width
=
0
,
arrow_bitmap_height
=
0
;
...
@@ -2988,8 +2990,8 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
...
@@ -2988,8 +2990,8 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
/* find window that has a menu */
/* find window that has a menu */
while
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
WS_CHILD
)
while
(
!
WIN_ALLOWED_MENU
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
))
)
if
(
!
(
hwnd
=
Get
Parent
(
hwnd
)))
return
;
if
(
!
(
hwnd
=
Get
Ancestor
(
hwnd
,
GA_PARENT
)))
return
;
/* check if we have to track a system menu */
/* check if we have to track a system menu */
...
@@ -3758,7 +3760,8 @@ BOOL MENU_SetMenu( HWND hWnd, HMENU hMenu )
...
@@ -3758,7 +3760,8 @@ BOOL MENU_SetMenu( HWND hWnd, HMENU hMenu )
WARN
(
"hMenu %p is not a menu handle
\n
"
,
hMenu
);
WARN
(
"hMenu %p is not a menu handle
\n
"
,
hMenu
);
return
FALSE
;
return
FALSE
;
}
}
if
(
GetWindowLongW
(
hWnd
,
GWL_STYLE
)
&
WS_CHILD
)
return
FALSE
;
if
(
!
WIN_ALLOWED_MENU
(
GetWindowLongW
(
hWnd
,
GWL_STYLE
)))
return
FALSE
;
hWnd
=
WIN_GetFullHandle
(
hWnd
);
hWnd
=
WIN_GetFullHandle
(
hWnd
);
if
(
GetCapture
()
==
hWnd
)
MENU_SetCapture
(
0
);
/* release the capture */
if
(
GetCapture
()
==
hWnd
)
MENU_SetCapture
(
0
);
/* release the capture */
...
@@ -3812,7 +3815,8 @@ BOOL WINAPI DrawMenuBar( HWND hWnd )
...
@@ -3812,7 +3815,8 @@ BOOL WINAPI DrawMenuBar( HWND hWnd )
LPPOPUPMENU
lppop
;
LPPOPUPMENU
lppop
;
HMENU
hMenu
=
GetMenu
(
hWnd
);
HMENU
hMenu
=
GetMenu
(
hWnd
);
if
(
GetWindowLongW
(
hWnd
,
GWL_STYLE
)
&
WS_CHILD
)
return
FALSE
;
if
(
!
WIN_ALLOWED_MENU
(
GetWindowLongW
(
hWnd
,
GWL_STYLE
)))
return
FALSE
;
if
(
!
hMenu
||
!
(
lppop
=
MENU_GetMenu
(
hMenu
)))
return
FALSE
;
if
(
!
hMenu
||
!
(
lppop
=
MENU_GetMenu
(
hMenu
)))
return
FALSE
;
lppop
->
Height
=
0
;
/* Make sure we call MENU_MenuBarCalcSize */
lppop
->
Height
=
0
;
/* Make sure we call MENU_MenuBarCalcSize */
...
...
dlls/user/tests/win.c
View file @
e64b8753
...
@@ -1749,6 +1749,7 @@ static void test_SetMenu(HWND parent)
...
@@ -1749,6 +1749,7 @@ static void test_SetMenu(HWND parent)
HMENU
hMenu
,
ret
;
HMENU
hMenu
,
ret
;
BOOL
is_win9x
=
GetWindowLongPtrW
(
parent
,
GWLP_WNDPROC
)
==
0
;
BOOL
is_win9x
=
GetWindowLongPtrW
(
parent
,
GWLP_WNDPROC
)
==
0
;
BOOL
retok
;
BOOL
retok
;
DWORD
style
;
hMenu
=
CreateMenu
();
hMenu
=
CreateMenu
();
assert
(
hMenu
);
assert
(
hMenu
);
...
@@ -1812,6 +1813,16 @@ static void test_SetMenu(HWND parent)
...
@@ -1812,6 +1813,16 @@ static void test_SetMenu(HWND parent)
ret
=
GetMenu
(
child
);
ret
=
GetMenu
(
child
);
ok
(
ret
==
(
HMENU
)
10
,
"unexpected menu id %p
\n
"
,
ret
);
ok
(
ret
==
(
HMENU
)
10
,
"unexpected menu id %p
\n
"
,
ret
);
style
=
GetWindowLong
(
child
,
GWL_STYLE
);
SetWindowLong
(
child
,
GWL_STYLE
,
style
|
WS_POPUP
);
ok
(
SetMenu
(
child
,
hMenu
),
"SetMenu on a popup child window should not fail
\n
"
);
ok
(
SetMenu
(
child
,
0
),
"SetMenu on a popup child window should not fail
\n
"
);
SetWindowLong
(
child
,
GWL_STYLE
,
style
);
SetWindowLong
(
child
,
GWL_STYLE
,
style
|
WS_OVERLAPPED
);
ok
(
!
SetMenu
(
child
,
hMenu
),
"SetMenu on a overlapped child window should fail
\n
"
);
SetWindowLong
(
child
,
GWL_STYLE
,
style
);
DestroyWindow
(
child
);
DestroyWindow
(
child
);
DestroyMenu
(
hMenu
);
DestroyMenu
(
hMenu
);
}
}
...
...
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