raboof / notion

Tiling tabbed window manager
https://notionwm.net/
GNU Lesser General Public License v2.1
268 stars 63 forks source link

Firefox tooltips blink #295

Closed ongardie closed 3 years ago

ongardie commented 3 years ago

Hi, some of the tooltips in Firefox hide immediately when they are displayed, making them nearly impossible to read. I was hoping for some help or guidance to pin down what's happening.

Steps to repro:

  1. Under Notion, open Firefox.
  2. Navigate to, for example, https://xkcd.com.
  3. Hover over the tab in the tab bar. You should see a tooltip rendered until you move the mouse.
  4. Hover over the image. You should see title text rendered similarly, but in my case it disappears very quickly.

Here's what I've observed:

Here's the xwininfo/xprop for Firefox 81 under no window manager (Xephyr). First with no tooltip:

~$ DISPLAY=:1 xwininfo -tree -root

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

  Root window id: 0x399 (the root window) (has no name)
  Parent window id: 0x0 (none)
     9 children:
     0xa00001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x800001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200003 "xkcd: Masks - Mozilla Firefox": ("Navigator" "Firefox")  576x432+64+0  +64+0
        1 child:
        0x200004 (has no name): ()  1x1+-1+-1  +63+-1
     0x600001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200016 (has no name): ("Firefox" "Firefox")  100x100+0+0  +0+0
        1 child:
        0x20001a (has no name): ()  1x1+-1+-1  +-1+-1
     0x200013 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x400001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200010 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x200001 "Firefox": ("firefox" "Firefox")  10x10+10+10  +10+10

With the tab bar tooltip:

~$ DISPLAY=:1 xwininfo -tree -root

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

  Root window id: 0x399 (the root window) (has no name)
  Parent window id: 0x0 (none)
     10 children:
     0x20002c "xkcd: Masks": ("Firefox" "Firefox")  109x45+121+42  +121+42
        1 child:
        0x20002d (has no name): ()  1x1+-1+-1  +120+41
     0xa00001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x800001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200003 "xkcd: Masks - Mozilla Firefox": ("Navigator" "Firefox")  576x432+64+0  +64+0
        1 child:
        0x200004 (has no name): ()  1x1+-1+-1  +63+-1
     0x600001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200016 (has no name): ("Firefox" "Firefox")  100x100+0+0  +0+0
        1 child:
        0x20001a (has no name): ()  1x1+-1+-1  +-1+-1
     0x200013 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x400001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200010 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x200001 "Firefox": ("firefox" "Firefox")  10x10+10+10  +10+10

~$ DISPLAY=:1 xprop -id 0x20002c  
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        Initial state is Normal State.
        window id # of group leader: 0x200001
WM_WINDOW_ROLE(STRING) = "Popup"
XdndAware(ATOM) = BITMAP
_NET_WM_OPAQUE_REGION(CARDINAL) = 
WM_TRANSIENT_FOR(WINDOW): window id # 0x200003
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_TOOLTIP
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 2097198, 2097199
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x20002d
WM_CLIENT_LEADER(WINDOW): window id # 0x200001
_NET_WM_PID(CARDINAL) = 2758984
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "fractal"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 0, 0
        program specified minimum size: 69 by 45
        program specified maximum size: 533 by 32767
        program specified base size: 69 by 45
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "Firefox", "Firefox"
WM_ICON_NAME(STRING) = "xkcd: Masks"
_NET_WM_ICON_NAME(UTF8_STRING) = "xkcd: Masks"
WM_NAME(STRING) = "xkcd: Masks"
_NET_WM_NAME(UTF8_STRING) = "xkcd: Masks"

And with the content tooltip:

~$ DISPLAY=:1 xwininfo -tree -root

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

  Root window id: 0x399 (the root window) (has no name)
  Parent window id: 0x0 (none)
     12 children:
     0x20003c "Firefox": ("Firefox" "Firefox")  533x79+107+256  +107+256
        1 child:
        0x20003d (has no name): ()  1x1+-1+-1  +106+255
     0x200038 "Firefox": ("Firefox" "Firefox")  200x200+0+0  +0+0
        1 child:
        0x200039 (has no name): ()  1x1+-1+-1  +-1+-1
     0x20002c "xkcd: Masks": ("Firefox" "Firefox")  109x45+121+42  +121+42
        1 child:
        0x20002d (has no name): ()  1x1+-1+-1  +120+41
     0xa00001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x800001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200003 "xkcd: Masks - Mozilla Firefox": ("Navigator" "Firefox")  576x432+64+0  +64+0
        1 child:
        0x200004 (has no name): ()  1x1+-1+-1  +63+-1
     0x600001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200016 (has no name): ("Firefox" "Firefox")  100x100+0+0  +0+0
        1 child:
        0x20001a (has no name): ()  1x1+-1+-1  +-1+-1
     0x200013 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x400001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200010 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x200001 "Firefox": ("firefox" "Firefox")  10x10+10+10  +10+10

~$ DISPLAY=:1 xprop -id 0x20003c  
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        Initial state is Normal State.
        window id # of group leader: 0x200001
