@@ -31,11 +31,6 @@ bool IsWindows11OrGreater() {
31
31
return dwBuild < 22000 ;
32
32
}
33
33
34
- std::unique_ptr<
35
- flutter::MethodChannel<flutter::EncodableValue>,
36
- std::default_delete<flutter::MethodChannel<flutter::EncodableValue>>>
37
- channel = nullptr ;
38
-
39
34
class WindowManagerPlugin : public flutter ::Plugin {
40
35
public:
41
36
static void RegisterWithRegistrar (flutter::PluginRegistrarWindows* registrar);
@@ -45,6 +40,12 @@ class WindowManagerPlugin : public flutter::Plugin {
45
40
virtual ~WindowManagerPlugin ();
46
41
47
42
private:
43
+ std::unique_ptr<
44
+ flutter::MethodChannel<flutter::EncodableValue>,
45
+ std::default_delete<flutter::MethodChannel<flutter::EncodableValue>>>
46
+ channel = nullptr ;
47
+
48
+
48
49
WindowManager* window_manager;
49
50
flutter::PluginRegistrarWindows* registrar;
50
51
@@ -95,17 +96,8 @@ class WindowManagerPlugin : public flutter::Plugin {
95
96
// static
96
97
void WindowManagerPlugin::RegisterWithRegistrar (
97
98
flutter::PluginRegistrarWindows* registrar) {
98
- channel = std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
99
- registrar->messenger (), " window_manager" ,
100
- &flutter::StandardMethodCodec::GetInstance ());
101
-
102
99
auto plugin = std::make_unique<WindowManagerPlugin>(registrar);
103
100
104
- channel->SetMethodCallHandler (
105
- [plugin_pointer = plugin.get ()](const auto & call, auto result) {
106
- plugin_pointer->HandleMethodCall (call, std::move (result));
107
- });
108
-
109
101
registrar->AddPlugin (std::move (plugin));
110
102
}
111
103
@@ -117,6 +109,14 @@ WindowManagerPlugin::WindowManagerPlugin(
117
109
[this ](HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
118
110
return HandleWindowProc (hWnd, message, wParam, lParam);
119
111
});
112
+ channel = std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
113
+ registrar->messenger (), " window_manager" ,
114
+ &flutter::StandardMethodCodec::GetInstance ());
115
+
116
+ channel->SetMethodCallHandler (
117
+ [this ](const auto & call, auto result) {
118
+ HandleMethodCall (call, std::move (result));
119
+ });
120
120
}
121
121
122
122
WindowManagerPlugin::~WindowManagerPlugin () {
0 commit comments