@@ -43,19 +43,7 @@ static double GetDeviceDpi() {
4343 return (double )feature_dpi;
4444}
4545
46- TizenEmbedderEngine::TizenEmbedderEngine (
47- const FlutterWindowProperties& window_properties)
48- : device_profile(GetDeviceProfile()), device_dpi(GetDeviceDpi()) {
49- #ifdef FLUTTER_TIZEN_4
50- tizen_renderer = std::make_unique<TizenRendererEcoreWl>(
51- *this , window_properties.x , window_properties.y , window_properties.width ,
52- window_properties.height );
53- #else
54- tizen_renderer = std::make_unique<TizenRendererEcoreWl2>(
55- *this , window_properties.x , window_properties.y , window_properties.width ,
56- window_properties.height );
57- #endif
58-
46+ void TizenEmbedderEngine::InitTizenEmbedderEngine () {
5947 // Run flutter task on Tizen main loop.
6048 // Tizen engine has four threads (GPU thread, UI thread, IO thread, platform
6149 // thread). UI threads need to send flutter task to platform thread.
@@ -75,6 +63,31 @@ TizenEmbedderEngine::TizenEmbedderEngine(
7563 tizen_vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this );
7664}
7765
66+ TizenEmbedderEngine::TizenEmbedderEngine ()
67+ : device_profile(GetDeviceProfile()),
68+ device_dpi(GetDeviceDpi()),
69+ is_ui_application_(false ) {
70+ InitTizenEmbedderEngine ();
71+ }
72+
73+ TizenEmbedderEngine::TizenEmbedderEngine (
74+ const FlutterWindowProperties& window_properties)
75+ : device_profile(GetDeviceProfile()),
76+ device_dpi(GetDeviceDpi()),
77+ is_ui_application_(true ) {
78+ #ifdef FLUTTER_TIZEN_4
79+ tizen_renderer = std::make_unique<TizenRendererEcoreWl>(
80+ *this , window_properties.x , window_properties.y , window_properties.width ,
81+ window_properties.height );
82+ #else
83+ tizen_renderer = std::make_unique<TizenRendererEcoreWl2>(
84+ *this , window_properties.x , window_properties.y , window_properties.width ,
85+ window_properties.height );
86+ #endif
87+
88+ InitTizenEmbedderEngine ();
89+ }
90+
7891TizenEmbedderEngine::~TizenEmbedderEngine () {
7992 FT_LOGD (" Destroy" );
8093 tizen_renderer = nullptr ;
@@ -107,7 +120,7 @@ UniqueAotDataPtr LoadAotData(std::string aot_data_path) {
107120
108121bool TizenEmbedderEngine::RunEngine (
109122 const FlutterEngineProperties& engine_properties) {
110- if (!tizen_renderer->IsValid ()) {
123+ if (is_ui_application_ && !tizen_renderer->IsValid ()) {
111124 FT_LOGE (" The display was not valid." );
112125 return false ;
113126 }
@@ -140,16 +153,23 @@ bool TizenEmbedderEngine::RunEngine(
140153 custom_task_runners.platform_task_runner = &platform_task_runner;
141154
142155 FlutterRendererConfig config = {};
143- config.type = kOpenGL ;
144- config.open_gl .struct_size = sizeof (config.open_gl );
145- config.open_gl .make_current = MakeContextCurrent;
146- config.open_gl .make_resource_current = MakeResourceCurrent;
147- config.open_gl .clear_current = ClearContext;
148- config.open_gl .present = Present;
149- config.open_gl .fbo_callback = GetActiveFbo;
150- config.open_gl .surface_transformation = Transformation;
151- config.open_gl .gl_proc_resolver = GlProcResolver;
152- config.open_gl .gl_external_texture_frame_callback = OnAcquireExternalTexture;
156+ if (is_ui_application_) {
157+ config.type = kOpenGL ;
158+ config.open_gl .struct_size = sizeof (config.open_gl );
159+ config.open_gl .make_current = MakeContextCurrent;
160+ config.open_gl .make_resource_current = MakeResourceCurrent;
161+ config.open_gl .clear_current = ClearContext;
162+ config.open_gl .present = Present;
163+ config.open_gl .fbo_callback = GetActiveFbo;
164+ config.open_gl .surface_transformation = Transformation;
165+ config.open_gl .gl_proc_resolver = GlProcResolver;
166+ config.open_gl .gl_external_texture_frame_callback =
167+ OnAcquireExternalTexture;
168+ } else {
169+ config.type = kSoftware ;
170+ config.software .struct_size = sizeof (config.software );
171+ config.software .surface_present_callback = SurfacePresentCallback;
172+ }
153173
154174 FlutterProjectArgs args = {};
155175 args.struct_size = sizeof (FlutterProjectArgs);
@@ -189,26 +209,29 @@ bool TizenEmbedderEngine::RunEngine(
189209 internal_plugin_registrar_ =
190210 std::make_unique<flutter::PluginRegistrar>(plugin_registrar_.get ());
191211
192- key_event_channel = std::make_unique<KeyEventChannel>(
193- internal_plugin_registrar_->messenger ());
194- navigation_channel = std::make_unique<NavigationChannel>(
195- internal_plugin_registrar_->messenger ());
196212 platform_channel = std::make_unique<PlatformChannel>(
197213 internal_plugin_registrar_->messenger ());
198214 settings_channel = std::make_unique<SettingsChannel>(
199215 internal_plugin_registrar_->messenger ());
200- text_input_channel = std::make_unique<TextInputChannel>(
201- internal_plugin_registrar_->messenger (), this );
202216 localization_channel = std::make_unique<LocalizationChannel>(flutter_engine);
203217 localization_channel->SendLocales ();
204218 lifecycle_channel = std::make_unique<LifecycleChannel>(flutter_engine);
205- platform_view_channel = std::make_unique<PlatformViewChannel>(
206- internal_plugin_registrar_->messenger (), this );
207219
208- key_event_handler_ = std::make_unique<KeyEventHandler>(this );
209- touch_event_handler_ = std::make_unique<TouchEventHandler>(this );
220+ if (is_ui_application_) {
221+ key_event_channel = std::make_unique<KeyEventChannel>(
222+ internal_plugin_registrar_->messenger ());
223+ navigation_channel = std::make_unique<NavigationChannel>(
224+ internal_plugin_registrar_->messenger ());
225+ text_input_channel = std::make_unique<TextInputChannel>(
226+ internal_plugin_registrar_->messenger (), this );
227+ platform_view_channel = std::make_unique<PlatformViewChannel>(
228+ internal_plugin_registrar_->messenger (), this );
229+ key_event_handler_ = std::make_unique<KeyEventHandler>(this );
230+ touch_event_handler_ = std::make_unique<TouchEventHandler>(this );
231+
232+ SetWindowOrientation (0 );
233+ }
210234
211- SetWindowOrientation (0 );
212235 return true ;
213236}
214237
@@ -367,6 +390,14 @@ FlutterDesktopMessage TizenEmbedderEngine::ConvertToDesktopMessage(
367390 return message;
368391}
369392
393+ bool TizenEmbedderEngine::SurfacePresentCallback (void * user_data,
394+ const void * allocation,
395+ size_t row_bytes,
396+ size_t height) {
397+ FT_LOGD (" SurfacePresentCallback" );
398+ return true ;
399+ }
400+
370401bool TizenEmbedderEngine::MakeContextCurrent (void * user_data) {
371402 return reinterpret_cast <TizenEmbedderEngine*>(user_data)
372403 ->tizen_renderer ->OnMakeCurrent ();
0 commit comments