WM_WINDOW_ROLE(STRING) = "Popup"
XdndAware(ATOM) = BITMAP
_NET_WM_OPAQUE_REGION(CARDINAL) = 
WM_TRANSIENT_FOR(WINDOW): window id # 0x200003
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_TOOLTIP
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 2097214, 2097215
_NET_WM_USER_TIME(CARDINAL) = 398829891
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x20003d
WM_CLIENT_LEADER(WINDOW): window id # 0x200001
_NET_WM_PID(CARDINAL) = 2758984
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "fractal"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 0, 0
        program specified minimum size: 110 by 45
        program specified maximum size: 533 by 32766
        program specified base size: 110 by 45
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "Firefox", "Firefox"
WM_ICON_NAME(STRING) = "Firefox"
_NET_WM_ICON_NAME(UTF8_STRING) = "Firefox"
WM_NAME(STRING) = "Firefox"
_NET_WM_NAME(UTF8_STRING) = "Firefox"

I navigated forward and back and got a bit of a different result:

~$ DISPLAY=:1 xwininfo -tree -root

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

  Root window id: 0x399 (the root window) (has no name)
  Parent window id: 0x0 (none)
     12 children:
     0x20003c "Haunted Halloween masks from a mysterious costume shop that turn you evil and grow into your skin score a surprisingly high 80% filtration efficiency in R. L. Stine-sponsored NIOSH tests.": ("Firefox" "Firefox")  533x79+107+227  +107+227
        1 child:
        0x20003d (has no name): ()  1x1+-1+-1  +106+226
     0x200038 "Firefox": ("Firefox" "Firefox")  200x200+0+0  +0+0
        1 child:
        0x200039 (has no name): ()  1x1+-1+-1  +-1+-1
     0x20002c "xkcd: Masks": ("Firefox" "Firefox")  109x45+121+42  +121+42
        1 child:
        0x20002d (has no name): ()  1x1+-1+-1  +120+41
     0xa00001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x800001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200003 "xkcd: Masks - Mozilla Firefox": ("Navigator" "Firefox")  576x432+64+0  +64+0
        1 child:
        0x200004 (has no name): ()  1x1+-1+-1  +63+-1
     0x600001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200016 (has no name): ("Firefox" "Firefox")  100x100+0+0  +0+0
        1 child:
        0x20001a (has no name): ()  1x1+-1+-1  +-1+-1
     0x200013 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x400001 "/home/ongardie/opt/firefox/firefox-bin": ("/home/ongardie/opt/firefox/firefox-bin" "/home/ongardie/opt/firefox/firefox-bin")  10x10+10+10  +10+10
     0x200010 "Firefox": ()  10x10+-100+-100  +-100+-100
     0x200001 "Firefox": ("firefox" "Firefox")  10x10+10+10  +10+10

~$ DISPLAY=:1 xprop -id 0x20003c  
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        Initial state is Normal State.
        window id # of group leader: 0x200001
WM_WINDOW_ROLE(STRING) = "Popup"
XdndAware(ATOM) = BITMAP
_NET_WM_OPAQUE_REGION(CARDINAL) = 
WM_TRANSIENT_FOR(WINDOW): window id # 0x200003
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_TOOLTIP
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 2097214, 2097215
_NET_WM_USER_TIME(CARDINAL) = 398948850
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x20003d
WM_CLIENT_LEADER(WINDOW): window id # 0x200001
_NET_WM_PID(CARDINAL) = 2758984
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "fractal"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 0, 0
        program specified minimum size: 110 by 45
        program specified maximum size: 533 by 32766
        program specified base size: 110 by 45
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "Firefox", "Firefox"
WM_ICON_NAME(STRING) = "Haunted Halloween masks from a mysterious costume shop that turn you evil and grow into your skin score a surprisingly high 80% filtration efficiency in R. L. Stine-sponsored NIOSH tests."
_NET_WM_ICON_NAME(UTF8_STRING) = "Haunted Halloween masks from a mysterious costume shop that turn you evil and grow into your skin score a surprisingly high 80% filtration efficiency in R. L. Stine-sponsored NIOSH tests."
WM_NAME(STRING) = "Haunted Halloween masks from a mysterious costume shop that turn you evil and grow into your skin score a surprisingly high 80% filtration efficiency in R. L. Stine-sponsored NIOSH tests."
_NET_WM_NAME(UTF8_STRING) = "Haunted Halloween masks from a mysterious costume shop that turn you evil and grow into your skin score a surprisingly high 80% filtration efficiency in R. L. Stine-sponsored NIOSH tests."

I tried creating a kludge based on role "Popup" or class "Firefox", but these didn't seem to take effect. Can anyone help reproduce this or point me in the right direction?

ongardie commented 3 years ago

Minor update: Firefox 78.3 (newer ESR release, upstream or Debian 10 packaging) also behaves correctly (Notion 4.0.1, Xorg). It seems like something changed in just the last few months.

wilhelmy commented 3 years ago

Just to be sure, this isn't related to that issue where firefox isn't on your leftmost screen? I don't have any flickering, but I always have firefox on the leftmost screen to work around that bug. Edit: I'm on 81.0.1 on opensuse

