hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.81k stars 908 forks source link

[XWayland] Clicking in-between certain windows causes Spotify to gain focus, even if on other workspace #4903

Open TheSunCat opened 8 months ago

TheSunCat commented 8 months ago

Hyprland Version

System/Version info ```sh Hyprland, built from branch main at commit 1698d336f2511ee7c93d0a520c7ba3491c831e8d dirty (core: fix crashes on access of deleted wlr_ surface). Date: Thu Feb 29 18:23:44 2024 Tag: v0.36.0-16-g1698d336 flags: (if any) ```

Bug or Regression?

Bug

Description

When clicking right outside of an SDL (XWayland) window, for some reason Spotify gets activated. This is reproducible with other out-of-bounds instances, such as bugged X11 GTK file pickers that report the wrong size.

How to reproduce

  1. Open Spotify (XWayland) and move it to a different workspace.
  2. Open the demo app and click exactly on a border.
  3. Observe Spotify suddenly taking focus

Demo app (zipped because of GH): pecking_github.zip

Crash reports, logs, images, videos

Logs: ```ini [LOG] Set keyboard focus to surface 557432960a90, with [Window 557432111e60: title: "Dear ImGui SDL2+OpenGL3 example"] [LOG] Searching for matching rules for example_sdl2_opengl3 (title: Dear ImGui SDL2+OpenGL3 example) [LOG] Window rule suppressevent maximize -> title:.* matched [Window 557432111e60: title: "Dear ImGui SDL2+OpenGL3 example"] [LOG] Window rule suppressevent activate -> xwayland:1 matched [Window 557432111e60: title: "Dear ImGui SDL2+OpenGL3 example"] [LOG] cursorImage request: surface 557432889e70 [LOG] Callback 557431ebf890 -> 557431ebf888, CWLSurface removed. [LOG] CWLSurface 557431ebf828 called destroy() [LOG] Registered signal for owner 557431ebf828: 55743288a188 -> 557431ebf868 (owner: CWLSurface) [LOG] CWLSurface 557431ebf828 called init() [LOG] cursorImage request: surface 557432861490 [LOG] cursorImage request: surface 557432889e70 [LOG] cursorImage request: surface 557432889e70 [LOG] cursorImage request: surface 557432889e70 [LOG] X11 Activate request for window [Window 5574328e2340: title: "Re-Logic - Corruption"] [LOG] Searching for matching rules for example_sdl2_opengl3 (title: Dear ImGui SDL2+OpenGL3 example) [LOG] Window rule suppressevent maximize -> title:.* matched [Window 557432111e60: title: "Dear ImGui SDL2+OpenGL3 example"] [LOG] Window rule suppressevent activate -> xwayland:1 matched [Window 557432111e60: title: "Dear ImGui SDL2+OpenGL3 example"] [LOG] Set keyboard focus to surface 55743238c0c0, with [Window 5574328e2340: title: "Re-Logic - Corruption"] [LOG] Searching for matching rules for Spotify (title: Re-Logic - Corruption) [LOG] Window rule suppressevent maximize -> title:.* matched [Window 5574328e2340: title: "Re-Logic - Corruption"] [LOG] Window rule suppressevent activate -> xwayland:1 matched [Window 5574328e2340: title: "Re-Logic - Corruption"] [LOG] cursorImage request: surface 557432889e70 [LOG] cursorImage request: surface 557432889e70 [LOG] cursorImage request: surface 557432861490 [LOG] Callback 557431ebf890 -> 557431ebf888, CWLSurface removed. [LOG] CWLSurface 557431ebf828 called destroy() [LOG] Registered signal for owner 557431ebf828: 5574328617a8 -> 557431ebf868 (owner: CWLSurface) [LOG] CWLSurface 557431ebf828 called init() [LOG] cursorImage request: surface 557432861490 [LOG] cursorImage request: surface 557432861490 [LOG] cursorImage request: surface 557432861490 [LOG] cursorImage request: surface 557432861490 [LOG] Searching for matching rules for Spotify (title: Re-Logic - Corruption) [LOG] Window rule suppressevent maximize -> title:.* matched [Window 5574328e2340: title: "Re-Logic - Corruption"] [LOG] Window rule suppressevent activate -> xwayland:1 matched [Window 5574328e2340: title: "Re-Logic - Corruption"] ```
vaxerski commented 8 months ago

not much we can do. XWayland works only on global coordinates, so the space between windows falls back to the windows behind in the stack (even if they are not rendered)

TheSunCat commented 8 months ago

Oh, of course, thanks X11. It's not feasible to eat mouse click events that fall outside of an Xwayland window? The border space on windows has always been a bit buggy for Xwayland apps (for example showing the wrong size cursor over those few pixels back when xwayland scaling was not an official feature, or showing the default X11 "X" cursor sometimes nowadays), and there is no use for clicking interaction in this region (unless Hyprland at some point decides to implement handle-resizing, I guess).

vaxerski commented 8 months ago

we can't because some X11 apps like sniffing on input outside their own window because x11

TheSunCat commented 8 months ago

Well peck them! Is this common (would it break a lot to do this)? Can we filter only the pixels that are borders or gaps?

vaxerski commented 8 months ago

it is very common unfortunately, drag and drop works that way.