5
5
#include " tizen_window_elementary.h"
6
6
7
7
#include < efl_extension.h>
8
+ #include < eom.h>
8
9
#include < ui/efl_util.h>
9
10
10
11
#include " flutter/shell/platform/tizen/logger.h"
@@ -34,11 +35,20 @@ uint32_t EvasModifierToEcoreEventModifiers(const Evas_Modifier* evas_modifier) {
34
35
35
36
} // namespace
36
37
37
- TizenWindowElementary::TizenWindowElementary (TizenGeometry geometry,
38
- bool transparent,
39
- bool focusable,
40
- bool top_level)
41
- : TizenWindow(geometry, transparent, focusable, top_level) {
38
+ TizenWindowElementary::TizenWindowElementary (
39
+ TizenGeometry geometry,
40
+ bool transparent,
41
+ bool focusable,
42
+ bool top_level,
43
+ FlutterDesktopExternalOutputType external_output_type)
44
+ : TizenWindow(geometry, transparent, focusable, top_level),
45
+ external_output_type_ (external_output_type) {
46
+ if (external_output_type_ != FlutterDesktopExternalOutputType::kNone &&
47
+ !InitializeExternalOutputManager ()) {
48
+ FT_LOG (Error) << " Failed to initialize the External Output Manager." ;
49
+ return ;
50
+ }
51
+
42
52
if (!CreateWindow ()) {
43
53
FT_LOG (Error) << " Failed to create a platform window." ;
44
54
return ;
@@ -51,6 +61,9 @@ TizenWindowElementary::TizenWindowElementary(TizenGeometry geometry,
51
61
}
52
62
53
63
TizenWindowElementary::~TizenWindowElementary () {
64
+ if (external_output_type_ != FlutterDesktopExternalOutputType::kNone ) {
65
+ DestroyExternalOutputManager ();
66
+ }
54
67
UnregisterEventHandlers ();
55
68
DestroyWindow ();
56
69
}
@@ -69,11 +82,15 @@ bool TizenWindowElementary::CreateWindow() {
69
82
elm_win_aux_hint_add (elm_win_, " wm.policy.win.user.geometry" , " 1" );
70
83
#endif
71
84
72
- Ecore_Evas* ecore_evas =
73
- ecore_evas_ecore_evas_get (evas_object_evas_get (elm_win_));
74
-
75
- int32_t width, height;
76
- ecore_evas_screen_geometry_get (ecore_evas, nullptr , nullptr , &width, &height);
85
+ int32_t width = 0 , height = 0 ;
86
+ if (external_output_type_ != FlutterDesktopExternalOutputType::kNone ) {
87
+ eom_get_output_resolution (external_output_id_, &width, &height);
88
+ } else {
89
+ Ecore_Evas* ecore_evas =
90
+ ecore_evas_ecore_evas_get (evas_object_evas_get (elm_win_));
91
+ ecore_evas_screen_geometry_get (ecore_evas, nullptr , nullptr , &width,
92
+ &height);
93
+ }
77
94
if (width == 0 || height == 0 ) {
78
95
FT_LOG (Error) << " Invalid screen size: " << width << " x " << height;
79
96
return false ;
@@ -99,6 +116,14 @@ bool TizenWindowElementary::CreateWindow() {
99
116
evas_object_image_alpha_set (image_, EINA_TRUE);
100
117
elm_win_resize_object_add (elm_win_, image_);
101
118
119
+ if (external_output_type_ != FlutterDesktopExternalOutputType::kNone ) {
120
+ if (eom_set_output_window (external_output_id_, elm_win_) !=
121
+ EOM_ERROR_NONE) {
122
+ FT_LOG (Error) << " eom_set_output_window() failed." ;
123
+ return false ;
124
+ }
125
+ }
126
+
102
127
return elm_win_ && image_;
103
128
}
104
129
@@ -403,4 +428,54 @@ void TizenWindowElementary::PrepareInputMethod() {
403
428
[this ](std::string str) { view_delegate_->OnCommit (str); });
404
429
}
405
430
431
+ int32_t TizenWindowElementary::GetExternalOutputId () {
432
+ int32_t num_ids = 0 ;
433
+ eom_output_id* output_ids = eom_get_eom_output_ids (&num_ids);
434
+ if (!output_ids || num_ids == 0 ) {
435
+ FT_LOG (Error) << " No external output found." ;
436
+ return 0 ;
437
+ }
438
+
439
+ eom_output_id output_id = 0 ;
440
+ for (int32_t i = 0 ; i < num_ids; i++) {
441
+ eom_output_type_e output_type = EOM_OUTPUT_TYPE_UNKNOWN;
442
+ eom_get_output_type (output_ids[i], &output_type);
443
+
444
+ if (external_output_type_ == FlutterDesktopExternalOutputType::kHDMI &&
445
+ (output_type == EOM_OUTPUT_TYPE_HDMIA ||
446
+ output_type == EOM_OUTPUT_TYPE_HDMIB)) {
447
+ output_id = output_ids[i];
448
+ break ;
449
+ }
450
+ }
451
+ free (output_ids);
452
+ return output_id;
453
+ }
454
+
455
+ bool TizenWindowElementary::InitializeExternalOutputManager () {
456
+ if (eom_init ()) {
457
+ FT_LOG (Error) << " eom_init() failed." ;
458
+ return false ;
459
+ }
460
+
461
+ external_output_id_ = GetExternalOutputId ();
462
+ if (external_output_id_ == 0 ) {
463
+ FT_LOG (Error) << " Invalid external output ID." ;
464
+ return false ;
465
+ }
466
+
467
+ int ret = eom_set_output_attribute (external_output_id_,
468
+ EOM_OUTPUT_ATTRIBUTE_NORMAL);
469
+ if (ret != EOM_ERROR_NONE) {
470
+ FT_LOG (Error)
471
+ << " eom_set_output_attribute() failed. Cannot use external output." ;
472
+ return false ;
473
+ }
474
+ return true ;
475
+ }
476
+
477
+ void TizenWindowElementary::DestroyExternalOutputManager () {
478
+ eom_deinit ();
479
+ }
480
+
406
481
} // namespace flutter
0 commit comments