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
Merge Window
into FlutterWindow
#45542
Conversation
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.
Making the assumption that other than signatures being merged, the implementation details haven't changed in the bulk of this code.
Just a few quick initial comments.
void HandleResize(UINT width, UINT height); | ||
|
||
// Retrieves a class instance pointer for |window| | ||
static FlutterWindow* GetThisFromHandle(HWND const window) noexcept; |
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.
style nit: We should consider gathering the static class methods together at the top of each public/protected/private section.
|
||
int current_dpi_ = 0; | ||
int current_width_ = 0; | ||
int current_height_ = 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.
We should order members in sections. I'll check the style guide but my recollection is: statics, regular methods, fields. Just make sure we keep fields ordered the same as constructor field initialisation to avoid undefined behaviour.
// input. | ||
// See | ||
// https://docs.microsoft.com/en-us/windows/win32/tablet/system-events-and-mouse-messages?redirectedfrom=MSDN#distinguishing-pen-input-from-mouse-and-touch. | ||
static FlutterPointerDeviceKind GetFlutterPointerDeviceKind() { |
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.
nit: For static functions (as opposed to class methods), for conistency, we should probably move these to the anonymous namespace instead of old-school static.
const static long kWmDpiChangedBeforeParent = 0x02E2; | ||
|
||
// Timer identifier for DirectManipulation gesture polling. | ||
const static int kDirectManipulationTimer = 1; |
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.
Here and above, while you're in here, let's also switch these to static const
for consistency with elsewhere.
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.
Looks great - thanks!
Haven't really compared the merged files line by line. Are there any lines worth checking? If not, it looks good to me. :) |
There's nothing that's really new code. Just existing code moved to new places and some type names updated to reflect that. |
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.
#include "gmock/gmock.h" | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
/// Mock for the |Window| base class. | ||
class MockWindow : public Window { | ||
class MockWindow : public FlutterWindow { |
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.
Consider renaming this type to MockFlutterWindow
and this file to mock_flutter_window
. I don't feel strongly about this though.
|
||
// Registers a window class with default style attributes, cursor and | ||
// icon. | ||
WNDCLASS RegisterWindowClass(std::wstring& title); |
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 do a pass on protected
members to check if they can be made private
instead? It looks like RegisterWindowClass
should be private, there may be more.
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.
LGTM, thanks for cleaning this up!
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
…134469) flutter/engine@06696e7...8389ad9 2023-09-11 109111084+yaakovschectman@users.noreply.github.com Merge `Window` into `FlutterWindow` (flutter/engine#45542) 2023-09-11 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from 7Zk_dvFh301kgQte4... to fSmVaZwp41ZGp5hKn... (flutter/engine#45665) Also rolling transitive DEPS: fuchsia/sdk/core/mac-amd64 from 7Zk_dvFh301k to fSmVaZwp41ZG If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Merge abstract base class
Window
into concrete derived classFlutterWindow
to simplify future development.flutter/flutter#132260
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.