Skip to content

Add Linux implementation of popup windows - #185866

Merged
mattkae merged 1 commit into
flutter:masterfrom
robert-ancell:linux-popup
May 5, 2026
Merged

Add Linux implementation of popup windows#185866
mattkae merged 1 commit into
flutter:masterfrom
robert-ancell:linux-popup

Conversation

@robert-ancell

Copy link
Copy Markdown
Contributor

No description provided.

@robert-ancell
robert-ancell requested a review from a team as a code owner May 1, 2026 00:51
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 1, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically a: desktop Running on desktop team-linux Owned by the Linux platform team labels May 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements popup window support for the Linux platform by introducing the PopupWindowControllerLinux class and extending FlWindowMonitor with an on_moved_to_rect callback to track window positioning. Feedback identifies a potential race condition in the PopupWindowControllerLinux constructor where the rootView lookup may fail because the view registration in the PlatformDispatcher is asynchronous. Additionally, the native signal connection for moved-to-rect is noted as fragile, with recommendations to handle widget realization and GDK version compatibility more robustly to avoid runtime warnings or crashes.

Comment thread packages/flutter/lib/src/widgets/_window_linux.dart
Comment thread engine/src/flutter/shell/platform/linux/fl_window_monitor.cc
@github-actions github-actions Bot removed the CICD Run CI/CD label May 1, 2026
@robert-ancell robert-ancell added the CICD Run CI/CD label May 1, 2026

@mattkae mattkae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very straightforward!

Is this working correctly with focusing the textbox and dismissing it when another window that is not the parent is focused?

final _GtkWindow? parentWindow = _owner._windows[_parent.rootView.viewId];
final _FlView? view = _owner._views[_parent.rootView.viewId];
var offset = (0, 0);
if (parentWindow != null && view != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentWindow being null is a logic error, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either a logic error or some external thing caused the parent window to be destroyed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we at least log so that we know about it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can save this for later though, not blocking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD engine flutter/engine related. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants