Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ template("embedder") {
"capi-base-common",
"capi-system-info",
"capi-system-system-settings",
"capi-ui-efl-util",
"dlog",
"feedback",
"tbm",
Expand Down Expand Up @@ -201,7 +202,10 @@ template("embedder") {
"tizen_vsync_waiter.cc",
]

libs += [ "ecore_wl2" ]
libs += [
"ecore_wl2",
"tizen-extension-client",
]
}

public_deps = [ ":flutter_engine" ]
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FlutterDesktopEngineRef FlutterDesktopRunEngine(
engine->InitializeRenderer(
window_properties.x, window_properties.y, window_properties.width,
window_properties.height, window_properties.transparent,
window_properties.focusable);
window_properties.focusable, window_properties.top_level);
}
if (!engine->RunEngine(engine_properties.entrypoint)) {
FT_LOG(Error) << "Failed to start the Flutter engine.";
Expand Down
11 changes: 6 additions & 5 deletions shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ void FlutterTizenEngine::InitializeRenderer(int32_t x,
int32_t width,
int32_t height,
bool transparent,
bool focusable) {
bool focusable,
bool top_level) {
TizenRenderer::WindowGeometry geometry = {x, y, width, height};

#ifdef TIZEN_RENDERER_EVAS_GL
renderer_ = std::make_unique<TizenRendererEvasGL>(geometry, transparent,
focusable, *this);
renderer_ = std::make_unique<TizenRendererEvasGL>(
geometry, transparent, focusable, top_level, *this);

render_loop_ = std::make_unique<TizenRenderEventLoop>(
std::this_thread::get_id(), // main thread
Expand All @@ -105,8 +106,8 @@ void FlutterTizenEngine::InitializeRenderer(int32_t x,
},
renderer_.get());
#else
renderer_ = std::make_unique<TizenRendererEcoreWl2>(geometry, transparent,
focusable, *this);
renderer_ = std::make_unique<TizenRendererEcoreWl2>(
geometry, transparent, focusable, top_level, *this);

tizen_vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this);
#endif
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/tizen/flutter_tizen_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class FlutterTizenEngine : public TizenRenderer::Delegate {
int32_t width,
int32_t height,
bool transparent,
bool focusable);
bool focusable,
bool top_level);

// Starts running the engine with the given entrypoint. If null, defaults to
// main().
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/flutter_tizen_engine_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FlutterTizenEngineTestHeaded : public FlutterTizenEngineTest {
protected:
void SetUp() {
FlutterTizenEngineTest::SetUp();
engine_->InitializeRenderer(0, 0, 800, 600, false, true);
engine_->InitializeRenderer(0, 0, 800, 600, false, true, false);
}
};

Expand Down
2 changes: 2 additions & 0 deletions shell/platform/tizen/public/flutter_tizen.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ typedef struct {
bool transparent;
// Whether the window should be focusable or not.
bool focusable;
// Whether the window should be on top layer or not.
bool top_level;
} FlutterDesktopWindowProperties;