ongardie commented 3 years ago

Just to be sure, this isn't related to that issue where firefox isn't on your leftmost screen? I don't have any flickering, but I always have firefox on the leftmost screen to work around that bug. --@wilhelmy

That issue is certainly very annoying, but this one is different. That one affects at least some context menus, and this one doesn't seem to. I'm seeing this issue on a desktop computer with only one (large) screen.

BTW, I still see this issue on Firefox 82 now.

fantasai commented 3 years ago

@ongardie I'm not able to reproduce on Firefox 83b (Notion 4.0.1/Xubuntu20.04) fwiw. Tooltip works just fine on the XKCD comic, even when it's hanging off the edge of the frame. Possibly I have a different setup, or maybe whatever was causing it changed in the 83 release?

ongardie commented 3 years ago

@ongardie I'm not able to reproduce on Firefox 83b (Notion 4.0.1/Xubuntu20.04) fwiw. Tooltip works just fine on the XKCD comic, even when it's hanging off the edge of the frame. Possibly I have a different setup, or maybe whatever was causing it changed in the 83 release? --@fantasai

Hmm, I just tried Firefox 83.0b4 and still have the same issue. I'm on Debian 10, in case that matters.

ongardie commented 3 years ago

I reproduced the issue again inside two different QEMU/KVM virtual machines:

In each case, I ran these through virt-manager, booted into the live Xfce image, sent Ctrl+Alt+F1/F2, killed X/lightdm, installed Notion using apt, and ran startx notion. These used the default Notion and Firefox configs.

So, it seems unlikely that my machine or my setup could be to blame.

hahjortland commented 3 years ago

I get these flashing tooltips with Firefox 82.0, Sawfish 1.11.90, and Ubuntu 20.04.1 LTS (Ubuntu focal).

It seems the y position of the tooltip changes over these settings, and when it is buggy, the position is with the upper left corner of the tooltip right at the pointer position. I therefore suspect that the problem is that the tooltip steals focus from the browser window when it appears. When the browser window loses focus, it hides the tooltip again, hence the blinking behavior.

ongardie commented 3 years ago

Thanks @hahjortland, I'm glad I'm not the only one to see this issue! I reproduced the flashing tooltips with Sawfish 1.11.90 running under Xephyr. I confirmed that your workaround of running in fullscreen mode works for me under both Notion and Sawfish.

I didn't see any effect with setting browser.tabs.drawInTitlebar, either visibly or with respect to tooltips, under either window manager. Maybe it wasn't taking effect for me.

The tooltip stealing focus sounds entirely plausible to me.

ongardie commented 3 years ago

It seems the y position of the tooltip changes over these settings, and when it is buggy, the position is with the upper left corner of the tooltip right at the pointer position. I therefore suspect that the problem is that the tooltip steals focus from the browser window when it appears. When the browser window loses focus, it hides the tooltip again, hence the blinking behavior. -- @hahjortland

The tooltip stealing focus sounds entirely plausible to me. -- @ongardie

Well, I spoke too soon and then tried one more thing. In my Notion config, I set:

ioncore.set{
  mousefocus="disabled",
}

so that window focus does not follow the mouse. I still see the tooltips blinking. Does that disprove this hypothesis?

ongardie commented 3 years ago

I hg bisected the problem to the Firefox changeset https://hg.mozilla.org/mozilla-central/rev/9b17a5aeded6 ("Avoid unnecessary coordinate conversions when showing tooltips"), which was created to address https://bugzilla.mozilla.org/show_bug.cgi?id=1566422 ("Make content link tooltip handling work correctly in Fission"). That led me to this recently reported regression https://bugzilla.mozilla.org/show_bug.cgi?id=1676020 ("Title tooltips flash off immediately"), which seems to be the same issue I've described here. I'll chime in on Bugzilla and link them back here too.

hahjortland commented 3 years ago

I use GNOME (gnome-flashback) + Sawfish. That might be why browser.tabs.drawInTitlebar changes the window layout on my end.

xev reports LeaveNotify when the pointer leaves the window and FocusOut when the window loses focus, so I guess the tooltip does not need to actually steal window focus, it just needs to obscure the pointer. It seems the Bugzilla report you found confirms the mechanism of the bug: "...receives a "mouseout" event and calls HideTooltip()."

urbanware-org commented 3 years ago

Even though the mentioned bugzilla ticket (Title tooltips flash off immediately) is not closed yet, the described issue (also faced it myself before) seems to be gone in the latest Firefox version (84.0.2).

raboof commented 3 years ago

That's a bit suspicious but still good to hear. I'll go ahead and close the issue for now, though if anyone encounters is with 84.0.2+ feel free to reopen!

jakeprobst commented 2 years ago

This is still happing to me with the latest firefox nightly (101.0a1) but after reading about how it was about window focus being lost from the tooltip overlapping I solved it with this userChrome.css snippet:

tooltip {
    transform: translate(3px, 0px);
}

just moves the tooltip far enough away to not trigger any focusout events. posting in case anyone else is still having this issue.