18
18
#include " flutter/shell/platform/windows/keyboard_hook_handler.h"
19
19
#include " flutter/shell/platform/windows/public/flutter_windows.h"
20
20
#include " flutter/shell/platform/windows/text_input_plugin.h"
21
+ #include " flutter/shell/platform/windows/win32_platform_handler.h"
21
22
#include " flutter/shell/platform/windows/window_binding_handler.h"
22
23
#include " flutter/shell/platform/windows/window_state.h"
23
- #include " flutter/shell/platform/windows/win32_platform_handler.h"
24
24
25
25
namespace flutter {
26
26
27
27
// Struct holding the mouse state. The engine doesn't keep track of which mouse
28
28
// buttons have been pressed, so it's the embedding's responsibility.
29
29
struct MouseState {
30
- // True if the last event sent to Flutter had at least one mouse button
30
+ // True if the last event sent to Flutter had at least one mouse button.
31
31
// pressed.
32
32
bool flutter_state_is_down = false ;
33
33
@@ -40,15 +40,15 @@ struct MouseState {
40
40
uint64_t buttons = 0 ;
41
41
};
42
42
43
- // A windowing neutral flutter child video used as implementation for flutter
44
- // view that works with win32 hwnds and Windows::UI::Composition visuals
43
+ // An OS windowing neutral abstration for flutter
44
+ // view that works with win32 hwnds and Windows::UI::Composition visuals.
45
45
class FlutterWindowsView {
46
46
public:
47
- // Create flutter Window for use as child window
48
47
FlutterWindowsView ();
49
48
50
49
~FlutterWindowsView ();
51
50
51
+ // Factory for creating FlutterWindowsView requiring an implementator of FlutterWindowBindingHandler.
52
52
static FlutterDesktopViewControllerRef CreateFlutterWindowsView (
53
53
std::unique_ptr<FlutterWindowBindingHandler> windowbinding);
54
54
@@ -63,11 +63,13 @@ class FlutterWindowsView {
63
63
// messages.
64
64
void HandlePlatformMessage (const FlutterPlatformMessage*);
65
65
66
+ // Create rendering surface for Flutter engine to draw into.
66
67
void CreateRenderSurface ();
67
68
68
69
// Destroy current rendering surface if one has been allocated.
69
70
void DestroyRenderSurface ();
70
71
72
+ // Return the currently configured WindowsRenderTarget.
71
73
WindowsRenderTarget* GetRenderTarget ();
72
74
73
75
// Callbacks for clearing context, settings context and swapping buffers.
@@ -76,40 +78,47 @@ class FlutterWindowsView {
76
78
bool MakeResourceCurrent ();
77
79
bool SwapBuffers ();
78
80
79
- // TODO
81
+ // Notify view that backing window size has changed.
82
+ // Typically called by currently configured FlutterWindowBindingHandler
80
83
void OnWindowSizeChanged (size_t width, size_t height) const ;
81
84
82
- // TODO
85
+ // Notify view that backing window mouse has moved.
86
+ // Typically called by currently configured FlutterWindowBindingHandler
83
87
void OnPointerMove (double x, double y);
84
88
85
- // TODO
89
+ // Notify view that backing window mouse pointer button has been pressed.
90
+ // Typically called by currently configured FlutterWindowBindingHandler
86
91
void OnPointerDown (double x, double y, FlutterPointerMouseButtons button);
87
92
88
- // TODO
93
+ // Notify view that backing window mouse pointer button has been released.
94
+ // Typically called by currently configured FlutterWindowBindingHandler
89
95
void OnPointerUp (double x, double y, FlutterPointerMouseButtons button);
90
96
91
- // TODO
97
+ // Notify view that backing window mouse pointer has left the window.
98
+ // Typically called by currently configured FlutterWindowBindingHandler
92
99
void OnPointerLeave ();
93
100
94
- // TODO
101
+ // Notify view that backing window has received text.
102
+ // Typically called by currently configured FlutterWindowBindingHandler
95
103
void OnText (const std::u16string&);
96
104
97
- // TODO
105
+ // Notify view that backing window size has received key press.
106
+ // Typically called by currently configured FlutterWindowBindingHandler
98
107
void OnKey (int key, int scancode, int action, char32_t character);
99
108
100
- // TODO
109
+ // Notify view that backing window size has recevied scroll.
110
+ // Typically called by currently configured FlutterWindowBindingHandler
101
111
void OnScroll (double x,
102
112
double y,
103
113
double delta_x,
104
114
double delta_y,
105
115
int scroll_offset_multiplier);
106
116
107
- // TODO
117
+ // Notify view that backing window size has had system font change.
118
+ // Typically called by currently configured FlutterWindowBindingHandler
108
119
void OnFontChange ();
109
120
110
121
private:
111
- // TODO
112
- void CreateRenderSurfaceHWND ();
113
122
114
123
// Sends a window metrics update to the Flutter engine using current window
115
124
// dimensions in physical
@@ -179,7 +188,7 @@ class FlutterWindowsView {
179
188
std::unique_ptr<AngleSurfaceManager> surface_manager = nullptr ;
180
189
EGLSurface render_surface = EGL_NO_SURFACE;
181
190
182
- // state of the mouse button
191
+ // state of the mouse button.
183
192
bool pointer_is_down_ = false ;
184
193
185
194
// The handle to the Flutter engine instance.
@@ -220,18 +229,13 @@ class FlutterWindowsView {
220
229
// should we forword input messages or not
221
230
bool process_events_ = false ;
222
231
223
- // flag indicating if the message loop should be running
232
+ // flag indicating if the message loop should be running.
224
233
bool messageloop_running_ = false ;
225
234
226
- /* winrt::Windows::UI::Composition::Compositor compositor_ {nullptr};
227
-
228
- winrt::Windows::UI::Composition::SpriteVisual
229
- flutter_render_visual_{nullptr};*/
230
-
231
- // ::HWND window_rendertarget_;
232
-
235
+ // Currently configured WindowsRenderTarget for view.
233
236
std::unique_ptr<WindowsRenderTarget> render_target_;
234
237
238
+ // Currently configured FlutterWindowBindingHandler for view.
235
239
std::unique_ptr<flutter::FlutterWindowBindingHandler> binding_handler_{
236
240
nullptr };
237
241
};
0 commit comments