[PATCH 1/6] user32: Factor IsRectEmpty driver check in ShowWindow.

Rémi Bernon rbernon at codeweavers.com
Fri May 14 06:40:04 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

With this series, all user32 tests should pass with null graphics driver
(and even more, as some todo_wine succeed), except for the monitor and
sysparams tests, which require monitor and mode enumeration.

It's pretty much doable to implement some fake adapters and monitor
modes, but it would be better to factor it with winex11.drv as much as
possible (replacing driver callbacks with gpu / adapter enumeration
callbacks for instance).

There was also some attempt to refactor that area to make it live either
in wineserver or in some dedicated process, so it will require a bit of
coordination here.

 dlls/user32/winpos.c          | 6 ++++--
 dlls/wineandroid.drv/window.c | 1 -
 dlls/winemac.drv/window.c     | 1 -
 dlls/winex11.drv/window.c     | 1 -
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index c6f806f7beb..cf7e7914869 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1044,7 +1044,7 @@ static BOOL show_window( HWND hwnd, INT cmd )
     BOOL wasVisible = (style & WS_VISIBLE) != 0;
     BOOL showFlag = TRUE;
     RECT newPos = {0, 0, 0, 0};
-    UINT swp = 0;
+    UINT new_swp, swp = 0;
 
     TRACE("hwnd=%p, cmd=%d, wasVisible %d\n", hwnd, cmd, wasVisible);
 
@@ -1117,7 +1117,9 @@ static BOOL show_window( HWND hwnd, INT cmd )
         if (!IsWindow( hwnd )) goto done;
     }
 
-    swp = USER_Driver->pShowWindow( hwnd, cmd, &newPos, swp );
+    if (IsRectEmpty( &newPos )) new_swp = swp;
+    else new_swp = USER_Driver->pShowWindow( hwnd, cmd, &newPos, swp );
+    swp = new_swp;
 
     parent = GetAncestor( hwnd, GA_PARENT );
     if (parent && !IsWindowVisible( parent ) && !(swp & SWP_STATECHANGED))
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index 1cb1bbbadc9..1c61d4eb76e 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -1385,7 +1385,6 @@ void CDECL ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flag
  */
 UINT CDECL ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
 {
-    if (IsRectEmpty( rect )) return swp;
     if (!IsIconic( hwnd )) return swp;
     /* always hide icons off-screen */
     if (rect->left != -32000 || rect->top != -32000)
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index e7f5327fcdc..4e60189ead9 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -1798,7 +1798,6 @@ UINT CDECL macdrv_ShowWindow(HWND hwnd, INT cmd, RECT *rect, UINT swp)
           hwnd, data ? data->cocoa_window : NULL, cmd, wine_dbgstr_rect(rect), swp);
 
     if (!data || !data->cocoa_window) goto done;
-    if (IsRectEmpty(rect)) goto done;
     if (GetWindowLongW(hwnd, GWL_STYLE) & WS_MINIMIZE)
     {
         if (rect->left != -32000 || rect->top != -32000)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index b3ae5c54408..c30fe6d39b0 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2560,7 +2560,6 @@ UINT CDECL X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
     struct x11drv_win_data *data = get_win_data( hwnd );
 
     if (!data || !data->whole_window) goto done;
-    if (IsRectEmpty( rect )) goto done;
     if (style & WS_MINIMIZE)
     {
         if (((rect->left != -32000 || rect->top != -32000)) && hide_icon( data ))
-- 
2.31.0




More information about the wine-devel mailing list