[wayland] [sway?] Incorrect screen.width read by javascript
Categories
(Core :: Widget: Gtk, defect)
Tracking
()
People
(Reporter: lukas.bernhard, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
26.79 KB,
text/plain
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0
Steps to reproduce:
The screen size (width, height) as accessible from javascript via window.screen
reports incorrect values in Firefox Nightly 90.0a1 20210427095509.
My laptop has a 4k screen but scaled by factor 2; MOZ_ENABLE_WAYLAND is set to 1.
This might be a regression from Bug 1661540
Actual results:
about:support shows a screen size of 1920x1080
With MOZ_LOG= enabled, the following messages are printed during startup:
[Parent 101733: Main Thread]: D/WidgetScreen ScreenHelperGTK created [Parent 101733: Main Thread]: D/WidgetScreen Refreshing screens [Parent 101733: Main Thread]: D/WidgetScreen GDK reports 1 screens [Parent 101733: Main Thread]: D/WidgetScreen New screen [0 0 1920 1080 (0 0 1920 1080) 32 2.000000 2.000000 144.378937]
However, https://crisal.io/tmp/screen.html reports screen sizes as following:
innerWidth: 1920 innerHeight: 974 outerWidth: 1920 outerHeight: 1059 screen.width: 960 screen.height: 540
Expected results:
I suppose screen.width/height should be 1920 and 1080, respectively
Reporter | ||
Comment 1•4 years ago
|
||
Comments can't be edited, can they? The logging value was MOZ_LOG=WidgetScreen:5
and the log messages lost their formating.
Comment 2•4 years ago
|
||
Which compositor are you using? I get the expected result here, and I also have a 4k screen with 2x resolution. Can you attach the contents of about:support
?
Reporter | ||
Comment 3•4 years ago
|
||
about:support copied to clipboard; printer removed
Reporter | ||
Comment 4•4 years ago
|
||
The compositor is sway.
Comment 5•4 years ago
|
||
Ah, that might be the key difference...
Updated•4 years ago
|
Comment 6•4 years ago
|
||
I don't think it's a regression - it's likely related to wrongly calculated menu sizes etc. The issue is that scaling on Wayland can be implemented in two ways:
- backward compatible with Xwayland HiDPI / integer only. This is what Gnome still does by default because of all the apps out there without native Wayland support (chromium/electron...)
- fractional scaling. This is what all other compositors do (and Gnome has it as optional feature).
There initially wasn't a clearly defined way to report the right values (wl_output
), so at some point a new protocol for that was added (xdg_output
). It's likely that we get that wrong somewhere - it's on my list :) (mostly because of the menu issue...)
Updated•4 years ago
|
Can confirm this. I am using Firefox 127 with KDE Plasma 6.0.5, on a 1920x1080 screen set to 125% scaling in KDE System Settings -> Display.
When I launch Firefox on Wayland, I get window.screen.width == 960
. If I unset WAYLAND_DISPLAY
and start with Xwayland instead, window.screen.width
evaluates to 1536 = 1920/1.25 correctly.
BTW, Chromium with and w/o --ozone-platform=wayland
consistently report window.screen.width
as 1536
.
Description
•