[Bug 59740] New: Programs running under Wayland do not notice when they lose focus
http://bugs.winehq.org/show_bug.cgi?id=59740 Bug ID: 59740 Summary: Programs running under Wayland do not notice when they lose focus Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: winewayland Assignee: wine-bugs@list.winehq.org Reporter: winezilla@xobs.io Distribution: --- When running under X11, programs can use `GetForegroundWindow()` to detect if they have focus or not. This gets updated as part of `X11DRV_FocusIn()` and `focus_out()` (which is called by `X11DRV_FocusOut()`. The X11 code works by setting the foreground window to the desktop when this happens: /* Abey : 6-Oct-99. Check again if the focus out window is the Foreground window, because in most cases the messages sent above must have already changed the foreground window, in which case we don't have to change the foreground window to 0 */ if (hwnd == NtUserGetForegroundWindow()) { TRACE( "lost focus, setting fg to desktop\n" ); NtUserSetForegroundWindowInternal( NtUserGetDesktopWindow() ); } The Wayland driver has no such check, and as a result programs don't notice they are not the foreground window any more. Instead, the function `keyboard_handle_leave()` has this comment: /* FIXME: update foreground window as well */ -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59740 Zhai Can <bczhc0@126.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bczhc0@126.com --- Comment #1 from Zhai Can <bczhc0@126.com> --- Created attachment 81126 --> http://bugs.winehq.org/attachment.cgi?id=81126 Focus change demonstration I'll add a demonstration video on this. The app gets the focus change event when the focus is jumping to another wine window (e.g. in the video, wineconsole), but it doesn't when the focus is changing from it to a window _outside wine_ (e.g. in the video, Alacritty (ofc. a wayland app)) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59740 Anton <anton.sudak@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anton.sudak@gmail.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59740 Mel <pmargeti34@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pmargeti34@gmail.com --- Comment #2 from Mel <pmargeti34@gmail.com> --- Created attachment 81950 --> http://bugs.winehq.org/attachment.cgi?id=81950 Fix Wayland keyboard focus loss not updating foreground window When a Wayland surface loses keyboard focus to a non-Wine window, the foreground window is now updated to the desktop window, matching X This patch fixes the foreground window not being updated when a Wayland surface loses keyboard focus to a non-Wine window. When keyboard focus is lost to an external application, the foreground window is now set to the desktop window, matching the behavior of the X11 driver. This allows Windows applications to correctly detect focus loss and stop processing mouse input. Tested with Warframe - the game no longer receives mouse input when focus is lost to a non-Wine application. Fixes: https://bugs.winehq.org/show_bug.cgi?id=59740 Also fixes: https://bugs.winehq.org/show_bug.cgi?id=56681 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59740 Ken Sharp <imwellcushtymelike@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch Severity|enhancement |minor --- Comment #3 from Ken Sharp <imwellcushtymelike@gmail.com> --- Patches aren't picked up from Bugzilla. See https://gitlab.winehq.org/wine/wine/-/wikis/Submitting-Patches -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59740 --- Comment #4 from Mel <pmargeti34@gmail.com> --- (In reply to Ken Sharp from comment #3)
Patches aren't picked up from Bugzilla. See https://gitlab.winehq.org/wine/wine/-/wikis/Submitting-Patches
Got it, thanks for the heads up. Merge request opened here: https://gitlab.winehq.org/wine/wine/-/merge_requests/11790 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla