Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
df0ddd4a
Commit
df0ddd4a
authored
Feb 03, 2004
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Feb 03, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the MDI Window menu refreshing Windows compatible.
Simplify MDI child visibility check.
parent
ed39e7c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
29 deletions
+31
-29
mdi.c
windows/mdi.c
+31
-29
No files found.
windows/mdi.c
View file @
df0ddd4a
...
@@ -121,7 +121,6 @@ typedef struct
...
@@ -121,7 +121,6 @@ typedef struct
HWND
*
child
;
/* array of tracked children */
HWND
*
child
;
/* array of tracked children */
HMENU
hFrameMenu
;
HMENU
hFrameMenu
;
HMENU
hWindowMenu
;
HMENU
hWindowMenu
;
UINT
add_pos
;
/* original number of items in the window menu */
UINT
idFirstChild
;
UINT
idFirstChild
;
LPWSTR
frameTitle
;
LPWSTR
frameTitle
;
UINT
nTotalCreated
;
UINT
nTotalCreated
;
...
@@ -312,7 +311,6 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
...
@@ -312,7 +311,6 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
ci
->
nActiveChildren
=
0
;
ci
->
nActiveChildren
=
0
;
MDI_RefreshMenu
(
ci
);
MDI_RefreshMenu
(
ci
);
ci
->
add_pos
=
GetMenuItemCount
(
hmenuWindow
);
ci
->
hWindowMenu
=
hmenuWindow
;
ci
->
hWindowMenu
=
hmenuWindow
;
/* Add items to the new Window menu */
/* Add items to the new Window menu */
...
@@ -320,10 +318,7 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
...
@@ -320,10 +318,7 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
MDI_RefreshMenu
(
ci
);
MDI_RefreshMenu
(
ci
);
}
}
else
else
{
ci
->
hWindowMenu
=
hmenuWindow
;
ci
->
hWindowMenu
=
hmenuWindow
;
ci
->
add_pos
=
GetMenuItemCount
(
hmenuWindow
);
}
}
}
if
(
hmenuFrame
)
if
(
hmenuFrame
)
...
@@ -360,7 +355,7 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
...
@@ -360,7 +355,7 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
*/
*/
static
LRESULT
MDI_RefreshMenu
(
MDICLIENTINFO
*
ci
)
static
LRESULT
MDI_RefreshMenu
(
MDICLIENTINFO
*
ci
)
{
{
UINT
i
,
count
,
visible
;
UINT
i
,
count
,
visible
,
separator_pos
;
WCHAR
buf
[
MDI_MAXTITLELENGTH
];
WCHAR
buf
[
MDI_MAXTITLELENGTH
];
TRACE
(
"children %u, window menu %p
\n
"
,
ci
->
nActiveChildren
,
ci
->
hWindowMenu
);
TRACE
(
"children %u, window menu %p
\n
"
,
ci
->
nActiveChildren
,
ci
->
hWindowMenu
);
...
@@ -374,9 +369,26 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
...
@@ -374,9 +369,26 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
return
0
;
return
0
;
}
}
/* Windows finds the last separator in the menu, removes all existing
* menu items after it, and then adds visible MDI children.
*/
separator_pos
=
0
;
count
=
GetMenuItemCount
(
ci
->
hWindowMenu
);
count
=
GetMenuItemCount
(
ci
->
hWindowMenu
);
for
(
i
=
ci
->
add_pos
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
RemoveMenu
(
ci
->
hWindowMenu
,
ci
->
add_pos
,
MF_BYPOSITION
);
{
MENUITEMINFOW
mii
;
memset
(
&
mii
,
0
,
sizeof
(
mii
));
mii
.
cbSize
=
sizeof
(
mii
);
mii
.
fMask
=
MIIM_TYPE
;
GetMenuItemInfoW
(
ci
->
hWindowMenu
,
i
,
TRUE
,
&
mii
);
if
(
mii
.
fType
&
MFT_SEPARATOR
)
separator_pos
=
i
;
}
for
(
i
=
separator_pos
+
1
;
i
<
count
;
i
++
)
RemoveMenu
(
ci
->
hWindowMenu
,
separator_pos
+
1
,
MF_BYPOSITION
);
visible
=
0
;
visible
=
0
;
for
(
i
=
0
;
i
<
ci
->
nActiveChildren
;
i
++
)
for
(
i
=
0
;
i
<
ci
->
nActiveChildren
;
i
++
)
...
@@ -390,9 +402,9 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
...
@@ -390,9 +402,9 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
break
;
break
;
}
}
if
(
IsWindowVisible
(
ci
->
child
[
i
])
)
if
(
GetWindowLongW
(
ci
->
child
[
i
],
GWL_STYLE
)
&
WS_VISIBLE
)
{
{
if
(
!
visible
)
if
(
!
visible
&&
!
separator_pos
)
/* Visio expects that separator has id 0 */
/* Visio expects that separator has id 0 */
AppendMenuW
(
ci
->
hWindowMenu
,
MF_SEPARATOR
,
0
,
NULL
);
AppendMenuW
(
ci
->
hWindowMenu
,
MF_SEPARATOR
,
0
,
NULL
);
...
@@ -404,12 +416,14 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
...
@@ -404,12 +416,14 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
buf
[
1
]
=
'0'
+
visible
;
buf
[
1
]
=
'0'
+
visible
;
buf
[
2
]
=
' '
;
buf
[
2
]
=
' '
;
InternalGetWindowText
(
ci
->
child
[
i
],
buf
+
3
,
sizeof
(
buf
)
/
sizeof
(
WCHAR
)
-
3
);
InternalGetWindowText
(
ci
->
child
[
i
],
buf
+
3
,
sizeof
(
buf
)
/
sizeof
(
WCHAR
)
-
3
);
TRACE
(
"Adding %
u %s
\n
"
,
id
,
debugstr_w
(
buf
));
TRACE
(
"Adding %
p, id %u %s
\n
"
,
ci
->
child
[
i
]
,
id
,
debugstr_w
(
buf
));
AppendMenuW
(
ci
->
hWindowMenu
,
MF_STRING
,
id
,
buf
);
AppendMenuW
(
ci
->
hWindowMenu
,
MF_STRING
,
id
,
buf
);
if
(
ci
->
child
[
i
]
==
ci
->
hwndActiveChild
)
if
(
ci
->
child
[
i
]
==
ci
->
hwndActiveChild
)
CheckMenuItem
(
ci
->
hWindowMenu
,
id
,
MF_CHECKED
);
CheckMenuItem
(
ci
->
hWindowMenu
,
id
,
MF_CHECKED
);
}
}
else
TRACE
(
"MDI child %p is not visible, skipping
\n
"
,
ci
->
child
[
i
]);
}
}
return
(
LRESULT
)
ci
->
hFrameMenu
;
return
(
LRESULT
)
ci
->
hFrameMenu
;
...
@@ -557,21 +571,10 @@ static LONG MDI_ChildActivate( HWND client, HWND child )
...
@@ -557,21 +571,10 @@ static LONG MDI_ChildActivate( HWND client, HWND child )
/* deactivate prev. active child */
/* deactivate prev. active child */
if
(
prevActiveWnd
)
if
(
prevActiveWnd
)
{
{
SetWindowLongA
(
prevActiveWnd
,
GWL_STYLE
,
SetWindowLongW
(
prevActiveWnd
,
GWL_STYLE
,
GetWindowLongA
(
prevActiveWnd
,
GWL_STYLE
)
|
WS_SYSMENU
);
GetWindowLongW
(
prevActiveWnd
,
GWL_STYLE
)
|
WS_SYSMENU
);
SendMessageA
(
prevActiveWnd
,
WM_NCACTIVATE
,
FALSE
,
0L
);
SendMessageW
(
prevActiveWnd
,
WM_NCACTIVATE
,
FALSE
,
0L
);
SendMessageA
(
prevActiveWnd
,
WM_MDIACTIVATE
,
(
WPARAM
)
prevActiveWnd
,
(
LPARAM
)
child
);
SendMessageW
(
prevActiveWnd
,
WM_MDIACTIVATE
,
(
WPARAM
)
prevActiveWnd
,
(
LPARAM
)
child
);
/* uncheck menu item */
if
(
clientInfo
->
hWindowMenu
)
{
UINT
prevID
=
GetWindowLongA
(
prevActiveWnd
,
GWL_ID
);
if
(
prevID
-
clientInfo
->
idFirstChild
<
MDI_MOREWINDOWSLIMIT
)
CheckMenuItem
(
clientInfo
->
hWindowMenu
,
prevID
,
0
);
else
CheckMenuItem
(
clientInfo
->
hWindowMenu
,
clientInfo
->
idFirstChild
+
MDI_MOREWINDOWSLIMIT
-
1
,
0
);
}
}
}
/* set appearance */
/* set appearance */
...
@@ -599,8 +602,6 @@ static LONG MDI_ChildActivate( HWND client, HWND child )
...
@@ -599,8 +602,6 @@ static LONG MDI_ChildActivate( HWND client, HWND child )
clientInfo
->
hwndActiveChild
=
child
;
clientInfo
->
hwndActiveChild
=
child
;
MDI_RefreshMenu
(
clientInfo
);
/* check if we have any children left */
/* check if we have any children left */
if
(
!
child
)
if
(
!
child
)
{
{
...
@@ -609,6 +610,8 @@ static LONG MDI_ChildActivate( HWND client, HWND child )
...
@@ -609,6 +610,8 @@ static LONG MDI_ChildActivate( HWND client, HWND child )
return
0
;
return
0
;
}
}
MDI_RefreshMenu
(
clientInfo
);
/* bring active child to the top */
/* bring active child to the top */
SetWindowPos
(
child
,
0
,
0
,
0
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOMOVE
|
SWP_NOACTIVATE
);
SetWindowPos
(
child
,
0
,
0
,
0
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOMOVE
|
SWP_NOACTIVATE
);
...
@@ -1064,7 +1067,6 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
...
@@ -1064,7 +1067,6 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
ci
->
frameTitle
=
NULL
;
ci
->
frameTitle
=
NULL
;
ci
->
mdiFlags
=
0
;
ci
->
mdiFlags
=
0
;
ci
->
hFrameMenu
=
GetMenu
(
cs
->
hwndParent
);
ci
->
hFrameMenu
=
GetMenu
(
cs
->
hwndParent
);
ci
->
add_pos
=
GetMenuItemCount
(
ci
->
hWindowMenu
);
if
(
!
hBmpClose
)
hBmpClose
=
CreateMDIMenuBitmap
();
if
(
!
hBmpClose
)
hBmpClose
=
CreateMDIMenuBitmap
();
...
...
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