[PATCH 0/2] MR10712: wineandroid: fix desktop sizing and repaint on resolution changes
This series fixes two related issues in wineandroid affecting desktop initialization and repaint behavior when using the virtual desktop mode. First, launching explorer.exe with an empty desktop size ("/desktop=shell,,android") does not behave as intended on wineandroid. When the size is omitted, explorer attempts to determine the desktop resolution via get_default_desktop_size(). If no matching registry entry is found, it falls back to a hardcoded default (typically 800x600). Later, even if the wineandroid backend sets the correct display size through pCreateDesktop, explorer overrides it again during initialize_display_settings(), restoring the default resolution. As a result, the desktop ends up stuck at 800x600 regardless of the actual display size reported by the backend. To address this, the desktop is now launched with a size of "-1x-1". This value is accepted by parse_size(), but does not correspond to a valid resolution. As a result, explorer does not fall back to the default resolution, and also avoids overriding the backend-provided size during initialization. This allows the desktop to retain the correct resolution as configured by wineandroid. Second, window repainting on resolution changes is fixed. Previously, WM_ANDROID_REFRESH used NtUserExposeWindowSurface(), which only exposes existing surface contents without invalidating the window. This prevents WM_PAINT and WM_ERASEBKGND from being generated. When the desktop or other windows are resized (e.g. after applying a new display mode), they may retain stale contents instead of repainting. This is resolved by replacing NtUserExposeWindowSurface() with NtUserRedrawWindow(), ensuring proper invalidation and repaint of window contents. This fixes cases where the desktop background is not redrawn after a resolution change. Together, these changes ensure that the desktop starts with the correct resolution and that windows are properly repainted when display settings change. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10712
From: Twaik Yont <9674930+twaik@users.noreply.github.com> Replace NtUserExposeWindowSurface() with NtUserRedrawWindow() when handling WM_ANDROID_REFRESH for non-OpenGL windows. NtUserExposeWindowSurface() only exposes the existing surface contents, but does not invalidate the window or trigger WM_PAINT / WM_ERASEBKGND. As a result, when the display resolution changes, windows (including the desktop window managed by explorer.exe) may be resized without receiving a repaint, leaving stale contents on screen. Using NtUserRedrawWindow() ensures that the window is properly invalidated and repainted, so background and client areas are refreshed correctly after resolution changes. This fixes cases where the desktop background is not redrawn after applying a new display mode. Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- dlls/wineandroid.drv/window.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 97eb3004ba8..5ce4828e1a4 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1197,9 +1197,7 @@ LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) detach_client_surfaces( hwnd ); } else - { - NtUserExposeWindowSurface( hwnd, 0, NULL, 0 ); - } + NtUserRedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN | RDW_FRAME ); return 0; default: FIXME( "got window msg %x hwnd %p wp %lx lp %lx\n", msg, hwnd, (long)wp, lp ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10712
From: Twaik Yont <9674930+twaik@users.noreply.github.com> Use “-1x-1” instead of an empty size in the /desktop option when launching explorer.exe. An empty size causes get_default_desktop_size() to be used, which falls back to a fixed default (typically 800x600). This prevents the desktop from matching the actual display size provided by the Android backend. Passing “-1x-1” is accepted by parse_size() and results in large unsigned values, which are then clamped by the driver to the current screen size. This effectively requests a dynamically sized desktop matching the Android display. This ensures that the desktop resolution is derived from the backend instead of being forced to the default fixed size. Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- dlls/wineandroid.drv/WineActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wineandroid.drv/WineActivity.java b/dlls/wineandroid.drv/WineActivity.java index 6488188b93a..f0bade27a28 100644 --- a/dlls/wineandroid.drv/WineActivity.java +++ b/dlls/wineandroid.drv/WineActivity.java @@ -169,7 +169,7 @@ private final void runWine( String loader, String cmdline ) { String[] cmd = { loader, "c:\\windows\\system32\\explorer.exe", - "/desktop=shell,,android", + "/desktop=shell,-1x-1,android", cmdline }; String err = wine_init( cmd ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10712
@julliard Hi, just a gentle ping on this PR — would appreciate a review when you have a moment. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10712#note_137712
participants (2)
-
Twaik Yont -
Twaik Yont (@twaik)