Skip to content

Commit 31a69d5

Browse files
authored
Support pointing device setting (flutter-tizen#660)
1 parent 94c3447 commit 31a69d5

5 files changed

Lines changed: 46 additions & 2 deletions

File tree

bin/internal/embedder.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
36968dd01502a3a9141c4bc27309e057beff2fa5
1+
ffc7e8ab47cff57a721e6e2011fb12f59ab165e5

embedding/cpp/flutter_app.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ bool FlutterApp::OnCreate() {
3838
window_prop.user_pixel_ratio =
3939
user_pixel_ratio_ < 0.0 ? 0.0 : user_pixel_ratio_;
4040
window_prop.window_handle = nullptr;
41+
window_prop.pointing_device_support = is_pointing_device_support;
42+
window_prop.floating_menu_support = is_floating_menu_support;
4143

4244
view_ = FlutterDesktopViewCreateFromNewWindow(window_prop,
4345
engine_->RelinquishEngine());

embedding/cpp/include/flutter_app.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,27 @@ class FlutterApp : public flutter::PluginRegistry {
111111

112112
// The user-defined pixel ratio.
113113
//
114-
// Defaults to the device pixel ratio if the value is 0.
114+
// Defaults to the device pixel ratio if the value is 0.
115115
double user_pixel_ratio_ = 0.0;
116116

117+
// Whether the app should support pointing devices (mouse).
118+
//
119+
// If false, pointing device input will not work and and the D-PAD will show
120+
// with the floating menu. If true and is_floating_menu_support is false,
121+
// pointing device input will not work.
122+
//
123+
// It only works on TV.
124+
bool is_pointing_device_support = true;
125+
126+
// Whether the app should support floating menus.
127+
//
128+
// If false, pointing device input will not work and the floating menu will
129+
// not be displayed. If false and is_pointing_device_support is true, pointing
130+
// device input will not work.
131+
//
132+
// It only works on TV.
133+
bool is_floating_menu_support = true;
134+
117135
private:
118136
// The optional entrypoint in the Dart project.
119137
//

embedding/csharp/Tizen.Flutter.Embedding/FlutterApplication.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,24 @@ public class FlutterApplication : CoreUIApplication, IPluginRegistry
8686
/// </summary>
8787
protected bool IsTopLevel { get; set; } = false;
8888

89+
/// <summary>
90+
/// Whether the app should support pointing devices (mouse).
91+
/// If false, pointing device input will not work and and the D-PAD will show with the floating menu.
92+
/// If true and IsFloatingMenuSupport is false, pointing device input will not work.
93+
///
94+
/// It only works on TV.
95+
/// </summary>
96+
protected bool IsPointingDeviceSupport { get; set; } = true;
97+
98+
/// <summary>
99+
/// Whether the app should support floating menus.
100+
/// If false, pointing device input will not work and the floating menu will not be displayed.
101+
/// If false and IsPointingDeviceSupport is true, pointing device input will not work.
102+
///
103+
/// It only works on TV.
104+
/// </summary>
105+
protected bool IsFloatingMenuSupport { get; set; } = true;
106+
89107
/// <summary>
90108
/// The renderer type of the engine. Defaults to EGL.
91109
/// </summary>
@@ -155,6 +173,8 @@ protected override void OnCreate()
155173
renderer_type = (FlutterDesktopRendererType)RendererType,
156174
user_pixel_ratio = UserPixelRatio < 0.0 ? 0.0 : UserPixelRatio,
157175
window_handle = wlWindow,
176+
pointing_device_support = IsPointingDeviceSupport,
177+
floating_menu_support = IsFloatingMenuSupport,
158178
};
159179

160180
View = FlutterDesktopViewCreateFromNewWindow(ref windowProperties, Engine.Engine);

embedding/csharp/Tizen.Flutter.Embedding/Interop/Interop.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public struct FlutterDesktopWindowProperties
4040
public FlutterDesktopRendererType renderer_type;
4141
public double user_pixel_ratio;
4242
public IntPtr window_handle;
43+
[MarshalAs(UnmanagedType.U1)]
44+
public bool pointing_device_support;
45+
[MarshalAs(UnmanagedType.U1)]
46+
public bool floating_menu_support;
4347
}
4448

4549
[StructLayout(LayoutKind.Sequential)]

0 commit comments

Comments
 (0)