@@ -41,11 +41,10 @@ class WindowManagerPlugin : public flutter::Plugin {
4141
4242 private:
4343 std::unique_ptr<
44- flutter::MethodChannel<flutter::EncodableValue>,
45- std::default_delete<flutter::MethodChannel<flutter::EncodableValue>>>
44+ flutter::MethodChannel<flutter::EncodableValue>,
45+ std::default_delete<flutter::MethodChannel<flutter::EncodableValue>>>
4646 channel = nullptr ;
4747
48-
4948 WindowManager* window_manager;
5049 flutter::PluginRegistrarWindows* registrar;
5150
@@ -69,8 +68,8 @@ class WindowManagerPlugin : public flutter::Plugin {
6968
7069 // HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
7170 // Don't use `MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST)` above.
72- // Because if the window is restored from minimized state, the window is not in the correct monitor.
73- // The monitor is always the left-most monitor.
71+ // Because if the window is restored from minimized state, the window is not
72+ // in the correct monitor. The monitor is always the left-most monitor.
7473 // https://github.com/leanflutter/window_manager/issues/489
7574 HMONITOR monitor = MonitorFromRect (&sz->rgrc [0 ], MONITOR_DEFAULTTONEAREST );
7675 if (monitor != NULL ) {
@@ -113,10 +112,9 @@ WindowManagerPlugin::WindowManagerPlugin(
113112 registrar->messenger (), " window_manager" ,
114113 &flutter::StandardMethodCodec::GetInstance ());
115114
116- channel->SetMethodCallHandler (
117- [this ](const auto & call, auto result) {
118- HandleMethodCall (call, std::move (result));
119- });
115+ channel->SetMethodCallHandler ([this ](const auto & call, auto result) {
116+ HandleMethodCall (call, std::move (result));
117+ });
120118}
121119
122120WindowManagerPlugin::~WindowManagerPlugin () {
@@ -350,13 +348,12 @@ void WindowManagerPlugin::HandleMethodCall(
350348 window_manager->native_window =
351349 ::GetAncestor (registrar->GetView ()->GetNativeWindow(), GA_ROOT);
352350 result->Success (flutter::EncodableValue(true ));
353- }
354- else if (method_name.compare(" getWindowHandle" ) == 0) {
355- result->Success (flutter::EncodableValue (reinterpret_cast <__int64>(window_manager->GetMainWindow ())));
356- }
357- else if (method_name.compare (" waitUntilReadyToShow" ) == 0 ) {
351+ } else if (method_name.compare(" waitUntilReadyToShow" ) == 0) {
358352 window_manager->WaitUntilReadyToShow ();
359353 result->Success (flutter::EncodableValue (true ));
354+ } else if (method_name.compare (" getId" ) == 0 ) {
355+ result->Success (flutter::EncodableValue (
356+ reinterpret_cast <__int64>(window_manager->GetMainWindow ())));
360357 } else if (method_name.compare (" setAsFrameless" ) == 0 ) {
361358 window_manager->SetAsFrameless ();
362359 result->Success (flutter::EncodableValue (true ));
0 commit comments