Open Bug 1774531 Opened 2 years ago Updated 2 years ago

ubuntu 22.04+snap+xwayland: mouse move/hover tracking fails randomly

Categories

(Core :: Widget: Gtk, defect)

defect

Tracking

()

Tracking Status
firefox-esr102 --- affected
firefox104 --- affected
firefox105 --- affected
firefox106 --- affected

People

(Reporter: martin, Unassigned)

References

(Blocks 2 open bugs)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0

Steps to reproduce:

Unfortunately I don't have a solid steps to reproduce: the bug seems to be happening randomly. I'm opening a ticket in hopes that a more solid way to reproduce is found in the future.

Environment: Ubuntu 22.04 x86-64, GNOME 42.1, Wayland, Graphics: AMD Renoir.
Firefox running as snap package:

snap info firefox
name: firefox
summary: Mozilla Firefox web browser
publisher: Mozilla✓
store-url: https://snapcraft.io/firefox
contact: https://support.mozilla.org/kb/file-bug-report-or-feature-request-mozilla
license: unset
description: |
Firefox is a powerful, extensible web browser with support for modern web
application technologies.
commands:

  • firefox
  • firefox.geckodriver
    snap-id: 3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk
    tracking: latest/stable
    refresh-date: 7 days ago, at 22:06 EEST
    channels:
    latest/stable: 101.0.1-1 2022-06-09 (1443) 170MB -
    latest/candidate: 101.0.1-1 2022-06-09 (1443) 170MB -
    latest/beta: 102.0b8-1 2022-06-15 (1462) 169MB -
    latest/edge: 103.0a1 2022-06-14 (1461) 180MB -
    esr/stable: 91.10.0esr-1 2022-06-10 (1447) 161MB -
    esr/candidate: 91.10.0esr-1 2022-06-09 (1447) 161MB -
    esr/beta: ↑
    esr/edge: ↑
    installed: 101.0.1-1 (1443) 170MB -

Actual results:

Firefox stops responding to mouse hover events: the mouse cursor stops changing, the weblinks stop being underlined, but also the browser tabs stop being highlighted on hover. The text selection becomes very hard since the selection only appears after I release the mouse button.

Restarting Firefox fixes the issue until it manifests again. The bug always appears, however it does so randomly.
Moreover, the window resizing breaks: feels as if Firefox is unable to fill in the window anymore. For example, the window title area buttons (minimise/maximise/close) are no longer positioned in the upper-right corner of the screen.

Expected results:

Firefox should keep responding to mouse hover events.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Found a way to reproduce this quickly.

  1. Run Firefox on Ubuntu 22.04
  2. Run Intellij Idea Community from snap
  3. Alt+tab multiple times between Firefox and Intellij

I'm using two monitors, not sure whether this is vital to the reproduction steps or not.

Found the probable cause. In the "about:support / Window Protocol" I found out that Firefox was using xwayland. I enforced wayland by setting "export MOZ_ENABLE_WAYLAND=1" and now the bug can not be reproduced anymore. Also Firefox feels much faster.

I was just looking for this. I'm on Arch Linux with Wayland, Firefox installed through pacman (not snap) and the above solution seems to work for me as well. Thank you!

As per comment #3 this is on XWayland.

Summary: ubuntu 22.04+snap+wayland: mouse move/hover tracking fails randomly → ubuntu 22.04+snap+xwayland: mouse move/hover tracking fails randomly

How does one make "export MOZ_ENABLE_WAYLAND=1" persistent? When I logged out and logged back in, the setting was gone when I put 'printenv' into my terminal.

You could put it in your ~/.bashrc for example

