Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 912c006

Browse files
committed
Add comments
1 parent 60a46c9 commit 912c006

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

shell/platform/windows/flutter_windows_view.h

+29-25
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
#include "flutter/shell/platform/windows/keyboard_hook_handler.h"
1919
#include "flutter/shell/platform/windows/public/flutter_windows.h"
2020
#include "flutter/shell/platform/windows/text_input_plugin.h"
21+
#include "flutter/shell/platform/windows/win32_platform_handler.h"
2122
#include "flutter/shell/platform/windows/window_binding_handler.h"
2223
#include "flutter/shell/platform/windows/window_state.h"
23-
#include "flutter/shell/platform/windows/win32_platform_handler.h"
2424

2525
namespace flutter {
2626

2727
// Struct holding the mouse state. The engine doesn't keep track of which mouse
2828
// buttons have been pressed, so it's the embedding's responsibility.
2929
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.
3131
// pressed.
3232
bool flutter_state_is_down = false;
3333

@@ -40,15 +40,15 @@ struct MouseState {
4040
uint64_t buttons = 0;
4141
};
4242

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.
4545
class FlutterWindowsView {
4646
public:
47-
// Create flutter Window for use as child window
4847
FlutterWindowsView();
4948

5049
~FlutterWindowsView();
5150

51+
// Factory for creating FlutterWindowsView requiring an implementator of FlutterWindowBindingHandler.
5252
static FlutterDesktopViewControllerRef CreateFlutterWindowsView(
5353
std::unique_ptr<FlutterWindowBindingHandler> windowbinding);
5454

@@ -63,11 +63,13 @@ class FlutterWindowsView {
6363
// messages.
6464
void HandlePlatformMessage(const FlutterPlatformMessage*);
6565

66+
// Create rendering surface for Flutter engine to draw into.
6667
void CreateRenderSurface();
6768

6869
// Destroy current rendering surface if one has been allocated.
6970
void DestroyRenderSurface();
7071

72+
// Return the currently configured WindowsRenderTarget.
7173
WindowsRenderTarget* GetRenderTarget();
7274

7375
// Callbacks for clearing context, settings context and swapping buffers.
@@ -76,40 +78,47 @@ class FlutterWindowsView {
7678
bool MakeResourceCurrent();
7779
bool SwapBuffers();
7880

79-
// TODO
81+
// Notify view that backing window size has changed.
82+
// Typically called by currently configured FlutterWindowBindingHandler
8083
void OnWindowSizeChanged(size_t width, size_t height) const;
8184

82-
// TODO
85+
// Notify view that backing window mouse has moved.
86+
// Typically called by currently configured FlutterWindowBindingHandler
8387
void OnPointerMove(double x, double y);
8488

85-
// TODO
89+
// Notify view that backing window mouse pointer button has been pressed.
90+
// Typically called by currently configured FlutterWindowBindingHandler
8691
void OnPointerDown(double x, double y, FlutterPointerMouseButtons button);
8792

88-
// TODO
93+
// Notify view that backing window mouse pointer button has been released.
94+
// Typically called by currently configured FlutterWindowBindingHandler
8995
void OnPointerUp(double x, double y, FlutterPointerMouseButtons button);
9096

91-
// TODO
97+
// Notify view that backing window mouse pointer has left the window.
98+
// Typically called by currently configured FlutterWindowBindingHandler
9299
void OnPointerLeave();
93100

94-
// TODO
101+
// Notify view that backing window has received text.
102+
// Typically called by currently configured FlutterWindowBindingHandler
95103
void OnText(const std::u16string&);
96104

97-
// TODO
105+
// Notify view that backing window size has received key press.
106+
// Typically called by currently configured FlutterWindowBindingHandler
98107
void OnKey(int key, int scancode, int action, char32_t character);
99108

100-
// TODO
109+
// Notify view that backing window size has recevied scroll.
110+
// Typically called by currently configured FlutterWindowBindingHandler
101111
void OnScroll(double x,
102112
double y,
103113
double delta_x,
104114
double delta_y,
105115
int scroll_offset_multiplier);
106116

107-
// TODO
117+
// Notify view that backing window size has had system font change.
118+
// Typically called by currently configured FlutterWindowBindingHandler
108119
void OnFontChange();
109120

110121
private:
111-
// TODO
112-
void CreateRenderSurfaceHWND();
113122

114123
// Sends a window metrics update to the Flutter engine using current window
115124
// dimensions in physical
@@ -179,7 +188,7 @@ class FlutterWindowsView {
179188
std::unique_ptr<AngleSurfaceManager> surface_manager = nullptr;
180189
EGLSurface render_surface = EGL_NO_SURFACE;
181190

182-
// state of the mouse button
191+
// state of the mouse button.
183192
bool pointer_is_down_ = false;
184193

185194
// The handle to the Flutter engine instance.
@@ -220,18 +229,13 @@ class FlutterWindowsView {
220229
// should we forword input messages or not
221230
bool process_events_ = false;
222231

223-
// flag indicating if the message loop should be running
232+
// flag indicating if the message loop should be running.
224233
bool messageloop_running_ = false;
225234

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.
233236
std::unique_ptr<WindowsRenderTarget> render_target_;
234237

238+
// Currently configured FlutterWindowBindingHandler for view.
235239
std::unique_ptr<flutter::FlutterWindowBindingHandler> binding_handler_{
236240
nullptr};
237241
};

0 commit comments

Comments
 (0)