// Properties for configuring a Flutter engine instance.
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/tizen/tizen_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ namespace flutter {
TizenRenderer::TizenRenderer(WindowGeometry geometry,
bool transparent,
bool focusable,
bool top_level,
Delegate& delegate)
: initial_geometry_(geometry),
transparent_(transparent),
focusable_(focusable),
top_level_(top_level),
delegate_(delegate) {}

TizenRenderer::~TizenRenderer() = default;
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/tizen/tizen_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ class TizenRenderer {
explicit TizenRenderer(WindowGeometry geometry,
bool transparent,
bool focusable,
bool top_level,
Delegate& delegate);

WindowGeometry initial_geometry_;
bool transparent_;
bool focusable_;
bool top_level_;
Delegate& delegate_;

bool is_valid_ = false;
Expand Down
46 changes: 44 additions & 2 deletions shell/platform/tizen/tizen_renderer_ecore_wl2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ namespace flutter {
TizenRendererEcoreWl2::TizenRendererEcoreWl2(WindowGeometry geometry,
bool transparent,
bool focusable,
bool top_level,
Delegate& delegate)
: TizenRenderer(geometry, transparent, focusable, delegate) {
: TizenRenderer(geometry, transparent, focusable, top_level, delegate) {
InitializeRenderer();
}

Expand Down Expand Up @@ -296,7 +297,18 @@ bool TizenRendererEcoreWl2::SetupEcoreWlWindow(int32_t width, int32_t height) {

ecore_wl2_window_ =
ecore_wl2_window_new(ecore_wl2_display_, nullptr, x, y, width, height);
ecore_wl2_window_type_set(ecore_wl2_window_, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);

// Change the window type to use the tizen policy for notification window
// according to top_level_.
// Note: ECORE_WL2_WINDOW_TYPE_TOPLEVEL is similar to "ELM_WIN_BASIC" and it
// does not mean that the window always will be overlaid on other apps :(
ecore_wl2_window_type_set(ecore_wl2_window_,
top_level_ ? ECORE_WL2_WINDOW_TYPE_NOTIFICATION
: ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
if (top_level_) {
SetTizenPolicyNotificationLevel(TIZEN_POLICY_LEVEL_TOP);
}

ecore_wl2_window_position_set(ecore_wl2_window_, x, y);
ecore_wl2_window_aux_hint_add(ecore_wl2_window_, 0,
"wm.policy.win.user.geometry", "1");
Expand Down Expand Up @@ -564,4 +576,34 @@ bool TizenRendererEcoreWl2::IsSupportedExtention(const char* name) {
return false;
}

void TizenRendererEcoreWl2::SetTizenPolicyNotificationLevel(int level) {
Eina_Iterator* iter = ecore_wl2_display_globals_get(ecore_wl2_display_);
struct wl_registry* registry =
ecore_wl2_display_registry_get(ecore_wl2_display_);

if (iter && registry) {
Ecore_Wl2_Global* global = nullptr;

// Retrieve global objects to bind tizen policy
EINA_ITERATOR_FOREACH(iter, global) {
if (strcmp(global->interface, tizen_policy_interface.name) == 0) {
tizen_policy_ = static_cast<tizen_policy*>(
wl_registry_bind(registry, global->id, &tizen_policy_interface, 1));
break;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'itr' may be destroyed by eina_iterator_free

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the below note. Thank you.

Note
The caller of this function should free the returned Eina_Iterator when finished with it.

}
eina_iterator_free(iter);

if (tizen_policy_ == nullptr) {
FT_LOG(Error)
<< "Failed to initialize the tizen policy handle, the top_level "
"attribute is ignored.";
return;
}

tizen_policy_set_notification_level(
tizen_policy_, ecore_wl2_window_surface_get(ecore_wl2_window_), level);
}

} // namespace flutter
6 changes: 6 additions & 0 deletions shell/platform/tizen/tizen_renderer_ecore_wl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define EFL_BETA_API_SUPPORT
#include <EGL/egl.h>
#include <Ecore_Wl2.h>
#include <tizen-extension-client-protocol.h>

#include <string>

#include "flutter/shell/platform/tizen/tizen_renderer.h"
Expand All @@ -19,6 +21,7 @@ class TizenRendererEcoreWl2 : public TizenRenderer {
explicit TizenRendererEcoreWl2(WindowGeometry geometry,
bool transparent,
bool focusable,
bool top_level,
Delegate& delegate);
virtual ~TizenRendererEcoreWl2();

Expand Down Expand Up @@ -61,6 +64,7 @@ class TizenRendererEcoreWl2 : public TizenRenderer {
bool ChooseEGLConfiguration();
void PrintEGLError();
void DestroyEglSurface();
void SetTizenPolicyNotificationLevel(int level);

static Eina_Bool RotationEventCb(void* data, int type, void* event);
void SendRotationChangeDone();
Expand All @@ -77,6 +81,8 @@ class TizenRendererEcoreWl2 : public TizenRenderer {
EGLSurface egl_resource_surface_ = EGL_NO_SURFACE;

std::string egl_extention_str_;

tizen_policy* tizen_policy_ = nullptr;
};

} // namespace flutter
Expand Down
16 changes: 14 additions & 2 deletions shell/platform/tizen/tizen_renderer_evas_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ EVAS_GL_GLOBAL_GLES3_DEFINE();

#include "flutter/shell/platform/tizen/logger.h"

#ifndef __X64_SHELL__
#include <ui/efl_util.h>
#endif

namespace flutter {

TizenRendererEvasGL::TizenRendererEvasGL(WindowGeometry geometry,
bool transparent,
bool focusable,
bool top_level,
Delegate& delegate)
: TizenRenderer(geometry, transparent, focusable, delegate) {
: TizenRenderer(geometry, transparent, focusable, top_level, delegate) {
InitializeRenderer();

// Clear once to remove noise.
Expand Down Expand Up @@ -639,10 +644,17 @@ Evas_Object* TizenRendererEvasGL::SetupEvasWindow(int32_t* width,
int32_t* height) {
elm_config_accel_preference_set("hw:opengl");

evas_window_ = elm_win_add(NULL, NULL, ELM_WIN_BASIC);
evas_window_ = elm_win_add(NULL, NULL,
top_level_ ? ELM_WIN_NOTIFICATION : ELM_WIN_BASIC);
if (!evas_window_) {
return nullptr;
}
#ifndef __X64_SHELL__
if (top_level_) {
efl_util_set_notification_window_level(evas_window_,
EFL_UTIL_NOTIFICATION_LEVEL_TOP);
}
#endif
auto* ecore_evas =
ecore_evas_ecore_evas_get(evas_object_evas_get(evas_window_));

Expand Down
1 change: 1 addition & 0 deletions shell/platform/tizen/tizen_renderer_evas_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class TizenRendererEvasGL : public TizenRenderer {
explicit TizenRendererEvasGL(WindowGeometry geometry,
bool transparent,
bool focusable,
bool top_level,
Delegate& delegate);
virtual ~TizenRendererEvasGL();

Expand Down