Commit 902884e6 authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Alexandre Julliard

winewayland.drv: Avoid transient deactivation of foreground thread.

When updating the foreground window, even if both the old and new active window belong to the same non-current thread, the win32u code currently explicitly deactivates the old window. This will cause the transient deactivation of the foreground thread which can lead to undesirable side-effects (e.g., some apps may minimize when they become inactive). Until this is fixed in Wine core, use an internal driver message to ensure that we call NtUserSetForegroundWindow from the context of the new foreground window thread, to avoid the problematic behavior.
parent a03cbbdb
......@@ -717,7 +717,12 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *wl_keyboard,
if ((surface = wayland_surface_lock_hwnd(hwnd)))
{
if (surface->window.managed) NtUserSetForegroundWindow(hwnd);
/* TODO: Drop the internal message and call NtUserSetForegroundWindow
* directly once it's updated to not explicitly deactivate the old
* foreground window when both the old and new foreground windows
* are in the same non-current thread. */
if (surface->window.managed)
NtUserPostMessage(hwnd, WM_WAYLAND_SET_FOREGROUND, 0, 0);
pthread_mutex_unlock(&surface->mutex);
}
}
......
......@@ -60,7 +60,8 @@ extern struct wayland process_wayland;
enum wayland_window_message
{
WM_WAYLAND_INIT_DISPLAY_DEVICES = 0x80001000,
WM_WAYLAND_CONFIGURE = 0x80001001
WM_WAYLAND_CONFIGURE = 0x80001001,
WM_WAYLAND_SET_FOREGROUND = 0x80001002,
};
enum wayland_surface_config_state
......
......@@ -628,6 +628,9 @@ LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
case WM_WAYLAND_CONFIGURE:
wayland_configure_window(hwnd);
return 0;
case WM_WAYLAND_SET_FOREGROUND:
NtUserSetForegroundWindow(hwnd);
return 0;
default:
FIXME("got window msg %x hwnd %p wp %lx lp %lx\n", msg, hwnd, (long)wp, lp);
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment