Bug 1054334 - [GTK3] Firefox wayland support
[GTK3] Firefox wayland support
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: firefox (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Martin Stransky
Fedora Extras Quality Assurance
https://github.com/stransky/gecko-dev
: Reopened
Depends On: 1458034 1460973 1467792 1470031 1476662 1476715 1484651 1244683 1260769 1260773 1264355 1349014 1349016 1350058 1350059 1350060 1350062 1350077 1457201 1462725 1463181 1464017 1464497 1464916 1465331 1466377 1466800 1467104 1470600 1495147
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-16 11:18 EST by Alexander Larsson
Modified: 2017-09-25 05:59 EDT (History)
18 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1244683 1260769 1260773 (view as bug list)
Environment:
Last Closed: 2016-07-19 06:53:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
Mozilla Foundation 635134 None None None Never

  None (edit)
Description Alexander Larsson 2014-01-16 11:18:36 EST
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 11:30:01 EST
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 16:06:52 EST
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 09:10:37 EST
Upstream bug - https://bugzilla.mozilla.org/show_bug.cgi?id=635134
Comment 4 Martin Stransky 2015-02-06 07:59:25 EST
Created attachment 988853 [details]
patch

I have this one so far. Should work but it does not :(
Comment 5 Martin Stransky 2015-02-06 08:05:24 EST
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 11:58:16 EST
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 09:54:50 EDT
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 16:24:06 EDT
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 16:27:55 EDT
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 09:38:04 EDT
Looks like there's a problem with some signals connected to the window.
Comment 11 Martin Stransky 2015-08-27 08:15:44 EDT
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 10:41:59 EDT
(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 03:01:10 EDT
(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 03:03:57 EDT
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 03:27:07 EDT
(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 04:39:09 EDT
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 04:44:20 EDT
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 05:25:31 EDT
Okay, I'll provide a copr repo for that.
Comment 19 Martin Stransky 2015-08-31 06:36:38 EDT
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 12:42:58 EDT
Git repo with latest fixes is available at https://github.com/stransky/gecko-dev
Comment 22 Fedora End Of Life 2016-07-19 06:53:30 EDT
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 01:05:37 EDT
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-30 22:46 EDT
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 05:45:27 EDT
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 06:02:17 EDT
(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 06:21:22 EDT
(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 06:01 EDT
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-13 23:21 EDT
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 05:41:38 EDT
(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.

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