Skip to content

Commit 52b1409

Browse files
JSUYAmyroot
andauthored
Using precreated window (#89)
Co-authored-by: Seungkeun Lee <[email protected]>
1 parent 87e613a commit 52b1409

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

flutter/shell/platform/tizen/flutter_tizen.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ FlutterDesktopViewRef FlutterDesktopViewCreateFromNewWindow(
209209
} else {
210210
window = std::make_unique<flutter::TizenWindowEcoreWl2>(
211211
window_geometry, window_properties.transparent,
212-
window_properties.focusable, window_properties.top_level);
212+
window_properties.focusable, window_properties.top_level,
213+
window_properties.window_handle);
213214
}
214215

215216
auto view = std::make_unique<flutter::FlutterTizenView>(

flutter/shell/platform/tizen/public/flutter_tizen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ typedef struct {
6767
FlutterDesktopExternalOutputType external_output_type;
6868
// The user-defined pixel ratio.
6969
double user_pixel_ratio;
70+
// The precreated window handle.
71+
void* window_handle;
7072
} FlutterDesktopWindowProperties;
7173

7274
// Properties for configuring the initial settings of a Flutter view.

flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ FlutterPointerDeviceKind ToFlutterDeviceKind(const Ecore_Device* dev) {
5252
TizenWindowEcoreWl2::TizenWindowEcoreWl2(TizenGeometry geometry,
5353
bool transparent,
5454
bool focusable,
55-
bool top_level)
55+
bool top_level,
56+
void* window_handle = nullptr)
5657
: TizenWindow(geometry, transparent, focusable, top_level) {
57-
if (!CreateWindow()) {
58+
if (!CreateWindow(window_handle)) {
5859
FT_LOG(Error) << "Failed to create a platform window.";
5960
return;
6061
}
@@ -70,7 +71,7 @@ TizenWindowEcoreWl2::~TizenWindowEcoreWl2() {
7071
DestroyWindow();
7172
}
7273

73-
bool TizenWindowEcoreWl2::CreateWindow() {
74+
bool TizenWindowEcoreWl2::CreateWindow(void* window_handle) {
7475
if (!ecore_wl2_init()) {
7576
FT_LOG(Error) << "Could not initialize Ecore Wl2.";
7677
return false;
@@ -99,9 +100,14 @@ bool TizenWindowEcoreWl2::CreateWindow() {
99100
initial_geometry_.height = height;
100101
}
101102

102-
ecore_wl2_window_ = ecore_wl2_window_new(
103-
ecore_wl2_display_, nullptr, initial_geometry_.left,
104-
initial_geometry_.top, initial_geometry_.width, initial_geometry_.height);
103+
if (window_handle == nullptr) {
104+
ecore_wl2_window_ =
105+
ecore_wl2_window_new(ecore_wl2_display_, nullptr,
106+
initial_geometry_.left, initial_geometry_.top,
107+
initial_geometry_.width, initial_geometry_.height);
108+
} else {
109+
ecore_wl2_window_ = static_cast<Ecore_Wl2_Window*>(window_handle);
110+
}
105111

106112
ecore_wl2_egl_window_ = ecore_wl2_egl_window_create(
107113
ecore_wl2_window_, initial_geometry_.width, initial_geometry_.height);

flutter/shell/platform/tizen/tizen_window_ecore_wl2.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class TizenWindowEcoreWl2 : public TizenWindow {
2222
TizenWindowEcoreWl2(TizenGeometry geometry,
2323
bool transparent,
2424
bool focusable,
25-
bool top_level);
25+
bool top_level,
26+
void* window_handle);
2627

2728
~TizenWindowEcoreWl2();
2829

@@ -55,7 +56,7 @@ class TizenWindowEcoreWl2 : public TizenWindow {
5556
void UpdateFlutterCursor(const std::string& kind) override;
5657

5758
private:
58-
bool CreateWindow();
59+
bool CreateWindow(void* window_handle);
5960

6061
void DestroyWindow();
6162

0 commit comments

Comments
 (0)