[PATCH 2/2] winex11.drv: Restore iconic state if a window doesn't want to be restored.

Zhiyi Zhang zzhang at codeweavers.com
Tue Feb 22 01:31:58 CST 2022


Fix Excel 2007 and 2010 showing small black windows after clicking their taskbar icons when opening
multiple documents in one instance.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/user32/tests/msg.c  | 1 -
 dlls/winex11.drv/event.c | 6 ++++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 3c4cb084d8e..f2a9c2c2f4a 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -18801,7 +18801,6 @@ static void test_taskbar_messages(void)
     }
     /* The background window rectangle is (100, 100, 200, 200). If hwnd gets unminimized, it will
      * end up obscuring the background window. */
-    todo_wine_if(color != 0xffffff)
     ok(color == 0xffffff, "Expected color %#x, got %#x.\n", 0xffffff, color);
 
     ReleaseDC(0, hdc);
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 170111e9c28..0e963f6e399 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -1314,6 +1314,12 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat
                 if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE))
                     SetActiveWindow( hwnd );
                 SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
+                /* The window doesn't want to unminimize, restore iconic state */
+                if (GetWindowLongW( data->hwnd, GWL_STYLE ) & WS_MINIMIZE)
+                {
+                    data->iconic = TRUE;
+                    XIconifyWindow( data->display, data->whole_window, data->vis.screen );
+                }
                 return;
             }
             TRACE( "not restoring win %p/%lx style %08x\n", data->hwnd, data->whole_window, style );
-- 
2.32.0



More information about the wine-devel mailing list