sway: Multiple Xwayland windows are stacked in the wrong order

Sway Version:

  • Sway version: 1.10-dev-88b2abf5 (Feb 11 2024, branch 'master')
  • wlroots version: 0.18.0-dev
  • OS: Arch Linux x86_64
  • Kernel: 6.7.4-arch1-1

Screencast, Debug Log:

  • Screencast:

https://github.com/swaywm/sway/assets/102382754/6aed8b7a-2c98-4b6a-99f8-6d352a942392

Configuration File:

  • /etc/sway/config

Description: Reproduction procedure

  1. sudo pacman -S chromium reaper to Install Chromium and REAPER
  2. sway -c /etc/sway/config -d 2> sway-run-default_date +%Y%m%d-%H%M%S.log to start Sway
  3. meta+enter to start foot
  4. chromium<enter> to start Chromium
  5. meta+w to make tab layout
  6. meta+enter to start foot
  7. reaper<enter> to start REAPER
  8. escape to close the floating window
  9. click anywhere in the REAPER window

-> I can’t click on the REAPER window, the Chromium tab turns red. Layers are in the wrong order.

Comment

  • I have heard that REAPER uses some sort of proprietary GUI library for games, so this may be related to that.
  • The same problem occurs with Renoise, which is also an application for music and uses its own GUI library often used for games.
    • I checked again and it did not occur. It seems that since Renoise is also an Xwayland window like Chromium, this phenomenon occurs when used with REAPER at the same time.
  • This is a multi-display environment.

Related Links

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 41 (16 by maintainers)

Commits related to this issue

Most upvoted comments

This should be fully fixed with a combination of https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4756 and this sway patch:

diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index e4d54ca6..ce2a4e23 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -289,9 +289,6 @@ static void set_activated(struct sway_view *view, bool activated) {
 	}
 
 	wlr_xwayland_surface_activate(surface, activated);
-	if (activated) {
-		wlr_xwayland_surface_restack(surface, NULL, XCB_STACK_MODE_ABOVE);
-	}
 }
 
 static void set_tiled(struct sway_view *view, bool tiled) {

Thank you for all your patience and quickness to respond! Thank you for making open source better.

I found out how to reproduce the event in the current version.

Version:

  • Sway version 1.10-dev-541e6e26 (Feb 16 2024, branch ‘master’)
  • wlroots version 0.18.0-dev

Reproduction procedure:

  1. sudo pacman -S chromium reaper to Install Chromium and REAPER
  2. sway -c /etc/sway/config -d 2> sway-run-default_date +%Y%m%d-%H%M%S.log to start Sway
  3. meta+enter to start foot
  4. chromium<enter> to start Chromium
  5. meta+w to make tab layout
  6. meta+enter to start foot
  7. reaper<enter> to start REAPER
  8. escape to close the floating window

This will still reproduce, but a quick operation of the following will reproduce it again.

  1. meta+shift+j to move the chromium window down
  2. meta+shift+k to move the chromium window back
  3. Focus on the reaper window
  4. ctrl+f1 to bring up a floating window
  5. escape to close the floating window
  6. Click anywhere in the reaper window

Can you provide the output of xwininfo -tree -root when the windows are in this bad state?

[a@gb1 ~]$ xwininfo -tree -root

xwininfo: Window id: 0x413 (the root window) (has no name)

  Root window id: 0x413 (the root window) (has no name)
  Parent window id: 0x0 (none)
     13 children:
     0x400004 (has no name): ()  1x1+0+0  +0+0
     0x600008 "chromium": ("chromium" "Chromium")  200x200+0+0  +0+0
        1 child:
        0x600009 (has no name): ()  1x1+-1+-1  +-1+-1
     0x600003 (has no name): ()  1x1+-1+-1  +-1+-1
     0x600001 "chromium": ("chromium" "Chromium")  10x10+10+10  +10+10
     0x400000 "Chromium clipboard": ()  10x10+-100+-100  +-100+-100
     0x1000009 (has no name): ()  1x1+-1+-1  +-1+-1
     0x1000001 "reaper": ("reaper" "")  10x10+10+10  +10+10
     0x200004 "wlroots wm": ()  10x10+0+0  +0+0
     0x200003 (has no name): ()  8192x8192+0+0  +0+0
     0x200002 (has no name): ()  10x10+0+0  +0+0
     0x200001 (has no name): ()  10x10+0+0  +0+0
     0x400003 "新しいタブ - Chromium": ("chromium" "Chromium")  1916x1036+3842+42  +3842+42
     0x10001b0 "REAPER v7.09 - EVALUATION LICENSE": ("REAPER" "REAPER")  1916x1036+3842+42  +3842+42
        1 child:
        0x10001b1 (has no name): ()  1x1+-1+-1  +3841+41

[a@gb1 ~]$ 

Screenshot: 20240216-143732_screenshot

Screencast:

https://github.com/swaywm/sway/assets/102382754/7412337c-75e9-4bf3-999c-a535960844e6

20240216-141721-chromium.log

sway-run-default_20240216-140729.log

It it able to properly receive input events? What happens if you don’t switch tabs but instead refocus on the workspace on your second monitor then back?

Nothing changes. See between 16 and 24 seconds of the above screencast.

What happens if you switch to chromium, then back to your application?

The incorrect stacking condition will be resolved and normalized. See between 28 and 50 seconds of the above screencast.