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
5c6a1f77
Commit
5c6a1f77
authored
Sep 22, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add support for right-to-left menus.
parent
3f026caf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
menu.c
dlls/user32/menu.c
+22
-5
nonclient.c
dlls/user32/nonclient.c
+2
-1
No files found.
dlls/user32/menu.c
View file @
5c6a1f77
...
...
@@ -727,7 +727,8 @@ static MENUITEM *MENU_FindItemByCoords( const POPUPMENU *menu,
RECT
rect
;
if
(
!
GetWindowRect
(
menu
->
hWnd
,
&
rect
))
return
NULL
;
pt
.
x
-=
rect
.
left
;
if
(
GetWindowLongW
(
menu
->
hWnd
,
GWL_EXSTYLE
)
&
WS_EX_LAYOUTRTL
)
pt
.
x
=
rect
.
right
-
1
-
pt
.
x
;
else
pt
.
x
-=
rect
.
left
;
pt
.
y
-=
rect
.
top
;
item
=
menu
->
items
;
for
(
i
=
0
;
i
<
menu
->
nItems
;
i
++
,
item
++
)
...
...
@@ -1834,6 +1835,7 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
POINT
pt
;
HMONITOR
monitor
;
MONITORINFO
info
;
DWORD
ex_style
=
0
;
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
);
...
...
@@ -1863,6 +1865,12 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
info
.
cbSize
=
sizeof
(
info
);
GetMonitorInfoW
(
monitor
,
&
info
);
if
(
flags
&
TPM_LAYOUTRTL
)
{
ex_style
=
WS_EX_LAYOUTRTL
;
flags
^=
TPM_RIGHTALIGN
;
}
if
(
flags
&
TPM_RIGHTALIGN
)
x
-=
width
;
if
(
flags
&
TPM_CENTERALIGN
)
x
-=
width
/
2
;
...
...
@@ -1890,7 +1898,7 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
if
(
y
<
info
.
rcWork
.
top
)
y
=
info
.
rcWork
.
top
;
/* NOTE: In Windows, top menu popup is not owned. */
menu
->
hWnd
=
CreateWindowExW
(
0
,
(
LPCWSTR
)
POPUPMENU_CLASS_ATOM
,
NULL
,
menu
->
hWnd
=
CreateWindowExW
(
ex_style
,
(
LPCWSTR
)
POPUPMENU_CLASS_ATOM
,
NULL
,
WS_POPUP
,
x
,
y
,
width
,
height
,
hwndOwner
,
0
,
(
HINSTANCE
)
GetWindowLongPtrW
(
hwndOwner
,
GWLP_HINSTANCE
),
(
LPVOID
)
hmenu
);
...
...
@@ -2339,6 +2347,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
GetClassLongW
(
menu
->
hWnd
,
GCL_STYLE
));
NC_GetSysPopupPos
(
menu
->
hWnd
,
&
rect
);
if
(
wFlags
&
TPM_LAYOUTRTL
)
rect
.
left
=
rect
.
right
;
rect
.
top
=
rect
.
bottom
;
rect
.
right
=
GetSystemMetrics
(
SM_CXSIZE
);
rect
.
bottom
=
GetSystemMetrics
(
SM_CYSIZE
);
...
...
@@ -2354,7 +2363,10 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
/* The first item in the popup menu has to be at the
same y position as the focused menu item */
rect
.
left
+=
rc
.
right
-
GetSystemMetrics
(
SM_CXBORDER
);
if
(
wFlags
&
TPM_LAYOUTRTL
)
rect
.
left
+=
GetSystemMetrics
(
SM_CXBORDER
);
else
rect
.
left
+=
rc
.
right
-
GetSystemMetrics
(
SM_CXBORDER
);
rect
.
top
+=
rc
.
top
-
MENU_TOP_MARGIN
;
rect
.
right
=
rc
.
left
-
rc
.
right
+
GetSystemMetrics
(
SM_CXBORDER
);
rect
.
bottom
=
rc
.
top
-
rc
.
bottom
-
MENU_TOP_MARGIN
...
...
@@ -2362,14 +2374,17 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
}
else
{
rect
.
left
+=
item
->
rect
.
left
;
if
(
wFlags
&
TPM_LAYOUTRTL
)
rect
.
left
=
rect
.
right
-
item
->
rect
.
left
;
else
rect
.
left
+=
item
->
rect
.
left
;
rect
.
top
+=
item
->
rect
.
bottom
;
rect
.
right
=
item
->
rect
.
right
-
item
->
rect
.
left
;
rect
.
bottom
=
item
->
rect
.
bottom
-
item
->
rect
.
top
;
}
}
MENU_ShowPopup
(
hwndOwner
,
item
->
hSubMenu
,
menu
->
FocusedItem
,
0
,
MENU_ShowPopup
(
hwndOwner
,
item
->
hSubMenu
,
menu
->
FocusedItem
,
wFlags
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
);
if
(
selectFirst
)
MENU_MoveSelection
(
hwndOwner
,
item
->
hSubMenu
,
ITEM_NEXT
);
...
...
@@ -3319,6 +3334,7 @@ void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
TRACE
(
"wnd=%p ht=0x%04x %s
\n
"
,
hWnd
,
ht
,
wine_dbgstr_point
(
&
pt
));
if
(
GetWindowLongW
(
hWnd
,
GWL_EXSTYLE
)
&
WS_EX_LAYOUTRTL
)
wFlags
|=
TPM_LAYOUTRTL
;
if
(
IsMenu
(
hMenu
))
{
MENU_InitTracking
(
hWnd
,
hMenu
,
FALSE
,
wFlags
);
...
...
@@ -3356,6 +3372,7 @@ void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar)
uItem
=
0
;
wParam
|=
HTSYSMENU
;
/* prevent item lookup */
}
if
(
GetWindowLongW
(
hwnd
,
GWL_EXSTYLE
)
&
WS_EX_LAYOUTRTL
)
wFlags
|=
TPM_LAYOUTRTL
;
if
(
!
IsMenu
(
hTrackMenu
))
return
;
...
...
dlls/user32/nonclient.c
View file @
5c6a1f77
...
...
@@ -1185,9 +1185,10 @@ void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
DWORD
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
DWORD
ex_style
=
GetWindowLongW
(
hwnd
,
GWL_EXSTYLE
);
NC_GetInsideRect
(
hwnd
,
COORDS_
SCREEN
,
rect
,
style
,
ex_style
);
NC_GetInsideRect
(
hwnd
,
COORDS_
CLIENT
,
rect
,
style
,
ex_style
);
rect
->
right
=
rect
->
left
+
GetSystemMetrics
(
SM_CYCAPTION
)
-
1
;
rect
->
bottom
=
rect
->
top
+
GetSystemMetrics
(
SM_CYCAPTION
)
-
1
;
MapWindowPoints
(
hwnd
,
0
,
(
POINT
*
)
rect
,
2
);
}
}
...
...
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