X11 apps leave tooltip when they lose focus
It seems that when a cursor leaves xwayland windows they see it remain stationary on the last pixel. If the cursor leaves over something that gives a tooltip, a tooltip is spawned (as if the cursor remained on that part) which is rather annoying. Reproducible in rootston and sway, wlroots 2e1dd4ae36fd4fa4c2f86911aaa300833d374619. Easy examples are clients like nautilus (with GDK_BACKEND=x11, leaving the mouse over entries in the panel on the left), firefox or discord (Electron).
wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1595
Duplicate of https://github.com/swaywm/sway/issues/2529
FWIW waymonad has the same issue, while weston does not.
I had looked into this before, and (at least on waymonad) verified that the surface receives a wayland wl_pointer.exit
One of the differences is reparented X11 windows. I tried moving from firefox onto overlaying weston-terminal to avoid the border window on weston to trick it, but that still behaved correct.
Note that it works fine if you switch to another X11 app. Maybe we're missing a focus-out event or something.
Also happens on the wayland version of firefox, so might be toolkit related rather than x11/wayland ? EDIT: Can't seem to reproduce anymore, might be misremembering things.
Note that it works fine if you switch to another X11 app. Maybe we're missing a focus-out event or something.
@emersion Do you have any idea how to make progress on this ? How do we debug an XWayland app ?
As usual, asking the question triggers the answer (xev in this case). The difference is a single LeaveNotify event. In each case there is a $mod KeyPress event before changing worksapce/focus with sway.
xev -> wayland
==============
[... more MotionNotify events ...]
MotionNotify event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636884588, (264,437), root:(265,1090),
state 0x10, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636884618, (264,437), root:(265,1090),
state 0x10, is_hint 0, same_screen YES
KeyPress event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636885778, (264,437), root:(265,1090),
state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
FocusOut event, serial 34, synthetic NO, window 0x600001,
mode NotifyNormal, detail NotifyNonlinear
xev -> X11
==========
[... more MotionNotify events ...]
MotionNotify event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636793761, (432,598), root:(433,619),
state 0x10, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636793767, (431,599), root:(432,620),
state 0x10, is_hint 0, same_screen YES
KeyPress event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636793785, (431,599), root:(432,620),
state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
FocusOut event, serial 34, synthetic NO, window 0x600001,
mode NotifyNormal, detail NotifyNonlinear
LeaveNotify event, serial 34, synthetic NO, window 0x600001,
root 0x39f, subw 0x0, time 1636793938, (431,599), root:(432,620),
mode NotifyNormal, detail NotifyNonlinear, same_screen YES,
focus NO, state 80
I found a unique relevant occurrence in xwayland at https://github.com/freedesktop/xorg-xserver/blob/5315f988d9f175e4850f4259f691a68d95ce7ac2/hw/xwayland/xwayland-input.c#L2557.
Note that it works fine if you switch to another X11 app.
At least the issue outlined in https://github.com/swaywm/sway/issues/6084 also occurs when focus switches to another X11 app.
However, I did notice a difference (test setup as outlined above): when the focus switches to another electron app, the tooltip stays persistent even on mouseover until removed by refocusing the original parent and making it vanish there. If focus switches to a wayland-native app, the tooltip is there, but vanishes on mouseover.
Interesting observation: If focus switches to an X11 app and afterwards to a wayland native app (without moving the pointer), behavior is identical to having switched to an X11 app, even if the surface below is now wayland native. Haven't tested this extensibly, though.
Assuming this to be the primary issue for this problem I want to add another observation that just happened:
I was on a (wayland-native) firefox with focus and pointer. On my second screen I have multiple Workspaces, let's call them w_visible and w_invisible with w_visible selected (who would have guesssed). Both contain X11-apps.
No focus on that second screen, no event that I could observe, but all of a sudden, a mouseover of the X11-app on w_invisible was popping up on top of the X11 app visible on the selected w_visible.
I am not sure if that is the same issue, but I though I'll add that observation in case it helps to determine what's going on where here.
FTR: wlroots: 0.12.0-g44fa2c4b (aka yesterday's master or so) still has the issue. Not sure if it helps anything, but at least an observation I can add to the stack.