Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1054334 (ffwayland) - [GTK3] Firefox wayland support
Summary: [GTK3] Firefox wayland support
Keywords:
Status: ASSIGNED
Alias: ffwayland
Product: Fedora
Classification: Fedora
Component: firefox
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Martin Stransky
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/stransky/gecko-dev
Whiteboard:
Depends On: 1647457 1709854 1752240 1786105 1825840 1870824 1943571 1244683 1260769 1260773 1264355 1349014 1349016 1350058 1350059 1350060 1350062 1350077 1457201 1458034 1460973 1462725 1463181 1464017 1464497 1464916 1465331 1466377 1466800 1467104 1467792 1470031 1470600 1476662 1476715 1484651 1495147 1505745 1507369 1537341 1585332 1585393 1586223 1590388 1592142 1607418 1625736 1636371 1641335 1648492 1650051 1651816 1666410 1672270 1673291 1676331 1676890 1677062 1678897 1679517 1683378 1684424 1690363 1692565 1693091 1693437 1693826 1693911 1708236 1709840 1709852 1717946 1718591 1718643 1725167 1725308 1729164 1731186 1731642 1738597 1743586 1744028 1745361 1750533 1751372 1753751 1754214 1754299 1755029 1755878 1757397 1757679 1759876 1760359 1762310 1762747 1766818 1767439 1767448 1768055 1768135 1768217 1770064 1770897 1773386 1773522 1773715 1773911 1773943 1774014 1774673 1775896 1776334 1786104 1792900 1793439 1793854 1793969 1798081 1804433 1818081 1819195 1823105 1824278 1825400 1826242 1829329 1857686 1863046 1886643 1888920
Blocks: WaylandRelated 1678453
TreeView+ depends on / blocked
 
Reported: 2014-01-16 16:18 UTC by Alexander Larsson
Modified: 2021-03-26 17:07 UTC (History)
25 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1244683 1260769 1260773 (view as bug list)
Environment:
Last Closed: 2018-10-11 12:33:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch (24.31 KB, patch)
2015-02-06 12:59 UTC, Martin Stransky
no flags Details | Diff
A patch for fixing to miximize request does not hanlde on weston. (2.09 KB, patch)
2017-05-31 02:46 UTC, Hiroshi Hatake
no flags Details | Diff
Patch for adding error handling against posix_fallocate. (1.50 KB, patch)
2017-06-13 10:01 UTC, Hiroshi Hatake
no flags Details | Diff
Popup window sometimes grayed out when clicking repeatedly and rapidly. (645.19 KB, image/png)
2017-06-14 03:21 UTC, Hiroshi Hatake
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Mozilla Foundation 635134 0 P2 NEW [meta] Firefox Wayland port 2020-11-04 21:03:09 UTC

Description Alexander Larsson 2014-01-16 16:18:36 UTC
I was just trying the new firefox-gtk3 build on the gtk broadway backend:

broadwayd&
GDK_BACKEND=broadway  firefox-gtk3

This crashes in nsWindow::GetDPI() which does a direct GDK_DISPLAY_XDISPLAY(display) call, in order to later call DisplayHeightMM(). This will not work on non-X backends.

You can easily fix this by instead using gdk_display_get_default_screen(display) and then gdk_screen_get_width_mm(), etc.

Per-screen sizes are a bit lame though, if you want to be closer to the "real" situation you have to handle multiple-monitors per screen, via the gdk_screen_get_monitor_width_mm() apis, but that depends on what the "DPI" is used for.

Also, in later versions of Gtk+ we also have gdk_screen_get_monitor_scale_factor() which signals HiDPI scaling, it would be nice if firefox could read this and propagate to the layout.css.devPixelsPerPx config option...

Anyway, firefox in broadway is not necessarily very important, but it is a good preparation for generic multi-backend handling, which will be required for wayland support later.

