From: Rémi Bernon rbernon@codeweavers.com
When called from the application.
Changing foreground window to the desktop seems like a bad idea, but it also seem to allow later foreground changes back to application windows, as many D3D tests suggest.
Currently we translate these calls into requests to activate the root window, which will usually have no effect, so allowing further changes should be safe.
When the internal flag is set, we actually change the foreground to the desktop window, which should later forbid any further changes made from the application side, as this happens when a non-Wine or foreign window has been focused. --- server/queue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 82d5a395957..fb27524fd49 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3810,11 +3810,11 @@ DECL_HANDLER(set_foreground_window) reply->send_msg_old = (reply->previous && desktop->foreground_input != queue->input); reply->send_msg_new = FALSE;
- if (is_valid_foreground_window( req->handle ) && - (thread = get_window_thread( req->handle )) && - thread->queue->input->desktop == desktop) + if (is_valid_foreground_window( req->handle ) && (thread = get_window_thread( req->handle )) && + (input = thread->queue->input) && input->desktop == desktop) { - set_foreground_input( desktop, thread->queue->input ); + int is_desktop = thread->process == get_top_window_owner( desktop ); + set_foreground_input( desktop, req->internal || !is_desktop ? input : NULL ); reply->send_msg_new = (desktop->foreground_input != queue->input); } else set_win32_error( ERROR_INVALID_WINDOW_HANDLE );