-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Provide monitor list, display size, refresh rate, and more for Windows #164460
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
base: master
Are you sure you want to change the base?
Conversation
b9dd753
to
71f9c40
Compare
71f9c40
to
6d71dc3
Compare
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
engine/src/flutter/shell/platform/windows/flutter_windows_display_monitor.cc
Outdated
Show resolved
Hide resolved
engine/src/flutter/shell/platform/windows/flutter_windows_display_monitor.cc
Show resolved
Hide resolved
engine/src/flutter/shell/platform/windows/flutter_windows_display_monitor_unittests.cc
Outdated
Show resolved
Hide resolved
|
||
// Notifies the engine about a display update. | ||
void UpdateDisplay(const FlutterEngineDisplay* displays, | ||
size_t displays_length); |
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.
Ideally FlutterWindowsEngine
should be a high-level C++ API. Could we make this accept a vector and have the implementation convert the vector into a pointer + size?
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.
Agreed !
engine/src/flutter/shell/platform/windows/flutter_windows_display_monitor.cc
Show resolved
Hide resolved
@9AZX Apologies for the long response time. This is looking great! I left some minor nitpicks. Feel free to tag me when this is ready for another review. |
} | ||
} | ||
|
||
if (!displays.empty()) { |
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.
Could you explain why you skip UpdateDisplay
if there are no displays?
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.
FYI, you have a test failure: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8718619884078032065/+/u/test:_Host_Tests_for_host_debug_test/stdout
Note: Google Test filter = FlutterWindowsEngineTest.RunDoesExpectedInitialization
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from FlutterWindowsEngineTest
[ RUN ] FlutterWindowsEngineTest.RunDoesExpectedInitialization
../../../flutter/shell/platform/windows/flutter_windows_engine_unittests.cc(165): error: Value of: notify_display_update_called
Actual: false
Expected: true
The test verifies that update display is called at startup:
flutter/engine/src/flutter/shell/platform/windows/flutter_windows_engine_unittests.cc
Lines 142 to 163 in 2ca6284
// And it should send display info. | |
bool notify_display_update_called = false; | |
modifier.SetFrameInterval(16600000); // 60 fps. | |
modifier.embedder_api().NotifyDisplayUpdate = MOCK_ENGINE_PROC( | |
NotifyDisplayUpdate, | |
([¬ify_display_update_called, engine_instance = engine.get()]( | |
FLUTTER_API_SYMBOL(FlutterEngine) raw_engine, | |
const FlutterEngineDisplaysUpdateType update_type, | |
const FlutterEngineDisplay* embedder_displays, | |
size_t display_count) { | |
EXPECT_EQ(update_type, kFlutterEngineDisplaysUpdateTypeStartup); | |
EXPECT_EQ(display_count, 1); | |
FlutterEngineDisplay display = embedder_displays[0]; | |
EXPECT_EQ(display.display_id, 0); | |
EXPECT_EQ(display.single_display, true); | |
EXPECT_EQ(std::floor(display.refresh_rate), 60.0); | |
notify_display_update_called = true; | |
return kSuccess; | |
})); |
You will likely need to pass in a windows proc table that provides a display.
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 initially thought skipping UpdateDisplay
when there’s no display would prevent propagating invalid or incomplete info to the engine. I checked the macOS and Linux implementation and indeed it does not skip, so this can be removed :)
5269092
to
086194e
Compare
086194e
to
2ec4e8f
Compare
FYI you have the some test failures: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8716084517876313281/+/u/test:_test:_Host_Tests_for_host_debug_unopt/stdout
FYI, you can run these tests locally on your machine by running |
This PR enhances the Windows implementation by adding support for retrieving display properties, available displays, refresh rate, dpi, size, and more.
Fixes: #160660, #125939
Pre-launch Checklist
///
).