From: Rémi Bernon <rbernon@codeweavers.com> We allow windows to be each activated at least once after their creation and this is now mostly unnecessary. It also effectively allows processes to activate their first window twice, once because the window was never active before, and a second time because we only set the process-wide flag after checking the window flag, which is not the intended effect. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58167 --- server/process.c | 1 - server/process.h | 1 - server/queue.c | 6 +++--- server/winstation.c | 1 - 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/server/process.c b/server/process.c index a06aa83166c..b30c835f74f 100644 --- a/server/process.c +++ b/server/process.c @@ -682,7 +682,6 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla process->is_system = 0; process->debug_children = 1; process->is_terminating = 0; - process->set_foreground = 0; process->imagelen = 0; process->image = NULL; process->job = NULL; diff --git a/server/process.h b/server/process.h index 7cfcc39c258..5c136fb5103 100644 --- a/server/process.h +++ b/server/process.h @@ -63,7 +63,6 @@ struct process unsigned int is_system:1; /* is it a system process? */ unsigned int debug_children:1;/* also debug all child processes */ unsigned int is_terminating:1;/* is process terminating? */ - unsigned int set_foreground:1;/* has process called set_foreground_window */ data_size_t imagelen; /* length of image path in bytes */ WCHAR *image; /* main exe image full path */ struct job *job; /* job object associated with this process */ diff --git a/server/queue.c b/server/queue.c index 4c3673fc1c4..b7c5adb029c 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3829,9 +3829,9 @@ DECL_HANDLER(set_foreground_window) if (set_foreground && !req->internal) { - if (!current->process->set_foreground) current->process->set_foreground = 1; - else if (!is_current_process_foreground( desktop ) && queue->input && desktop->foreground_input && - queue->input->user_time < desktop->foreground_input->user_time) + /* allow a process to set foreground after changing desktop, or each window to be set foreground at least once */ + if (!is_current_process_foreground( desktop ) && queue->input && desktop->foreground_input && + queue->input->user_time < desktop->foreground_input->user_time) { set_error( STATUS_ACCESS_DENIED ); goto done; diff --git a/server/winstation.c b/server/winstation.c index 8820d0b6bcd..90e55b80d7d 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -865,7 +865,6 @@ DECL_HANDLER(set_thread_desktop) { if (old_desktop) remove_desktop_thread( old_desktop, current ); add_desktop_thread( new_desktop, current ); - current->process->set_foreground = 0; } reply->locator = get_shared_object_locator( new_desktop->shared ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9823