MDI: Last-chance deactivation of MDI Child before destruction
Zach Gorman
zach at archetypeauction.com
Sun Nov 14 14:12:22 CST 2004
Changelog:
If, during destruction of an MDI child frame, the application
re-activates the window that is about to be destroyed, de-activate
it one last time.
Background:
This resolves an obscure problem caused by a difference in Windows
and Wine behavior. I have an MDI MFC app in which one of the MDI
child frames forces itself to stay at the back of the Z-order by
responding to MDI Activate messages, and re-activating the old
window (yes I know this is nasty). When Wine tries to switch the
active MDI child during the active child's destruction, this causes
the about-to-be-destroyed window to become active again. Windows
will issue one last WM_MDIACTIVATE to deactivate the window that
will be destroyed in this case, but Wine won't. This patch corrects
that difference in behavior.
Index: mdi.c
===================================================================
RCS file: /home/wine/wine/windows/mdi.c,v
retrieving revision 1.138
diff -u -r1.138 mdi.c
--- mdi.c 11 Oct 2004 19:55:28 -0000 1.138
+++ mdi.c 14 Nov 2004 19:44:30 -0000
@@ -525,8 +525,13 @@
if( child == ci->hwndActiveChild )
{
HWND next = MDI_GetWindow(ci, child, TRUE, 0);
- if (next)
+ if (next) {
MDI_SwitchActiveChild(ci, next);
+ /* If the application re-activates the window that is about to close
+ in response to the switch, de-activate it one last time before closing */
+ if( child == ci->hwndActiveChild )
+ MDI_ChildActivate(client, 0);
+ }
else
{
ShowWindow(child, SW_HIDE);
More information about the wine-patches
mailing list