Repository navigation
Commit f6061d0
Improve initial size and placement logic for popups and tooltips on Linux (#189994)
## Why?
The initial sizing of popup and tooltip windows on Linux was broken such
that windows that calculated their initial size too slowly would have
their content overflowing off the edge of the screen. Because they never
reposition themselves, this content would be lost forever.
This PR fixes that initial sizing such that we wait for the convergence
of initial sizes between the embedder and the framework before showing
the popup/tooltip.
## What's new?
- Add a new `on_size_changed` callback to the `FlViewMonitor` that
notifies us when the view's size changes
- Tooltips and popups on Linux are now _only_ shown when the first frame
has arrived **AND** the size of the view in the Linux embedder agrees
with the size of the content in the framework
- This essentially spins until they converge to the same size, with a
timeout of 250ms.
- Made it so that X11 windows can be repositoned whereas Wayland windows
cannot
This fix consistently manages to place my windows correctly, which is
very awesome.
## How it works
<img width="4688" height="3840"
alt="mermaid-diagram-2026-07-24T19-27-31"
src="https://github.com/user-attachments/assets/5a5e4c2c-1f63-49f2-acc7-061d50d2e6ef"
/>
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Robert Ancell <[email protected]>1 parent 45b3e37 commit f6061d0
3 files changed
Lines changed: 242 additions & 27 deletions
File tree
- engine/src/flutter/shell/platform/linux
- packages/flutter/lib/src/widgets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
| |||
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | | - | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
| 67 | + | |
| 68 | + | |
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
0 commit comments