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
3c0ddd59
Commit
3c0ddd59
authored
Mar 30, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Mar 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Limit the menu height to that of the work area.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1d499228
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
21 deletions
+13
-21
menu.c
dlls/user32/menu.c
+13
-21
No files found.
dlls/user32/menu.c
View file @
3c0ddd59
...
...
@@ -1136,31 +1136,18 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
TRACE
(
"%s
\n
"
,
wine_dbgstr_rect
(
&
lpitem
->
rect
));
}
/***********************************************************************
* MENU_GetMaxPopupHeight
*/
static
UINT
MENU_GetMaxPopupHeight
(
const
POPUPMENU
*
lppop
)
{
if
(
lppop
->
cyMax
)
return
lppop
->
cyMax
;
return
GetSystemMetrics
(
SM_CYSCREEN
)
-
GetSystemMetrics
(
SM_CYBORDER
);
}
/***********************************************************************
* MENU_PopupMenuCalcSize
*
* Calculate the size of a popup menu.
*/
static
void
MENU_PopupMenuCalcSize
(
LPPOPUPMENU
lppop
)
static
void
MENU_PopupMenuCalcSize
(
LPPOPUPMENU
lppop
,
UINT
max_height
)
{
MENUITEM
*
lpitem
;
HDC
hdc
;
UINT
start
,
i
;
BOOL
textandbmp
=
FALSE
,
multi_col
=
FALSE
;
int
orgX
,
orgY
,
maxTab
,
maxTabWidth
,
maxHeight
;
int
orgX
,
orgY
,
maxTab
,
maxTabWidth
;
lppop
->
Width
=
lppop
->
Height
=
0
;
SetRectEmpty
(
&
lppop
->
items_rect
);
...
...
@@ -1230,10 +1217,9 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop )
lppop
->
Width
=
lppop
->
items_rect
.
right
+
MENU_MARGIN
;
/* Adjust popup height if it exceeds maximum */
maxHeight
=
MENU_GetMaxPopupHeight
(
lppop
);
if
(
lppop
->
Height
>=
maxHeight
)
if
(
lppop
->
Height
>=
max_height
)
{
lppop
->
Height
=
max
H
eight
;
lppop
->
Height
=
max
_h
eight
;
lppop
->
bScrolling
=
!
multi_col
;
/* When the scroll arrows are present, don't add the top/bottom margin as well */
if
(
lppop
->
bScrolling
)
...
...
@@ -1894,6 +1880,7 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
POINT
pt
;
HMONITOR
monitor
;
MONITORINFO
info
;
UINT
max_height
;
TRACE
(
"owner=%p hmenu=%p id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x
\n
"
,
hwndOwner
,
hmenu
,
id
,
x
,
y
,
xanchor
,
yanchor
);
...
...
@@ -1906,9 +1893,6 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
}
menu
->
nScrollPos
=
0
;
MENU_PopupMenuCalcSize
(
menu
);
/* adjust popup menu pos so that it fits within the desktop */
/* FIXME: should use item rect */
pt
.
x
=
x
;
...
...
@@ -1917,6 +1901,14 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
info
.
cbSize
=
sizeof
(
info
);
GetMonitorInfoW
(
monitor
,
&
info
);
max_height
=
info
.
rcWork
.
bottom
-
info
.
rcWork
.
top
;
if
(
menu
->
cyMax
)
max_height
=
min
(
max_height
,
menu
->
cyMax
);
MENU_PopupMenuCalcSize
(
menu
,
max_height
);
/* adjust popup menu pos so that it fits within the desktop */
if
(
flags
&
TPM_LAYOUTRTL
)
flags
^=
TPM_RIGHTALIGN
;
...
...
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