From: Twaik Yont <9674930+twaik@users.noreply.github.com> Handle pActivateWindow by forwarding the activation-related Z-order change through ioctl_window_pos_changed(). This fixes activated windows not being visually raised to the front when clicked. Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- dlls/wineandroid.drv/android.h | 1 + dlls/wineandroid.drv/init.c | 1 + dlls/wineandroid.drv/window.c | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index c79ce31a046..b6246dac213 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -110,6 +110,7 @@ extern void ANDROID_SetDesktopWindow( HWND hwnd ); extern void ANDROID_DestroyWindow( HWND hwnd ); extern BOOL ANDROID_ProcessEvents( DWORD mask ); extern LRESULT ANDROID_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); +extern void ANDROID_ActivateWindow( HWND hwnd, HWND previous ); extern void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent ); extern void ANDROID_SetCapture( HWND hwnd, UINT flags ); extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index b5732a12bc1..0742af2e0b0 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -309,6 +309,7 @@ static const struct user_driver_funcs android_drv_funcs = .pCreateWindow = ANDROID_CreateWindow, .pSetDesktopWindow = ANDROID_SetDesktopWindow, .pDesktopWindowProc = ANDROID_DesktopWindowProc, + .pActivateWindow = ANDROID_ActivateWindow, .pDestroyWindow = ANDROID_DestroyWindow, .pProcessEvents = ANDROID_ProcessEvents, .pSetCapture = ANDROID_SetCapture, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index b3f3aeea955..f1ccf99050c 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1076,6 +1076,42 @@ void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UI } +/*********************************************************************** + * ANDROID_ActivateWindow + */ +void ANDROID_ActivateWindow( HWND hwnd, HWND previous ) +{ + struct android_win_data *data; + struct window_rects rects; + UINT style, flags; + HWND owner = 0, insert_after; + + if (!hwnd) return; + if (!(data = get_win_data( hwnd ))) return; + + rects = data->rects; + if (!data->parent) owner = NtUserGetWindowRelative( hwnd, GW_OWNER ); + release_win_data( data ); + + style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); + if (!(style & WS_VISIBLE) || (style & WS_CHILD)) return; + + /* A dialog can become active while it is still hidden and before it becomes + * the foreground window. In that path win32u sends WM_NCACTIVATE(FALSE), + * then later calls the driver with hwnd == previous when foreground catches + * up, so the positive non-client activation would otherwise be skipped. + */ + if (hwnd == previous) + NtUserMessageCall( hwnd, WM_NCACTIVATE, TRUE, (LPARAM)previous, 0, NtUserSendMessage, FALSE ); + + insert_after = 0; + flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE | SWP_NOACTIVATE; + + TRACE( "win %p previous %p owner %p after %p flags %08x\n", hwnd, previous, owner, insert_after, flags ); + ioctl_window_pos_changed( hwnd, &rects, style, flags, insert_after, owner ); +} + + /*********************************************************************** * ANDROID_ShowWindow */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10945