From a608dc05a160684f993baec837b2c5a9dcd5b3fa Mon Sep 17 00:00:00 2001 From: Hidenori Matsubayashi Date: Thu, 17 Aug 2023 03:59:28 +0000 Subject: [PATCH] examples: update elinux template source files (#73) Signed-off-by: Hidenori Matsubayashi --- .../elinux/runner/flutter_embedder_options.h | 79 ++++++++++++++++--- packages/camera/example/elinux/runner/main.cc | 7 +- .../elinux/runner/flutter_embedder_options.h | 79 ++++++++++++++++--- .../joystick/example/elinux/runner/main.cc | 7 +- .../elinux/runner/flutter_embedder_options.h | 79 ++++++++++++++++--- .../example/elinux/runner/main.cc | 7 +- .../elinux/runner/flutter_embedder_options.h | 79 ++++++++++++++++--- .../example/elinux/runner/main.cc | 7 +- .../elinux/runner/flutter_embedder_options.h | 79 ++++++++++++++++--- .../example/elinux/runner/main.cc | 7 +- 10 files changed, 370 insertions(+), 60 deletions(-) diff --git a/packages/camera/example/elinux/runner/flutter_embedder_options.h b/packages/camera/example/elinux/runner/flutter_embedder_options.h index fbb8190..41d0bd1 100644 --- a/packages/camera/example/elinux/runner/flutter_embedder_options.h +++ b/packages/camera/example/elinux/runner/flutter_embedder_options.h @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,18 +21,31 @@ class FlutterEmbedderOptions { options_.AddInt("rotation", "r", "Window rotation(degree) [0(default)|90|180|270]", 0, false); + options_.AddDouble("text-scaling-factor", "x", "Text scaling factor", 1.0, + false); + options_.AddWithoutValue("enable-high-contrast", "i", + "Request that UI be rendered with darker colors.", + false); options_.AddDouble("force-scale-factor", "s", - "Force a scale factor instead using default value", 1.0, - false); + "Force a scale factor instead using default value", 1.0, + false); + options_.AddWithoutValue( + "async-vblank", "v", + "Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) // no more options. #elif defined(FLUTTER_TARGET_BACKEND_X11) + options_.AddString("title", "t", "Window title", "Flutter", false); options_.AddWithoutValue("fullscreen", "f", "Always full-screen display", false); options_.AddInt("width", "w", "Window width", 1280, false); options_.AddInt("height", "h", "Window height", 720, false); #else // FLUTTER_TARGET_BACKEND_WAYLAND + options_.AddString("title", "t", "Window title", "Flutter", false); + options_.AddString("app-id", "a", "XDG App ID", "dev.flutter.elinux", + false); options_.AddWithoutValue("onscreen-keyboard", "k", "Enable on-screen keyboard", false); options_.AddWithoutValue("window-decoration", "d", @@ -75,6 +88,9 @@ class FlutterEmbedderOptions { } } + text_scale_factor_ = options_.GetValue("text-scaling-factor"); + enable_high_contrast_ = options_.Exist("enable-high-contrast"); + if (options_.Exist("force-scale-factor")) { is_force_scale_factor_ = true; scale_factor_ = options_.GetValue("force-scale-factor"); @@ -83,6 +99,8 @@ class FlutterEmbedderOptions { scale_factor_ = 1.0; } + enable_vsync_ = !options_.Exist("async-vblank"); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) use_onscreen_keyboard_ = false; @@ -91,6 +109,7 @@ class FlutterEmbedderOptions { #elif defined(FLUTTER_TARGET_BACKEND_X11) use_onscreen_keyboard_ = false; use_window_decoration_ = false; + window_title_ = options_.GetValue("title"); window_view_mode_ = options_.Exist("fullscreen") ? flutter::FlutterViewController::ViewMode::kFullscreen @@ -98,6 +117,8 @@ class FlutterEmbedderOptions { window_width_ = options_.GetValue("width"); window_height_ = options_.GetValue("height"); #else // FLUTTER_TARGET_BACKEND_WAYLAND + window_title_ = options_.GetValue("title"); + window_app_id_ = options_.GetValue("app-id"); use_onscreen_keyboard_ = options_.Exist("onscreen-keyboard"); use_window_decoration_ = options_.Exist("window-decoration"); window_view_mode_ = @@ -111,25 +132,58 @@ class FlutterEmbedderOptions { return true; } - std::string BundlePath() const { return bundle_path_; } - bool IsUseMouseCursor() const { return use_mouse_cursor_; } - bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; } - bool IsUseWindowDecoraation() const { return use_window_decoration_; } + std::string BundlePath() const { + return bundle_path_; + } + std::string WindowTitle() const { + return window_title_; + } + std::string WindowAppID() const { + return window_app_id_; + } + bool IsUseMouseCursor() const { + return use_mouse_cursor_; + } + bool IsUseOnscreenKeyboard() const { + return use_onscreen_keyboard_; + } + bool IsUseWindowDecoraation() const { + return use_window_decoration_; + } flutter::FlutterViewController::ViewMode WindowViewMode() const { return window_view_mode_; } - int WindowWidth() const { return window_width_; } - int WindowHeight() const { return window_height_; } + int WindowWidth() const { + return window_width_; + } + int WindowHeight() const { + return window_height_; + } flutter::FlutterViewController::ViewRotation WindowRotation() const { return window_view_rotation_; } - bool IsForceScaleFactor() const { return is_force_scale_factor_; } - double ScaleFactor() const { return scale_factor_; } + double TextScaleFactor() const { + return text_scale_factor_; + } + bool EnableHighContrast() const { + return enable_high_contrast_; + } + bool IsForceScaleFactor() const { + return is_force_scale_factor_; + } + double ScaleFactor() const { + return scale_factor_; + } + bool EnableVsync() const { + return enable_vsync_; + } private: commandline::CommandOptions options_; std::string bundle_path_; + std::string window_title_; + std::string window_app_id_; bool use_mouse_cursor_ = true; bool use_onscreen_keyboard_ = false; bool use_window_decoration_ = false; @@ -141,6 +195,9 @@ class FlutterEmbedderOptions { flutter::FlutterViewController::ViewRotation::kRotation_0; bool is_force_scale_factor_; double scale_factor_; + double text_scale_factor_; + bool enable_high_contrast_; + bool enable_vsync_; }; #endif // FLUTTER_EMBEDDER_OPTIONS_ diff --git a/packages/camera/example/elinux/runner/main.cc b/packages/camera/example/elinux/runner/main.cc index dd3e12d..579daee 100644 --- a/packages/camera/example/elinux/runner/main.cc +++ b/packages/camera/example/elinux/runner/main.cc @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,11 +30,16 @@ int main(int argc, char** argv) { view_properties.height = options.WindowHeight(); view_properties.view_mode = options.WindowViewMode(); view_properties.view_rotation = options.WindowRotation(); + view_properties.title = options.WindowTitle(); + view_properties.app_id = options.WindowAppID(); view_properties.use_mouse_cursor = options.IsUseMouseCursor(); view_properties.use_onscreen_keyboard = options.IsUseOnscreenKeyboard(); view_properties.use_window_decoration = options.IsUseWindowDecoraation(); + view_properties.text_scale_factor = options.TextScaleFactor(); + view_properties.enable_high_contrast = options.EnableHighContrast(); view_properties.force_scale_factor = options.IsForceScaleFactor(); view_properties.scale_factor = options.ScaleFactor(); + view_properties.enable_vsync = options.EnableVsync(); // The Flutter instance hosted by this window. FlutterWindow window(view_properties, project); diff --git a/packages/joystick/example/elinux/runner/flutter_embedder_options.h b/packages/joystick/example/elinux/runner/flutter_embedder_options.h index fbb8190..41d0bd1 100644 --- a/packages/joystick/example/elinux/runner/flutter_embedder_options.h +++ b/packages/joystick/example/elinux/runner/flutter_embedder_options.h @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,18 +21,31 @@ class FlutterEmbedderOptions { options_.AddInt("rotation", "r", "Window rotation(degree) [0(default)|90|180|270]", 0, false); + options_.AddDouble("text-scaling-factor", "x", "Text scaling factor", 1.0, + false); + options_.AddWithoutValue("enable-high-contrast", "i", + "Request that UI be rendered with darker colors.", + false); options_.AddDouble("force-scale-factor", "s", - "Force a scale factor instead using default value", 1.0, - false); + "Force a scale factor instead using default value", 1.0, + false); + options_.AddWithoutValue( + "async-vblank", "v", + "Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) // no more options. #elif defined(FLUTTER_TARGET_BACKEND_X11) + options_.AddString("title", "t", "Window title", "Flutter", false); options_.AddWithoutValue("fullscreen", "f", "Always full-screen display", false); options_.AddInt("width", "w", "Window width", 1280, false); options_.AddInt("height", "h", "Window height", 720, false); #else // FLUTTER_TARGET_BACKEND_WAYLAND + options_.AddString("title", "t", "Window title", "Flutter", false); + options_.AddString("app-id", "a", "XDG App ID", "dev.flutter.elinux", + false); options_.AddWithoutValue("onscreen-keyboard", "k", "Enable on-screen keyboard", false); options_.AddWithoutValue("window-decoration", "d", @@ -75,6 +88,9 @@ class FlutterEmbedderOptions { } } + text_scale_factor_ = options_.GetValue("text-scaling-factor"); + enable_high_contrast_ = options_.Exist("enable-high-contrast"); + if (options_.Exist("force-scale-factor")) { is_force_scale_factor_ = true; scale_factor_ = options_.GetValue("force-scale-factor"); @@ -83,6 +99,8 @@ class FlutterEmbedderOptions { scale_factor_ = 1.0; } + enable_vsync_ = !options_.Exist("async-vblank"); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) use_onscreen_keyboard_ = false; @@ -91,6 +109,7 @@ class FlutterEmbedderOptions { #elif defined(FLUTTER_TARGET_BACKEND_X11) use_onscreen_keyboard_ = false; use_window_decoration_ = false; + window_title_ = options_.GetValue("title"); window_view_mode_ = options_.Exist("fullscreen") ? flutter::FlutterViewController::ViewMode::kFullscreen @@ -98,6 +117,8 @@ class FlutterEmbedderOptions { window_width_ = options_.GetValue("width"); window_height_ = options_.GetValue("height"); #else // FLUTTER_TARGET_BACKEND_WAYLAND + window_title_ = options_.GetValue("title"); + window_app_id_ = options_.GetValue("app-id"); use_onscreen_keyboard_ = options_.Exist("onscreen-keyboard"); use_window_decoration_ = options_.Exist("window-decoration"); window_view_mode_ = @@ -111,25 +132,58 @@ class FlutterEmbedderOptions { return true; } - std::string BundlePath() const { return bundle_path_; } - bool IsUseMouseCursor() const { return use_mouse_cursor_; } - bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; } - bool IsUseWindowDecoraation() const { return use_window_decoration_; } + std::string BundlePath() const { + return bundle_path_; + } + std::string WindowTitle() const { + return window_title_; + } + std::string WindowAppID() const { + return window_app_id_; + } + bool IsUseMouseCursor() const { + return use_mouse_cursor_; + } + bool IsUseOnscreenKeyboard() const { + return use_onscreen_keyboard_; + } + bool IsUseWindowDecoraation() const { + return use_window_decoration_; + } flutter::FlutterViewController::ViewMode WindowViewMode() const { return window_view_mode_; } - int WindowWidth() const { return window_width_; } - int WindowHeight() const { return window_height_; } + int WindowWidth() const { + return window_width_; + } + int WindowHeight() const { + return window_height_; + } flutter::FlutterViewController::ViewRotation WindowRotation() const { return window_view_rotation_; } - bool IsForceScaleFactor() const { return is_force_scale_factor_; } - double ScaleFactor() const { return scale_factor_; } + double TextScaleFactor() const { + return text_scale_factor_; + } + bool EnableHighContrast() const { + return enable_high_contrast_; + } + bool IsForceScaleFactor() const { + return is_force_scale_factor_; + } + double ScaleFactor() const { + return scale_factor_; + } + bool EnableVsync() const { + return enable_vsync_; + } private: commandline::CommandOptions options_; std::string bundle_path_; + std::string window_title_; + std::string window_app_id_; bool use_mouse_cursor_ = true; bool use_onscreen_keyboard_ = false; bool use_window_decoration_ = false; @@ -141,6 +195,9 @@ class FlutterEmbedderOptions { flutter::FlutterViewController::ViewRotation::kRotation_0; bool is_force_scale_factor_; double scale_factor_; + double text_scale_factor_; + bool enable_high_contrast_; + bool enable_vsync_; }; #endif // FLUTTER_EMBEDDER_OPTIONS_ diff --git a/packages/joystick/example/elinux/runner/main.cc b/packages/joystick/example/elinux/runner/main.cc index dd3e12d..579daee 100644 --- a/packages/joystick/example/elinux/runner/main.cc +++ b/packages/joystick/example/elinux/runner/main.cc @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,11 +30,16 @@ int main(int argc, char** argv) { view_properties.height = options.WindowHeight(); view_properties.view_mode = options.WindowViewMode(); view_properties.view_rotation = options.WindowRotation(); + view_properties.title = options.WindowTitle(); + view_properties.app_id = options.WindowAppID(); view_properties.use_mouse_cursor = options.IsUseMouseCursor(); view_properties.use_onscreen_keyboard = options.IsUseOnscreenKeyboard(); view_properties.use_window_decoration = options.IsUseWindowDecoraation(); + view_properties.text_scale_factor = options.TextScaleFactor(); + view_properties.enable_high_contrast = options.EnableHighContrast(); view_properties.force_scale_factor = options.IsForceScaleFactor(); view_properties.scale_factor = options.ScaleFactor(); + view_properties.enable_vsync = options.EnableVsync(); // The Flutter instance hosted by this window. FlutterWindow window(view_properties, project); diff --git a/packages/path_provider/example/elinux/runner/flutter_embedder_options.h b/packages/path_provider/example/elinux/runner/flutter_embedder_options.h index fbb8190..41d0bd1 100644 --- a/packages/path_provider/example/elinux/runner/flutter_embedder_options.h +++ b/packages/path_provider/example/elinux/runner/flutter_embedder_options.h @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,18 +21,31 @@ class FlutterEmbedderOptions { options_.AddInt("rotation", "r", "Window rotation(degree) [0(default)|90|180|270]", 0, false); + options_.AddDouble("text-scaling-factor", "x", "Text scaling factor", 1.0, + false); + options_.AddWithoutValue("enable-high-contrast", "i", + "Request that UI be rendered with darker colors.", + false); options_.AddDouble("force-scale-factor", "s", - "Force a scale factor instead using default value", 1.0, - false); + "Force a scale factor instead using default value", 1.0, + false); + options_.AddWithoutValue( + "async-vblank", "v", + "Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) // no more options. #elif defined(FLUTTER_TARGET_BACKEND_X11) + options_.AddString("title", "t", "Window title", "Flutter", false); options_.AddWithoutValue("fullscreen", "f", "Always full-screen display", false); options_.AddInt("width", "w", "Window width", 1280, false); options_.AddInt("height", "h", "Window height", 720, false); #else // FLUTTER_TARGET_BACKEND_WAYLAND + options_.AddString("title", "t", "Window title", "Flutter", false); + options_.AddString("app-id", "a", "XDG App ID", "dev.flutter.elinux", + false); options_.AddWithoutValue("onscreen-keyboard", "k", "Enable on-screen keyboard", false); options_.AddWithoutValue("window-decoration", "d", @@ -75,6 +88,9 @@ class FlutterEmbedderOptions { } } + text_scale_factor_ = options_.GetValue("text-scaling-factor"); + enable_high_contrast_ = options_.Exist("enable-high-contrast"); + if (options_.Exist("force-scale-factor")) { is_force_scale_factor_ = true; scale_factor_ = options_.GetValue("force-scale-factor"); @@ -83,6 +99,8 @@ class FlutterEmbedderOptions { scale_factor_ = 1.0; } + enable_vsync_ = !options_.Exist("async-vblank"); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) use_onscreen_keyboard_ = false; @@ -91,6 +109,7 @@ class FlutterEmbedderOptions { #elif defined(FLUTTER_TARGET_BACKEND_X11) use_onscreen_keyboard_ = false; use_window_decoration_ = false; + window_title_ = options_.GetValue("title"); window_view_mode_ = options_.Exist("fullscreen") ? flutter::FlutterViewController::ViewMode::kFullscreen @@ -98,6 +117,8 @@ class FlutterEmbedderOptions { window_width_ = options_.GetValue("width"); window_height_ = options_.GetValue("height"); #else // FLUTTER_TARGET_BACKEND_WAYLAND + window_title_ = options_.GetValue("title"); + window_app_id_ = options_.GetValue("app-id"); use_onscreen_keyboard_ = options_.Exist("onscreen-keyboard"); use_window_decoration_ = options_.Exist("window-decoration"); window_view_mode_ = @@ -111,25 +132,58 @@ class FlutterEmbedderOptions { return true; } - std::string BundlePath() const { return bundle_path_; } - bool IsUseMouseCursor() const { return use_mouse_cursor_; } - bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; } - bool IsUseWindowDecoraation() const { return use_window_decoration_; } + std::string BundlePath() const { + return bundle_path_; + } + std::string WindowTitle() const { + return window_title_; + } + std::string WindowAppID() const { + return window_app_id_; + } + bool IsUseMouseCursor() const { + return use_mouse_cursor_; + } + bool IsUseOnscreenKeyboard() const { + return use_onscreen_keyboard_; + } + bool IsUseWindowDecoraation() const { + return use_window_decoration_; + } flutter::FlutterViewController::ViewMode WindowViewMode() const { return window_view_mode_; } - int WindowWidth() const { return window_width_; } - int WindowHeight() const { return window_height_; } + int WindowWidth() const { + return window_width_; + } + int WindowHeight() const { + return window_height_; + } flutter::FlutterViewController::ViewRotation WindowRotation() const { return window_view_rotation_; } - bool IsForceScaleFactor() const { return is_force_scale_factor_; } - double ScaleFactor() const { return scale_factor_; } + double TextScaleFactor() const { + return text_scale_factor_; + } + bool EnableHighContrast() const { + return enable_high_contrast_; + } + bool IsForceScaleFactor() const { + return is_force_scale_factor_; + } + double ScaleFactor() const { + return scale_factor_; + } + bool EnableVsync() const { + return enable_vsync_; + } private: commandline::CommandOptions options_; std::string bundle_path_; + std::string window_title_; + std::string window_app_id_; bool use_mouse_cursor_ = true; bool use_onscreen_keyboard_ = false; bool use_window_decoration_ = false; @@ -141,6 +195,9 @@ class FlutterEmbedderOptions { flutter::FlutterViewController::ViewRotation::kRotation_0; bool is_force_scale_factor_; double scale_factor_; + double text_scale_factor_; + bool enable_high_contrast_; + bool enable_vsync_; }; #endif // FLUTTER_EMBEDDER_OPTIONS_ diff --git a/packages/path_provider/example/elinux/runner/main.cc b/packages/path_provider/example/elinux/runner/main.cc index dd3e12d..579daee 100644 --- a/packages/path_provider/example/elinux/runner/main.cc +++ b/packages/path_provider/example/elinux/runner/main.cc @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,11 +30,16 @@ int main(int argc, char** argv) { view_properties.height = options.WindowHeight(); view_properties.view_mode = options.WindowViewMode(); view_properties.view_rotation = options.WindowRotation(); + view_properties.title = options.WindowTitle(); + view_properties.app_id = options.WindowAppID(); view_properties.use_mouse_cursor = options.IsUseMouseCursor(); view_properties.use_onscreen_keyboard = options.IsUseOnscreenKeyboard(); view_properties.use_window_decoration = options.IsUseWindowDecoraation(); + view_properties.text_scale_factor = options.TextScaleFactor(); + view_properties.enable_high_contrast = options.EnableHighContrast(); view_properties.force_scale_factor = options.IsForceScaleFactor(); view_properties.scale_factor = options.ScaleFactor(); + view_properties.enable_vsync = options.EnableVsync(); // The Flutter instance hosted by this window. FlutterWindow window(view_properties, project); diff --git a/packages/shared_preferences/example/elinux/runner/flutter_embedder_options.h b/packages/shared_preferences/example/elinux/runner/flutter_embedder_options.h index fbb8190..41d0bd1 100644 --- a/packages/shared_preferences/example/elinux/runner/flutter_embedder_options.h +++ b/packages/shared_preferences/example/elinux/runner/flutter_embedder_options.h @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,18 +21,31 @@ class FlutterEmbedderOptions { options_.AddInt("rotation", "r", "Window rotation(degree) [0(default)|90|180|270]", 0, false); + options_.AddDouble("text-scaling-factor", "x", "Text scaling factor", 1.0, + false); + options_.AddWithoutValue("enable-high-contrast", "i", + "Request that UI be rendered with darker colors.", + false); options_.AddDouble("force-scale-factor", "s", - "Force a scale factor instead using default value", 1.0, - false); + "Force a scale factor instead using default value", 1.0, + false); + options_.AddWithoutValue( + "async-vblank", "v", + "Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) // no more options. #elif defined(FLUTTER_TARGET_BACKEND_X11) + options_.AddString("title", "t", "Window title", "Flutter", false); options_.AddWithoutValue("fullscreen", "f", "Always full-screen display", false); options_.AddInt("width", "w", "Window width", 1280, false); options_.AddInt("height", "h", "Window height", 720, false); #else // FLUTTER_TARGET_BACKEND_WAYLAND + options_.AddString("title", "t", "Window title", "Flutter", false); + options_.AddString("app-id", "a", "XDG App ID", "dev.flutter.elinux", + false); options_.AddWithoutValue("onscreen-keyboard", "k", "Enable on-screen keyboard", false); options_.AddWithoutValue("window-decoration", "d", @@ -75,6 +88,9 @@ class FlutterEmbedderOptions { } } + text_scale_factor_ = options_.GetValue("text-scaling-factor"); + enable_high_contrast_ = options_.Exist("enable-high-contrast"); + if (options_.Exist("force-scale-factor")) { is_force_scale_factor_ = true; scale_factor_ = options_.GetValue("force-scale-factor"); @@ -83,6 +99,8 @@ class FlutterEmbedderOptions { scale_factor_ = 1.0; } + enable_vsync_ = !options_.Exist("async-vblank"); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) use_onscreen_keyboard_ = false; @@ -91,6 +109,7 @@ class FlutterEmbedderOptions { #elif defined(FLUTTER_TARGET_BACKEND_X11) use_onscreen_keyboard_ = false; use_window_decoration_ = false; + window_title_ = options_.GetValue("title"); window_view_mode_ = options_.Exist("fullscreen") ? flutter::FlutterViewController::ViewMode::kFullscreen @@ -98,6 +117,8 @@ class FlutterEmbedderOptions { window_width_ = options_.GetValue("width"); window_height_ = options_.GetValue("height"); #else // FLUTTER_TARGET_BACKEND_WAYLAND + window_title_ = options_.GetValue("title"); + window_app_id_ = options_.GetValue("app-id"); use_onscreen_keyboard_ = options_.Exist("onscreen-keyboard"); use_window_decoration_ = options_.Exist("window-decoration"); window_view_mode_ = @@ -111,25 +132,58 @@ class FlutterEmbedderOptions { return true; } - std::string BundlePath() const { return bundle_path_; } - bool IsUseMouseCursor() const { return use_mouse_cursor_; } - bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; } - bool IsUseWindowDecoraation() const { return use_window_decoration_; } + std::string BundlePath() const { + return bundle_path_; + } + std::string WindowTitle() const { + return window_title_; + } + std::string WindowAppID() const { + return window_app_id_; + } + bool IsUseMouseCursor() const { + return use_mouse_cursor_; + } + bool IsUseOnscreenKeyboard() const { + return use_onscreen_keyboard_; + } + bool IsUseWindowDecoraation() const { + return use_window_decoration_; + } flutter::FlutterViewController::ViewMode WindowViewMode() const { return window_view_mode_; } - int WindowWidth() const { return window_width_; } - int WindowHeight() const { return window_height_; } + int WindowWidth() const { + return window_width_; + } + int WindowHeight() const { + return window_height_; + } flutter::FlutterViewController::ViewRotation WindowRotation() const { return window_view_rotation_; } - bool IsForceScaleFactor() const { return is_force_scale_factor_; } - double ScaleFactor() const { return scale_factor_; } + double TextScaleFactor() const { + return text_scale_factor_; + } + bool EnableHighContrast() const { + return enable_high_contrast_; + } + bool IsForceScaleFactor() const { + return is_force_scale_factor_; + } + double ScaleFactor() const { + return scale_factor_; + } + bool EnableVsync() const { + return enable_vsync_; + } private: commandline::CommandOptions options_; std::string bundle_path_; + std::string window_title_; + std::string window_app_id_; bool use_mouse_cursor_ = true; bool use_onscreen_keyboard_ = false; bool use_window_decoration_ = false; @@ -141,6 +195,9 @@ class FlutterEmbedderOptions { flutter::FlutterViewController::ViewRotation::kRotation_0; bool is_force_scale_factor_; double scale_factor_; + double text_scale_factor_; + bool enable_high_contrast_; + bool enable_vsync_; }; #endif // FLUTTER_EMBEDDER_OPTIONS_ diff --git a/packages/shared_preferences/example/elinux/runner/main.cc b/packages/shared_preferences/example/elinux/runner/main.cc index dd3e12d..579daee 100644 --- a/packages/shared_preferences/example/elinux/runner/main.cc +++ b/packages/shared_preferences/example/elinux/runner/main.cc @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,11 +30,16 @@ int main(int argc, char** argv) { view_properties.height = options.WindowHeight(); view_properties.view_mode = options.WindowViewMode(); view_properties.view_rotation = options.WindowRotation(); + view_properties.title = options.WindowTitle(); + view_properties.app_id = options.WindowAppID(); view_properties.use_mouse_cursor = options.IsUseMouseCursor(); view_properties.use_onscreen_keyboard = options.IsUseOnscreenKeyboard(); view_properties.use_window_decoration = options.IsUseWindowDecoraation(); + view_properties.text_scale_factor = options.TextScaleFactor(); + view_properties.enable_high_contrast = options.EnableHighContrast(); view_properties.force_scale_factor = options.IsForceScaleFactor(); view_properties.scale_factor = options.ScaleFactor(); + view_properties.enable_vsync = options.EnableVsync(); // The Flutter instance hosted by this window. FlutterWindow window(view_properties, project); diff --git a/packages/video_player/example/elinux/runner/flutter_embedder_options.h b/packages/video_player/example/elinux/runner/flutter_embedder_options.h index fbb8190..41d0bd1 100644 --- a/packages/video_player/example/elinux/runner/flutter_embedder_options.h +++ b/packages/video_player/example/elinux/runner/flutter_embedder_options.h @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,18 +21,31 @@ class FlutterEmbedderOptions { options_.AddInt("rotation", "r", "Window rotation(degree) [0(default)|90|180|270]", 0, false); + options_.AddDouble("text-scaling-factor", "x", "Text scaling factor", 1.0, + false); + options_.AddWithoutValue("enable-high-contrast", "i", + "Request that UI be rendered with darker colors.", + false); options_.AddDouble("force-scale-factor", "s", - "Force a scale factor instead using default value", 1.0, - false); + "Force a scale factor instead using default value", 1.0, + false); + options_.AddWithoutValue( + "async-vblank", "v", + "Don't sync to compositor redraw/vblank (eglSwapInterval 0)", false); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) // no more options. #elif defined(FLUTTER_TARGET_BACKEND_X11) + options_.AddString("title", "t", "Window title", "Flutter", false); options_.AddWithoutValue("fullscreen", "f", "Always full-screen display", false); options_.AddInt("width", "w", "Window width", 1280, false); options_.AddInt("height", "h", "Window height", 720, false); #else // FLUTTER_TARGET_BACKEND_WAYLAND + options_.AddString("title", "t", "Window title", "Flutter", false); + options_.AddString("app-id", "a", "XDG App ID", "dev.flutter.elinux", + false); options_.AddWithoutValue("onscreen-keyboard", "k", "Enable on-screen keyboard", false); options_.AddWithoutValue("window-decoration", "d", @@ -75,6 +88,9 @@ class FlutterEmbedderOptions { } } + text_scale_factor_ = options_.GetValue("text-scaling-factor"); + enable_high_contrast_ = options_.Exist("enable-high-contrast"); + if (options_.Exist("force-scale-factor")) { is_force_scale_factor_ = true; scale_factor_ = options_.GetValue("force-scale-factor"); @@ -83,6 +99,8 @@ class FlutterEmbedderOptions { scale_factor_ = 1.0; } + enable_vsync_ = !options_.Exist("async-vblank"); + #if defined(FLUTTER_TARGET_BACKEND_GBM) || \ defined(FLUTTER_TARGET_BACKEND_EGLSTREAM) use_onscreen_keyboard_ = false; @@ -91,6 +109,7 @@ class FlutterEmbedderOptions { #elif defined(FLUTTER_TARGET_BACKEND_X11) use_onscreen_keyboard_ = false; use_window_decoration_ = false; + window_title_ = options_.GetValue("title"); window_view_mode_ = options_.Exist("fullscreen") ? flutter::FlutterViewController::ViewMode::kFullscreen @@ -98,6 +117,8 @@ class FlutterEmbedderOptions { window_width_ = options_.GetValue("width"); window_height_ = options_.GetValue("height"); #else // FLUTTER_TARGET_BACKEND_WAYLAND + window_title_ = options_.GetValue("title"); + window_app_id_ = options_.GetValue("app-id"); use_onscreen_keyboard_ = options_.Exist("onscreen-keyboard"); use_window_decoration_ = options_.Exist("window-decoration"); window_view_mode_ = @@ -111,25 +132,58 @@ class FlutterEmbedderOptions { return true; } - std::string BundlePath() const { return bundle_path_; } - bool IsUseMouseCursor() const { return use_mouse_cursor_; } - bool IsUseOnscreenKeyboard() const { return use_onscreen_keyboard_; } - bool IsUseWindowDecoraation() const { return use_window_decoration_; } + std::string BundlePath() const { + return bundle_path_; + } + std::string WindowTitle() const { + return window_title_; + } + std::string WindowAppID() const { + return window_app_id_; + } + bool IsUseMouseCursor() const { + return use_mouse_cursor_; + } + bool IsUseOnscreenKeyboard() const { + return use_onscreen_keyboard_; + } + bool IsUseWindowDecoraation() const { + return use_window_decoration_; + } flutter::FlutterViewController::ViewMode WindowViewMode() const { return window_view_mode_; } - int WindowWidth() const { return window_width_; } - int WindowHeight() const { return window_height_; } + int WindowWidth() const { + return window_width_; + } + int WindowHeight() const { + return window_height_; + } flutter::FlutterViewController::ViewRotation WindowRotation() const { return window_view_rotation_; } - bool IsForceScaleFactor() const { return is_force_scale_factor_; } - double ScaleFactor() const { return scale_factor_; } + double TextScaleFactor() const { + return text_scale_factor_; + } + bool EnableHighContrast() const { + return enable_high_contrast_; + } + bool IsForceScaleFactor() const { + return is_force_scale_factor_; + } + double ScaleFactor() const { + return scale_factor_; + } + bool EnableVsync() const { + return enable_vsync_; + } private: commandline::CommandOptions options_; std::string bundle_path_; + std::string window_title_; + std::string window_app_id_; bool use_mouse_cursor_ = true; bool use_onscreen_keyboard_ = false; bool use_window_decoration_ = false; @@ -141,6 +195,9 @@ class FlutterEmbedderOptions { flutter::FlutterViewController::ViewRotation::kRotation_0; bool is_force_scale_factor_; double scale_factor_; + double text_scale_factor_; + bool enable_high_contrast_; + bool enable_vsync_; }; #endif // FLUTTER_EMBEDDER_OPTIONS_ diff --git a/packages/video_player/example/elinux/runner/main.cc b/packages/video_player/example/elinux/runner/main.cc index dd3e12d..579daee 100644 --- a/packages/video_player/example/elinux/runner/main.cc +++ b/packages/video_player/example/elinux/runner/main.cc @@ -1,4 +1,4 @@ -// Copyright 2022 Sony Corporation. All rights reserved. +// Copyright 2021 Sony Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,11 +30,16 @@ int main(int argc, char** argv) { view_properties.height = options.WindowHeight(); view_properties.view_mode = options.WindowViewMode(); view_properties.view_rotation = options.WindowRotation(); + view_properties.title = options.WindowTitle(); + view_properties.app_id = options.WindowAppID(); view_properties.use_mouse_cursor = options.IsUseMouseCursor(); view_properties.use_onscreen_keyboard = options.IsUseOnscreenKeyboard(); view_properties.use_window_decoration = options.IsUseWindowDecoraation(); + view_properties.text_scale_factor = options.TextScaleFactor(); + view_properties.enable_high_contrast = options.EnableHighContrast(); view_properties.force_scale_factor = options.IsForceScaleFactor(); view_properties.scale_factor = options.ScaleFactor(); + view_properties.enable_vsync = options.EnableVsync(); // The Flutter instance hosted by this window. FlutterWindow window(view_properties, project);