-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix warnings on startup about display monitor #162653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warnings on startup about display monitor #162653
Conversation
Create the display monitor at initialization, not engine start. Handle case where the window is not visible and the monitor can't be determined. Don't leak the monitor when the engine is disposed.
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). 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. 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. |
mattkae
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question, but I won't block on it if it is apparent otherwise!
| gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(self))); | ||
| GdkMonitor* monitor = gdk_display_get_monitor_at_window( | ||
| gtk_widget_get_display(GTK_WIDGET(self)), window); | ||
| FlutterEngineDisplayId display_id = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is zero a valid display_id if the window is nullptr? Should we leave a comment describing why that should be treated as valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't 100% sure, but it seems to work fine. A second event is generated with the correct display ID soon after. I'll add a note as this is something we might want to revisit later and not generate an event at this point.
Create the display monitor at initialization, not engine start.
Handle case where the window is not visible and the monitor can't be determined.
Don't leak the monitor when the engine is disposed.