(In reply to Alexandre LISSY :gerard-majax from comment #7)

You could put it in your ~/.bashrc for example

But would that make it only work in the terminal? I'd love to be able to launch it from the desktop as well.

(In reply to jmehmel from comment #8)

(In reply to Alexandre LISSY :gerard-majax from comment #7)

You could put it in your ~/.bashrc for example

But would that make it only work in the terminal? I'd love to be able to launch it from the desktop as well.

No, it should work everywhere, although it's not really the best solution ...

(In reply to Alexandre LISSY :gerard-majax from comment #9)

(In reply to jmehmel from comment #8)

(In reply to Alexandre LISSY :gerard-majax from comment #7)

You could put it in your ~/.bashrc for example

But would that make it only work in the terminal? I'd love to be able to launch it from the desktop as well.

No, it should work everywhere, although it's not really the best solution ...

What is the best option? I'm not loving running these two commands in the terminal just to make Firefox usable:

export MOZ_ENABLE_WAYLAND=1
MOZ_ENABLE_WAYLAND=1 firefox

I can't find the correct .desktop file for Firefox.

What are the problems or ramifactions of adding the export command to the .bashrc file?

It will apply to any Firefox or thunderbird you run. Olivier do you know where is the desktop file on Snap ?

Flags: needinfo?(olivier)

(In reply to Alexandre LISSY :gerard-majax from comment #11)

It will apply to any Firefox or thunderbird you run. Olivier do you know where is the desktop file on Snap ?

I think the confusion I've got on this is which command to set the environment and which command to just run Firefox.

export MOZ_ENABLE_WAYLAND=1 -> sets the environment, yes?
MOZ_ENABLE_WAYLAND=1 firefox -> runs firefox.

But does this mean that the above command to set the environment is useless?

(In reply to jmehmel from comment #12)

(In reply to Alexandre LISSY :gerard-majax from comment #11)

It will apply to any Firefox or thunderbird you run. Olivier do you know where is the desktop file on Snap ?

I think the confusion I've got on this is which command to set the environment and which command to just run Firefox.

export MOZ_ENABLE_WAYLAND=1 -> sets the environment, yes?

Yes

MOZ_ENABLE_WAYLAND=1 firefox -> runs firefox.

It does the same, but only for this instance

But does this mean that the above command to set the environment is useless?

That depends what you are trying to achieve. If you are willing to manually issue MOZ_ENABLE_WAYLAND=1 snap run firefox until the Snap defaults to Wayland, then you dont need to export within a .bashrc.

You would need to export in .bashrc or .desktop file if you expect clicking on the launcher to also set Wayland. The situation regarding XWayland / Wayland is still a bit complicated, so I can't really give hints on when stable Snap might move to Wayland by default again.

The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to Alexandre LISSY :gerard-majax from comment #13)

That depends what you are trying to achieve. If you are willing to manually issue MOZ_ENABLE_WAYLAND=1 snap run firefox until the Snap defaults to Wayland, then you dont need to export within a .bashrc.

You would need to export in .bashrc or .desktop file if you expect clicking on the launcher to also set Wayland. The situation regarding XWayland / Wayland is still a bit complicated, so I can't really give hints on when stable Snap might move to Wayland by default again.

Okay! I think I understand... because this is a bug; there isn't really a good 'fix' to get it so that Firefox operates in Wayland by clicking on the launcher? I've tried doing the .bashrc and .desktop and haven't been able to get it to work... and haven't had the time to fully troubleshoot. (Such as trying to find the right .desktop for the snap firefox.)

But running MOZ_ENABLE_WAYLAND=1 snap run firefox at least gets me to getting Firefox going with only one command.

I suppose my other options are to not run Wayland, or not use Firefox until it's fixed... neither of which I want to do!

I suggest putting MOZ_ENABLE_WAYLAND=1 in /etc/environment, if you have root access on your machine.

(In reply to Alexandre LISSY :gerard-majax from comment #11)

It will apply to any Firefox or thunderbird you run. Olivier do you know where is the desktop file on Snap ?

The desktop file for firefox is installed by snapd here: /var/lib/snapd/desktop/applications/firefox_firefox.desktop.
Don't edit it though, it is re-generated every time the snap is refreshed, so you would be losing your changes.

Flags: needinfo?(olivier)

Hi, I'm affected by this bug too and if it can be useful I have dual monitor too.
Cheers

(In reply to Olivier Tilloy from comment #16)

I suggest putting MOZ_ENABLE_WAYLAND=1 in /etc/environment, if you have root access on your machine.

Would there be any downside to this? Should I remove it when the bug is solved?

(In reply to Olivier Tilloy from comment #16)

I suggest putting MOZ_ENABLE_WAYLAND=1 in /etc/environment, if you have root access on your machine.

Oh, and would this allow it to start from the GUI instead of a terminal?

(In reply to jmehmel from comment #21)

(In reply to Olivier Tilloy from comment #16)

I suggest putting MOZ_ENABLE_WAYLAND=1 in /etc/environment, if you have root access on your machine.

Oh, and would this allow it to start from the GUI instead of a terminal?

yep!

After doing some googling... would it be safer/better to put this into .profile or .pam_environment? (I don't have the latter file that I can see, though)

I'm seeing some notes that editing /etc/environment isn't recommended...

(In reply to c.corvino81 from comment #22)

(In reply to jmehmel from comment #21)

(In reply to Olivier Tilloy from comment #16)

I suggest putting MOZ_ENABLE_WAYLAND=1 in /etc/environment, if you have root access on your machine.

Oh, and would this allow it to start from the GUI instead of a terminal?

yep!

This workaround worked thanks. I think the fix would be easy for Firefox to be implemented soon but this issue needs more attention.

I also have a dual screen, and faces the same issue since upgrading Ubuntu to 22.04 (which switched Firefox as a snap).

Putting MOZ_ENABLE_WAYLAND=1 in my ~/.profile has been a valid workaround (allowing me to have the workaround when clicking on the icon)

For what it is worth, I have a VM where I run a Firefox (mozilla bin, not Snap) and I got hit by the issue as well a few days ago (never before). Forcing wayland avoids the problem.

You need to log in before you can comment on or make changes to this bug.