Comment 1 Alexander Larsson 2014-01-16 16:30:01 UTC
Here are general docs on how to write backend-specific code in gtk3 if needed:
https://developer.gnome.org/gtk3/stable/ch24s02.html#id-1.6.3.4.9

Comment 2 Fedora End Of Life 2015-01-09 21:06:52 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Martin Stransky 2015-02-03 14:10:37 UTC
Upstream bug - https://bugzilla.mozilla.org/show_bug.cgi?id=635134

Comment 4 Martin Stransky 2015-02-06 12:59:25 UTC
Created attachment 988853 [details]
patch

I have this one so far. Should work but it does not :(

Comment 5 Martin Stransky 2015-02-06 13:05:24 UTC
Alex, any idea why I'm getting a broken? cairo context from expose events here?

When I run Firefox with this patch inside broadway, I'm getting in expose event:

(gdb) p	mGdkWindow
$3 = 0x7fffead3fb40 [GdkBroadwayWindow]
(gdb) p	gdkVisual
$4 = 0x7ffff6b03aa0 [GdkBroadwayVisual]

but when I try to create a cairo surface from the given *cr context in the expose event:

cairo_surface_t *surf = cairo_get_target(cr);

the surface is 0x0 pixels wide which is apparently wrong.

Any idea here?

Thanks.

Comment 6 Jaroslav Reznik 2015-03-03 16:58:16 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 7 Matthias Clasen 2015-03-12 13:54:50 UTC
Martin,

it would be helpful to more concrete what backend functions you have problems with. As one example, randomly picked from the upstream bug, I see workarea being discussed - we have gdk_screen_get_monitor_workarea now which provides a backend-agnostic way to get at the information.

Comment 8 Martin Stransky 2015-06-12 20:24:06 UTC
Thanks.First of all, is it possible to open GDK display before gtk_init? Because I can open only X display by such way. How is actually the broadway/wayland display opened? 

Mozilla reads the DISPLAY variable and tries to open it:
http://mxr.mozilla.org/mozilla-central/source/toolkit/xre/nsAppRunner.cpp#3716

But that fails on wayland/broadway. (I tried to set DISPLAY to opened broadway display).

Comment 9 Martin Stransky 2015-06-12 20:27:55 UTC
I use the info here:
https://developer.gnome.org/gtk3/stable/gtk-broadway.html

opened the broadway display (launch gedit there to make sure it works), set DISPLAY to the actual broadway display (DISPLAY=:5) and also set the GDK_BACKEND=broadway env. But gdk_display_open(":5") just fails here.

Comment 10 Martin Stransky 2015-07-09 13:38:04 UTC
Looks like there's a problem with some signals connected to the window.

Comment 11 Martin Stransky 2015-08-27 12:15:44 UTC
Guys, what's status of the Wayland backend? I see some bugs (new windows painted behind the main application for instance) which works on broadway backend.

Actually Firefox works very well on broadway backend now (with some extra patches of course), so can I take the broadway backend a reference and expect Wayland will be fixed for it?

Comment 12 Jonas Ådahl 2015-08-27 14:41:59 UTC
(In reply to Martin Stransky from comment #11)
> Guys, what's status of the Wayland backend? I see some bugs (new windows
> painted behind the main application for instance) which works on broadway
> backend.

How are the windows that are supposed to be mapped above the main window created? I.e. what type/hint and whether they main window is set as a parent. Manual stacking order won't work, so it has to be done with a parent-child relationship (i.e. transient for).

What other bugs are you experiencing?

Comment 13 Martin Stransky 2015-08-28 07:01:10 UTC
(In reply to Jonas Ådahl from comment #12)
> (In reply to Martin Stransky from comment #11)
> > Guys, what's status of the Wayland backend? I see some bugs (new windows
> > painted behind the main application for instance) which works on broadway
> > backend.
> 
> How are the windows that are supposed to be mapped above the main window
> created? I.e. what type/hint and whether they main window is set as a
> parent. Manual stacking order won't work, so it has to be done with a
> parent-child relationship (i.e. transient for).

It's a pretty much standard way - create a window by gtk_window_new() and then set it transient for parent by gtk_window_set_transient_for(). see:

http://mxr.mozilla.org/mozilla-central/source/widget/gtk/nsWindow.cpp#3516
http://mxr.mozilla.org/mozilla-central/source/widget/gtk/nsWindow.cpp#3592

The same code is used for Gtk2/Gtk3 and works well on broadway as well. Ony wayland has this issue.

Comment 14 Martin Stransky 2015-08-28 07:03:57 UTC
btw. Is correct the assumption that I can use broadway as a reference backend? It much easier to develop there than on Wayland session, where clipboard between X/Wayland apps does not work.

Comment 15 Jonas Ådahl 2015-08-28 07:27:07 UTC
(In reply to Martin Stransky from comment #14)
> btw. Is correct the assumption that I can use broadway as a reference
> backend? It much easier to develop there than on Wayland session, where
> clipboard between X/Wayland apps does not work.

I'm going to assume not. Broadway is AFAIK an experimental backend. Also X/Wayland clipboard integration has been available for a few 3.17. versions of mutter. Have you tried how it works on newer versions? There has been quite a few improvements from 3.16 already.

Comment 16 Martin Stransky 2015-08-28 08:39:09 UTC
I run rawhide so I have gtk 3.17.7. I tested the Firefox on Wayland right now and I still see the same problem with transient windows.

Comment 17 Jonas Ådahl 2015-08-28 08:44:20 UTC
I tried building firefox from git with the patch from earlier this month linked in the upstream bug report, but it just crashes on startup. Running on X11 without the patch seems to work fine. Is there some other version I can test?

It would also be helpful it you could describe the issues (and how to reproduce) you are seeing.

Comment 18 Martin Stransky 2015-08-28 09:25:31 UTC
Okay, I'll provide a copr repo for that.

Comment 19 Martin Stransky 2015-08-31 10:36:38 UTC
There's the copr repo:
http://copr-fe.cloud.fedoraproject.org/coprs/stransky/firefox-wayland/

You can also build your own package with enabled debug (edit the spec file) from:
https://stransky.fedorapeople.org/firefox-wayland-43-0a1.fc22.src.rpm

Comment 20 Martin Stransky 2015-09-07 16:42:58 UTC
Git repo with latest fixes is available at https://github.com/stransky/gecko-dev

Comment 22 Fedora End Of Life 2016-07-19 10:53:30 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 23 Jan Kurik 2016-07-26 05:05:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 24 Hiroshi Hatake 2017-05-31 02:46:56 UTC
Created attachment 1283571 [details]
A patch for fixing to miximize request does not hanlde on weston.

Hi, I've tested latest stransky/gecko-dev (09204a8) on Debian Stretch with weston 1.12.0.
I've noticed that maximizing firefox does not work in weston.
This does not occur in GNOME on Wayland.

Comment 25 Hiroshi Hatake 2017-05-31 09:45:27 UTC
I've also found that child menu does not appear with weston 1.12.0 and gnome-shell 3.22.3.

Comment 26 Martin Stransky 2017-05-31 10:02:17 UTC
(In reply to Hiroshi Hatake from comment #25)
> I've also found that child menu does not appear with weston 1.12.0 and
> gnome-shell 3.22.3.

I'm working on that now.

Comment 27 Martin Stransky 2017-05-31 10:21:22 UTC
(In reply to Hiroshi Hatake from comment #24)
> Created attachment 1283571 [details]
> A patch for fixing to miximize request does not hanlde on weston.
> 
> Hi, I've tested latest stransky/gecko-dev (09204a8) on Debian Stretch with
> weston 1.12.0.
> I've noticed that maximizing firefox does not work in weston.
> This does not occur in GNOME on Wayland.

Thanks. I used a slightly different patch, added as commit 36ab77590d39adb2e4775b2e2e10845788b07092

Comment 28 Hiroshi Hatake 2017-06-13 10:01:45 UTC
Created attachment 1287203 [details]
Patch for adding error handling against posix_fallocate.

I've found that MOZ_RELEASE_ASSERT(ret == 0, "Mapping file allocation failed."); always fail when firing "open in new window" event.

Comment 29 Hiroshi Hatake 2017-06-14 03:21:27 UTC
Created attachment 1287508 [details]
Popup window sometimes grayed out when clicking repeatedly and rapidly.

I've found another issue for pop up window.
Pop up windows sometimes grayed out when clicking repeatedly and rapidly.
Sometimes grayed out them before firefox is launched completely.
But latter is rarely occurred.
Please see attached screenshot in more detail.

Comment 30 Martin Stransky 2017-06-22 09:41:38 UTC
(In reply to Hiroshi Hatake from comment #28)
> Created attachment 1287203 [details]
> Patch for adding error handling against posix_fallocate.
> 
> I've found that MOZ_RELEASE_ASSERT(ret == 0, "Mapping file allocation
> failed."); always fail when firing "open in new window" event.

Thanks for the patch. Please open a new bug for each issue next time, this bug is just for tracking purpose.

Comment 31 kxra 2017-10-02 00:15:53 UTC
Is this something that can be targeted for Firefox quantum's release? I'm sure if the Firefox-Wayland copr repository were updated with FF57, many people would be eager to help test!

Comment 32 Martin Stransky 2017-10-02 06:42:10 UTC
(In reply to kxra from comment #31)
> Is this something that can be targeted for Firefox quantum's release? I'm
> sure if the Firefox-Wayland copr repository were updated with FF57, many
> people would be eager to help test!

Mozilla is not taking the Wayland patches to Quantum release. The Wayland tree (https://github.com/stransky/gecko-dev.git) is updated to latest trunk which is Firefox 58 right now. I'll resubmit the copr builds for better testing. But you can find our testing builds (Nightly, Wayland, CSD) at flatpak at https://firefox-flatpak.mojefedora.cz/

Comment 33 kxra 2017-10-02 12:41:01 UTC
Ah, I see. Well, the copr builds are appreciated! Looking forward to that

Comment 34 kxra 2017-10-08 11:59:51 UTC
Are you still able to get a working build available on copr? I do hope that Mozilla starts supporting flatpak natively as well

Comment 35 Martin Stransky 2017-10-09 07:50:08 UTC
(In reply to kxra from comment #34)
> Are you still able to get a working build available on copr? I do hope that
> Mozilla starts supporting flatpak natively as well

Copr is broken somehow when building from github but I don't have to solve it now.

Comment 36 Jonas Heinrich 2017-10-15 19:05:41 UTC
It fails to compile after I set "enable-default-toolkit=cairo-gtk3-wayland" in my build script https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firefox-wayland-git
This is the compile log: https://git.project-insanity.org/snippets/24

Thank you for your work Martin!

Comment 37 Martin Stransky 2017-10-16 07:59:25 UTC
(In reply to Jonas Heinrich from comment #36)
> It fails to compile after I set "enable-default-toolkit=cairo-gtk3-wayland"
> in my build script
> https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=firefox-wayland-git
> This is the compile log: https://git.project-insanity.org/snippets/24
> 
> Thank you for your work Martin!

That's caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1341234
You can use workaround we have in Fedora [1] or build without system nspr/nss.

[1] https://src.fedoraproject.org/rpms/firefox/blob/stransky-firefox-57/f/firefox-mozconfig#_24

Comment 38 Fedora End Of Life 2017-11-16 19:04:20 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 39 Fedora End Of Life 2018-02-20 15:22:07 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 40 Martin Stransky 2018-05-28 10:57:53 UTC
Wayland enabled build is available here:

https://bodhi.fedoraproject.org/updates/FEDORA-2018-c0674d672f

Comment 41 Christian Stadelmann 2018-05-28 11:13:35 UTC
(In reply to Martin Stransky from comment #40)
> Wayland enabled build is available here:
> 
> https://bodhi.fedoraproject.org/updates/FEDORA-2018-c0674d672f

That build does NOT use wayland when run in a GNOME/wayland session by default. Is there any option or environment variable one needs to set?

Comment 44 Christian Stadelmann 2018-05-28 11:59:01 UTC
(In reply to Martin Stransky from comment #42)
> (In reply to Christian Stadelmann from comment #41)
> > That build does NOT use wayland when run in a GNOME/wayland session by default.  Is there any option or environment variable one needs to set?
> 
> Yes, run "Firefox on Wayland" instead of "Firefox" :)

Nice, many thanks!

Where does one report bugs against the wayland version? Here or upstream?

Comment 45 Martin Stransky 2018-05-28 12:30:21 UTC
Please report upstream and make it block Bug 635134.

Comment 46 Martin Stransky 2018-10-11 12:33:00 UTC
Wayland is default in Fedora 30 now (rawhide).

Comment 47 Jan Pokorný [poki] 2018-10-12 08:52:14 UTC
For those having an issue with Wayland, run Firefox for instance like
this:  env GDK_BACKEND=x11 firefox

In my case, I have an issue with cursor not being propagated to the
overall window (it disappears when moving over the window boundary
inwards, and it's apparently not silently active either).
Not sure if this may be because of Sway window manager.

firefox-62.0.3-2.fc30.x86_64
gtk3-3.24.1-1.fc30.x86_64
xorg-x11-server-Xwayland.x86_64
libwayland-client.x86_64

Comment 48 Martin Stransky 2018-10-12 08:58:30 UTC
(In reply to Jan Pokorný from comment #47)
> For those having an issue with Wayland, run Firefox for instance like
> this:  env GDK_BACKEND=x11 firefox
> 
> In my case, I have an issue with cursor not being propagated to the
> overall window (it disappears when moving over the window boundary
> inwards, and it's apparently not silently active either).
> Not sure if this may be because of Sway window manager.
> 
> firefox-62.0.3-2.fc30.x86_64
> gtk3-3.24.1-1.fc30.x86_64
> xorg-x11-server-Xwayland.x86_64
> libwayland-client.x86_64

You can simply install firefox-x11 package which provides such functionality. You can set Firefox X11 as a default applications, there's a menu entry for it, has its own firefox-x11 launcher...

Comment 49 Jan Pokorný [poki] 2018-11-27 23:24:51 UTC
re [comment 48]:

I don't use menu entries, but I see it's a prevalent use case
so that's indeed nice to have something convenient like that.
That suggestions for those going the more direct route.


Anyway, I am now using sway 1.0 beta and can happily confirm that
since 63.0.3-3, Firefox works like a charm there modulo some known
issues:
- https://github.com/swaywm/sway/issues/3197 (on the sway side)
- and that's all for now

Thank you very much for that 63.0.3-3!

[FTR. I am using COPR build
https://copr.fedorainfracloud.org/coprs/jpokorny/sway-testing/build/820081/
and wlroots-0.1-4.fc30.x86_64 I've just updated with patches from
https://github.com/swaywm/wlroots/pull/1384 (referred from
https://github.com/swaywm/sway/issues/3115) and
https://github.com/swaywm/wlroots/pull/1380 (since I suffered
from clipboard related issues nonetheless)]

Comment 50 Martin Stransky 2019-02-19 09:31:20 UTC
Let's open that for tracking purposes.

Comment 51 Ben Cotton 2019-02-19 17:12:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Comment 52 Ben Cotton 2020-11-03 14:56:42 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 31 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 53 Christian Stadelmann 2020-11-04 21:05:43 UTC
Since this is a tracker bug, I guess it should stay open.


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