Closed Bug 1718507 Opened 3 years ago Closed 3 years ago

[Wayland/KDE] Popup menus are small

Categories

(Core :: Widget: Gtk, defect, P2)

defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox92 --- fixed

People

(Reporter: stransky, Assigned: stransky, NeedInfo)

References

(Blocks 2 open bugs)

Details

Attachments

(6 files, 9 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
743.24 KB, application/gzip
Details
38.29 KB, image/png
Details

On KDE/Wayland the monitor sizes are reported wrongly (I think) so Firefox scales the popup menus.

KDE output:

[2222464.360] wl_output@15.geometry(0, 0, 3840, 2048, 0, "manufacturer_TODO", "model_TODO", 0)
[2222464.376] wl_output@15.scale(2)
[2222464.380] wl_output@15.mode(1, 3840, 2048, 60000)

[2222464.444] zxdg_output_v1@16.logical_position(0, 0)
[2222464.450] zxdg_output_v1@16.logical_size(1920, 1024)
[2222464.456] zxdg_output_v1@16.name("WL-0")
[2222464.459] zxdg_output_v1@16.description("manufacturer_TODO model_TODO")

Mutter output:

[2239945.116] wl_output@18.geometry(0, 0, 610, 350, 0, "SAM", "U28H75x", 0)
[2239945.134] wl_output@18.mode(3, 3840, 2160, 59996)
[2239945.143] wl_output@18.scale(2)

[2239945.154] zxdg_output_v1@19.logical_position(0, 0)
[2239945.159] zxdg_output_v1@19.logical_size(3840, 2160)
[2239945.163] zxdg_output_v1@19.name("DP-1")
[2239945.166] zxdg_output_v1@19.description("Samsung Electric Company 28"")

Note that KDE reports zxdg_output_v1@16.logical_size(1920, 1024) without scale included which confuses Gtk and reports screen sizes as 1920/2 and 1024/2.

Vlad, I'm not sure if that's a bug in Kwin or Gtk side. I'll try to update Firefox to ignore screen sizes for popups (to use xdg_positioner when possible) but this still may affect other browser parts.

If that's a Gtk bug I can use wl_output directly to workaround it.

Thanks.

Flags: needinfo?(vlad.zahorodnii)

I use kwin-5.21.5-3.fc34.x86_64 for testing.

Martin: Mutter will likely report the same if you enable scale-monitor-framebuffer / fractional scaling. AFAIK Mutter is the outlier here, as by default it reports numbers that make it compatible with Xwayland scaling, while all other compositors don't. So IIUC this is just another dup of all the other "menus are small with scaling" bugs.

Further more, both interpretations are not wrong. They just don't work for positioning - and indeed we should go xdg_positioner all the way here.

(In reply to Robert Mader [:rmader] from comment #3)

Martin: Mutter will likely report the same if you enable scale-monitor-framebuffer / fractional scaling. AFAIK Mutter is the outlier here, as by default it reports numbers that make it compatible with Xwayland scaling, while all other compositors don't. So IIUC this is just another dup of all the other "menus are small with scaling" bugs.

Okay, Thanks.

Further more, both interpretations are not wrong. They just don't work for positioning - and indeed we should go xdg_positioner all the way here.

Yes, I know that. Unfortunately it's not possible to remove the screen size from popup size computation (at least not without radical layout changes) as Firefox uses shared layout code to compute widget sizes. So we need to get some sane values here.

Flags: needinfo?(vlad.zahorodnii)

(In reply to Martin Stránský [:stransky] (ni? me) from comment #4)

Yes, I know that. Unfortunately it's not possible to remove the screen size from popup size computation (at least not without radical layout changes) as Firefox uses shared layout code to compute widget sizes. So we need to get some sane values here.

Unfortunately I'm not aware of a way to differentiate between the two cases. However, do the numbers need to be sane or just not too small? We still use xdg-positioner at the end to shrink the popup, don't we?

Okay, looks like we need to use wl_output directly as Gtk does not seem to provide the values without zxdg_output for us.

(In reply to Robert Mader [:rmader] from comment #5)

Unfortunately I'm not aware of a way to differentiate between the two cases. However, do the numbers need to be sane or just not too small? We still use xdg-positioner at the end to shrink the popup, don't we?

Popups are sized along screen size and then it's used xdg-positioner to update popup size according to recent position. But the first phase can't be easily skipped.

Attachment #9229258 - Attachment is obsolete: true
Attachment #9229259 - Attachment is obsolete: true
Attachment #9229257 - Attachment is obsolete: true
Attachment #9229260 - Attachment is obsolete: true
Attachment #9229261 - Attachment is obsolete: true
  • Move screen getter initialization to ScreenGetterGtk::Init() to initialize it after a global object is created.
  • Store screen list internally at ScreenGetterWayland to allow searching in it.
  • Implement ScreenGetterWayland::GetMonitorForWindow() to get monitor/wl_output for nsWindow.
  • Implement ScreenGetterWayland::GetScreenForWindow() to get screen where the window is placed.
  • Implement ScreenGetterWayland::GetScreenRectForWindow() to get window screen rect.
  • Do some more logging on ScreenHelperGTK.cpp
Attachment #9229379 - Attachment is obsolete: true
Attachment #9229378 - Attachment is obsolete: true
  • Move screen getter initialization to ScreenGetterGtk::Init() to initialize it after a global object is created.
  • Store screen list internally at ScreenGetterWayland to allow searching in it.
  • Implement ScreenGetterWayland::GetMonitorForWindow() to get monitor/wl_output for nsWindow.
  • Implement ScreenGetterWayland::GetScreenForWindow() to get screen where the window is placed.
  • Implement ScreenGetterWayland::GetScreenRectForWindow() to get window screen rect.
  • Do some more logging on ScreenHelperGTK.cpp

Depends on D118965

(In reply to Martin Stránský [:stransky] (ni? me) from comment #4)

(In reply to Robert Mader [:rmader] from comment #3)

Martin: Mutter will likely report the same if you enable scale-monitor-framebuffer / fractional scaling. AFAIK Mutter is the outlier here, as by default it reports numbers that make it compatible with Xwayland scaling, while all other compositors don't. So IIUC this is just another dup of all the other "menus are small with scaling" bugs.

Okay, Thanks.

Further more, both interpretations are not wrong. They just don't work for positioning - and indeed we should go xdg_positioner all the way here.

Yes, I know that. Unfortunately it's not possible to remove the screen size from popup size computation (at least not without radical layout changes) as Firefox uses shared layout code to compute widget sizes. So we need to get some sane values here.

This is not completely true. We don't use the screen height to limit the height of the popup under wayland. The screen limit is used in the nsMenuPopupFrame::FlipOrResize or nsMenuPopupFrame::SlideOrResize which are not called in wayland. We use move_to_rect callback to get the limit of the popup size.

(In reply to Jan Horak [:jhorak] from comment #20)

This is not completely true. We don't use the screen height to limit the height of the popup under wayland. The screen limit is used in the nsMenuPopupFrame::FlipOrResize or nsMenuPopupFrame::SlideOrResize which are not called in wayland. We use move_to_rect callback to get the limit of the popup size.

IMHO this is done when any widget is placed on screen, PresShell gets screen size and does initial reflow for widgets. In the first phase nsMenuPopupFrame is not even involved. The initial reflow sets maximal widget size (based on screen size) which can't be extended by subsequent updates by nsMenuPopupFrame. (correct me if I'm wrong as I'm not a layout expert).

Anyway, the layout changes were moved to Bug 1718727.

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/08c5ae14f66f
[Wayland] Don't scale screen sizes at nsWindow::GetScreenRect(), r=jhorak
https://hg.mozilla.org/integration/autoland/rev/65969052f051
[Wayland] Get screen configuration by separate class ScreenGetterGtk r=jhorak
Attachment #9229382 - Attachment is obsolete: true
Attachment #9229383 - Attachment is obsolete: true
  • Move screen getter initialization to ScreenGetterGtk::Init() to initialize it after a global object is created.
  • Store screen list internally at ScreenGetterWayland to allow searching in it.
  • Implement ScreenGetterWayland::GetMonitorForWindow() to get monitor/wl_output for nsWindow.
  • Implement ScreenGetterWayland::GetScreenForWindow() to get screen where the window is placed.
  • Implement ScreenGetterWayland::GetScreenRectForWindow() to get window screen rect.
  • Do some more logging on ScreenHelperGTK.cpp

Depends on D118959

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/1f067788f2a3
[Wayland] Implement ScreenGetterWayland to get screen config on Wayland, r=jhorak
https://hg.mozilla.org/integration/autoland/rev/02514549f3a7
[Wayland] Implement nsWindow::GetWidgetScreen() by ScreenGetter on Wayland, r=jhorak

hey there, I think there is a problem with the two commits. It has seemingly introduced a series of compile failures within widget/gtk/ScreenHelperGTK.cpp , please have a look at the attached compressed build.log for more details. Interesting section starts at around 27:47.80, or grep for error: to find them all.

I've also run into a problem with those two commits.

Running sway with any scaling (tested 2, 1.5 and 1.6) causes popups (menu, addons, right-click, drop downs) to not be visible.

This is seen in "first release with" (20210720215601), and not seen in "first release without" (20210720094604).

Regressions: 1721707

Can confirm the issue on sway
18:56.33 INFO: Last good revision: 0c51eaf636b089097500fc721b31d99dcd92b0a3
18:56.33 INFO: First bad revision: 02514549f3a78a80b922dc2224d039c6db2a10d8
18:56.33 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=0c51eaf636b089097500fc721b31d99dcd92b0a3&tochange=02514549f3a78a80b922dc2224d039c6db2a10d8

Please file a new bug for it and attach a log - run Firefox with MOZ_LOG="WidgetScreen:5" env variable.
Thanks.

Regressions: 1722388
Regressions: 1722767

Let's close this one as remaining issued should be fixed by Bug 1718727. If you see more issued on KDE/Plasma please file a new bug for it.
Thanks.

Status: NEW → RESOLVED
Closed: 3 years ago
Keywords: leave-open
Resolution: --- → FIXED
Attached image Firefox cropped menu

Hmm, in build 20210813092746 this doesn't seem to be fixed?

Flags: needinfo?(stransky)

FWIW, popups are not cropped with the same build (20210813092746) of firefox on my computer.

(In reply to Lyubomir from comment #33)

Created attachment 9236209 [details]
Firefox cropped menu

Hmm, in build 20210813092746 this doesn't seem to be fixed?

It must be something else - please file a new bug for it, attach your about:support there.
Thanks.

Flags: needinfo?(stransky)

I also found that this is fixed in firefox 92 and firefox 93. But in the latest nightly version (20210916214506), this issue comes back.

(In reply to Chang Liu from comment #38)

I also found that this is fixed in firefox 92 and firefox 93. But in the latest nightly version (20210916214506), this issue comes back.

Hm, can it be a regression from Bug 1730476?
Can you run Firefox on terminal with MOZ_LOG="WidgetScreen:5" env variable and attach the log here?
Thanks.

Flags: needinfo?(goduck777)

Here is the result from mozregression.

5:44.33 INFO: Narrowed integration regression window from [cd6051c0, 3b856ecc] (3 builds) to [0850c74d, 3b856ecc] (2 builds) (~1 steps left)
5:44.33 INFO: No more integration revisions, bisection finished.
5:44.33 INFO: Last good revision: 0850c74da42fb3c1568b5d4fb49c2b1d2786eedb
5:44.33 INFO: First bad revision: 3b856ecc00e4b07744f6c68c7ba851ca05944025
5:44.33 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=0850c74da42fb3c1568b5d4fb49c2b1d2786eedb&tochange=3b856ecc00e4b07744f6c68c7ba851ca05944025

Flags: needinfo?(goduck777)

Here is the log with MOZ_LOG="WidgetScreen:5"

[Parent 742476: Main Thread]: D/WidgetScreen ScreenGetterGtk created
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing screens
[Parent 742476: Main Thread]: D/WidgetScreen GDK reports 1 screens
[Parent 742476: Main Thread]: D/WidgetScreen New screen [0 0 1920 1080 (0 0 1920 1080) 32 2.000000 2.000000 80.682350]
[Parent 742476: Main Thread]: D/WidgetScreen Refresh screens
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing all ContentParents
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742634]
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: D/WidgetScreen Received monitors-changed event
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing screens
[Parent 742476: Main Thread]: D/WidgetScreen GDK reports 1 screens
[Parent 742476: Main Thread]: D/WidgetScreen New screen [0 0 1920 1080 (0 0 1920 1080) 32 2.000000 2.000000 80.682350]
[Parent 742476: Main Thread]: D/WidgetScreen Refresh screens
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing all ContentParents
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742634]
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742690]
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: D/WidgetScreen Received monitors-changed event
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing screens
[Parent 742476: Main Thread]: D/WidgetScreen GDK reports 1 screens
[Parent 742476: Main Thread]: D/WidgetScreen New screen [0 0 1920 1080 (0 0 1920 1080) 32 2.000000 2.000000 80.682350]
[Parent 742476: Main Thread]: D/WidgetScreen Refresh screens
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing all ContentParents
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742634]
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742690]
[Child 742634: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742634: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Child 742690: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742828]
[Parent 742476: Main Thread]: D/WidgetScreen Received monitors-changed event
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing screens
[Parent 742476: Main Thread]: D/WidgetScreen GDK reports 1 screens
[Parent 742476: Main Thread]: D/WidgetScreen New screen [0 0 1920 1080 (0 0 1920 1080) 32 2.000000 2.000000 80.682350]
[Parent 742476: Main Thread]: D/WidgetScreen Refresh screens
[Parent 742476: Main Thread]: D/WidgetScreen Refreshing all ContentParents
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742634]
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742690]
[Parent 742476: Main Thread]: D/WidgetScreen Send screens to [Pid 742828]
[Child 742634: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Child 742690: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Child 742828: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Child 742828: Main Thread]: D/WidgetScreen Refresh screens from IPC
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[Parent 742476: Main Thread]: W/WidgetScreen Getting screen in wayland, primary display will be returned.
[2021-09-19T00:41:32Z ERROR xulstore::persist] removeDocument error: unavailable

###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

Thanks.
Please file a new bug for it and cc me there.

Flags: needinfo?(goduck777)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: