Commit 43f0900
committed
fix: fullscreen surface oversized when --force-scale-factor is set (#329)
When --fullscreen and --force-scale-factor=N are combined, the Wayland
surface was created at native_width*N x native_height*N instead of the
native display resolution. For example, a 800x480 display with
--force-scale-factor=1.3 produced a 1040x624 surface, causing UI to
render partially off-screen.
Root cause: wl_output_listener.mode stored the native display pixels
directly in view_properties_.width/height for the fullscreen case, but
the rest of the codebase treats view_properties_ as logical DIP. The
subsequent multiplication by current_scale_ in CreateRenderSurface then
over-scaled the surface dimensions.
force_scale_factor is intended to adjust the Flutter engine's device
pixel ratio (DPR) so that UI elements appear larger, not to increase
the surface buffer beyond the display's native resolution. The fix:
1. wl_output_listener.mode: when force_scale_factor is set, store the
display dimensions as logical DIP (width / current_scale_), consistent
with the xdg_toplevel_listener.configure callback which already does
this division correctly.
2. CreateRenderSurface: when force_scale_factor is set, use
display_max_width_/height_ directly for the surface dimensions to
avoid floating-point rounding when current_scale_ is non-integer.
The non-force_scale_factor path (auto-detected HiDPI from wl_output.scale)
is unchanged.
Fixes #3291 parent 1653fa6 commit 43f0900
1 file changed
Lines changed: 25 additions & 4 deletions
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
685 | | - | |
686 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
687 | 699 | | |
688 | 700 | | |
689 | 701 | | |
| |||
1382 | 1394 | | |
1383 | 1395 | | |
1384 | 1396 | | |
1385 | | - | |
1386 | | - | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
1387 | 1408 | | |
1388 | 1409 | | |
1389 | 1410 | | |
| |||
0 commit comments