Skip to content
Draft
3 changes: 3 additions & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ declare_args() {

# Use the system libstdc++ without building third_party/libcxx from source.
use_system_cxx = false

# Use tizen-core-wl API instead of ecore.
use_tcore = false
}

_default_configs = [
Expand Down
78 changes: 62 additions & 16 deletions flutter/shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ config("flutter_tizen_config") {
"${sysroot_path}/usr/include/dali-adaptor",
"${sysroot_path}/usr/include/dali-toolkit",
"${sysroot_path}/usr/include/dlog",
"${sysroot_path}/usr/include/ecore-1",
"${sysroot_path}/usr/include/ecore-imf-1",
"${sysroot_path}/usr/include/ecore-input-1",
"${sysroot_path}/usr/include/ecore-wayland-1",
"${sysroot_path}/usr/include/ecore-wl2-1",
"${sysroot_path}/usr/include/efl-1",
"${sysroot_path}/usr/include/eina-1",
"${sysroot_path}/usr/include/eina-1/eina",
"${sysroot_path}/usr/include/eo-1",
"${sysroot_path}/usr/include/feedback",
"${sysroot_path}/usr/include/system",
"${sysroot_path}/usr/include/tzsh",
Expand All @@ -35,6 +26,28 @@ config("flutter_tizen_config") {
"${sysroot_path}/usr/lib/glib-2.0/include",
]

# tcore-specific includes
if (use_tcore) {
include_dirs += [
"${sysroot_path}/usr/include/tizen-core",
"${sysroot_path}/usr/include/tizen-core-imf",
"${sysroot_path}/usr/include/tizen-core-wl",
]
} else {
# ecore-specific includes
include_dirs += [
"${sysroot_path}/usr/include/ecore-1",
"${sysroot_path}/usr/include/ecore-imf-1",
"${sysroot_path}/usr/include/ecore-input-1",
"${sysroot_path}/usr/include/ecore-wayland-1",
"${sysroot_path}/usr/include/ecore-wl2-1",
"${sysroot_path}/usr/include/efl-1",
"${sysroot_path}/usr/include/eina-1",
"${sysroot_path}/usr/include/eina-1/eina",
"${sysroot_path}/usr/include/eo-1",
]
}

cflags_cc = [
"-Wno-newline-eof",
"-Wno-macro-redefined",
Expand Down Expand Up @@ -93,14 +106,25 @@ template("embedder") {
"logger.cc",
"system_utils.cc",
"tizen_event_loop.cc",
"tizen_input_method_context.cc",
"tizen_renderer.cc",
"tizen_renderer_egl.cc",
"tizen_renderer_gl.cc",
"tizen_vsync_waiter.cc",
"tizen_window_ecore_wl2.cc",
]

# Select window implementation based on use_tcore
if (use_tcore) {
sources += [
"tizen_input_method_context_tcore.cc",
"tizen_window_tcore_wl.cc",
]
} else {
sources += [
"tizen_input_method_context.cc",
"tizen_window_ecore_wl2.cc",
]
}

lib_dirs = [ "//engine/${target_cpu}" ]

libs = [
Expand All @@ -113,11 +137,7 @@ template("embedder") {
"capi-system-info",
"capi-system-system-settings",
"dlog",
"ecore",
"ecore_imf",
"ecore_input",
"ecore_wl2",
"eina",
"glib-2.0",
"gio-2.0",
"feedback",
"flutter_engine",
Expand All @@ -130,6 +150,23 @@ template("embedder") {
"GLESv2",
]

# tcore-specific or ecore-specific libraries
if (use_tcore) {
libs += [
"tizen-core",
"tizen-core-imf",
"tizen-core-wl",
]
} else {
libs += [
"ecore",
"ecore_imf",
"ecore_input",
"ecore_wl2",
"eina",
]
}

if (target_name == "flutter_tizen_common" ||
target_name == "flutter_tizen_common_experimental") {
sources += [ "channels/tizen_shell.cc" ]
Expand All @@ -143,6 +180,11 @@ template("embedder") {
defines += invoker.defines
defines += [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]

# Add USE_TCORE_WL define when using tcore
if (use_tcore) {
defines += [ "USE_TCORE_WL" ]
}

if (target_name == "flutter_tizen_mobile_experimental" ||
target_name == "flutter_tizen_tv_experimental" ||
target_name == "flutter_tizen_common_experimental") {
Expand Down Expand Up @@ -255,6 +297,10 @@ executable("flutter_tizen_unittests") {

ldflags = [ "-Wl,--unresolved-symbols=ignore-in-shared-libs" ]

if (use_tcore) {
defines = [ "USE_TCORE_WL" ]
}

configs += [ ":flutter_tizen_config" ]

deps += [
Expand Down
4 changes: 4 additions & 0 deletions flutter/shell/platform/tizen/channels/input_panel_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include "flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_method_codec.h"
#include "flutter/shell/platform/tizen/logger.h"
#ifdef USE_TCORE_WL
#include "flutter/shell/platform/tizen/tizen_input_method_context_tcore.h"
#else
#include "flutter/shell/platform/tizen/tizen_input_method_context.h"
#endif

namespace {

Expand Down
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/channels/key_mapping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ std::map<uint32_t, uint32_t> kScanCodeToGtkKeyCode = {
{0x0000024d, 269025069}, // launchScreenSaver
};

std::map<int, int> kEcoreModifierToGtkModifier = {
std::map<int, int> kModifierToGtkModifier = {
{0x0001, 1 << 0}, // SHIFT -> modifierShift
{0x0002, 1 << 2}, // CTRL -> modifierControl
{0x0004, 1 << 3}, // ALT -> modifierMod1
Expand Down
10 changes: 5 additions & 5 deletions flutter/shell/platform/tizen/channels/key_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
// legacy RawKeyboard API is removed from the framework in the future.
extern std::map<uint32_t, uint32_t> kScanCodeToGtkKeyCode;

// Maps Ecore modifiers to GTK modifiers.
// Maps Tizen modifier bitmask values to GTK modifiers.
//
// The values are originally defined in:
// - efl/Ecore_Input.h
// - flutter/raw_keyboard_linux.dart (GtkKeyHelper)
// The modifier bitmask values match tizen_core_wl_modifier_e.
// The GTK modifier values are from flutter/raw_keyboard_linux.dart
// (GtkKeyHelper).
//
// Provided only for backward compatibility. This will be removed after the
// legacy RawKeyboard API is removed from the framework in the future.
extern std::map<int, int> kEcoreModifierToGtkModifier;
extern std::map<int, int> kModifierToGtkModifier;

// Maps XKB scan codes to Flutter's physical key codes.
//
Expand Down
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/channels/keyboard_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void KeyboardChannel::SendChannelEvent(const char* key,
}

int gtk_modifiers = 0;
for (auto element : kEcoreModifierToGtkModifier) {
for (auto element : kModifierToGtkModifier) {
if (element.first & modifiers) {
gtk_modifiers |= element.second;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ bool TextInputChannel::HandleKey(const char* key,
return true;
#endif
} else {
FT_LOG(Info) << "Key[" << key << "] is unhandled.";
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions flutter/shell/platform/tizen/channels/text_input_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h"
#include "flutter/shell/platform/common/text_input_model.h"
#ifdef USE_TCORE_WL
#include "flutter/shell/platform/tizen/tizen_input_method_context_tcore.h"
#else
#include "flutter/shell/platform/tizen/tizen_input_method_context.h"
#endif
#include "rapidjson/document.h"

namespace flutter {
Expand Down
4 changes: 4 additions & 0 deletions flutter/shell/platform/tizen/channels/window_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#include "flutter/shell/platform/tizen/channels/encodable_value_holder.h"
#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/tizen_window.h"
#ifdef USE_TCORE_WL
#include "flutter/shell/platform/tizen/tizen_window_tcore_wl.h"
#else
#include "flutter/shell/platform/tizen/tizen_window_ecore_wl2.h"
#endif

namespace flutter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// found in the LICENSE file.

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

#include <unistd.h>

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

namespace flutter {
Expand Down
13 changes: 13 additions & 0 deletions flutter/shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
#include "flutter/shell/platform/tizen/tizen_view_nui.h"
#endif
#include "flutter/shell/platform/tizen/tizen_window.h"
#ifdef USE_TCORE_WL
#include "flutter/shell/platform/tizen/tizen_window_tcore_wl.h"
#else
#include "flutter/shell/platform/tizen/tizen_window_ecore_wl2.h"
#endif

namespace {

Expand Down Expand Up @@ -201,12 +205,21 @@ FlutterDesktopViewRef FlutterDesktopViewCreateFromNewWindow(

std::unique_ptr<flutter::TizenWindow> window;

#ifdef USE_TCORE_WL
window = std::make_unique<flutter::TizenWindowTcoreWl>(
window_geometry, window_properties.transparent,
window_properties.focusable, window_properties.top_level,
window_properties.pointing_device_support,
window_properties.floating_menu_support, window_properties.window_handle,
window_properties.renderer_type == kEVulkan);
#else
window = std::make_unique<flutter::TizenWindowEcoreWl2>(
window_geometry, window_properties.transparent,
window_properties.focusable, window_properties.top_level,
window_properties.pointing_device_support,
window_properties.floating_menu_support, window_properties.window_handle,
window_properties.renderer_type == kEVulkan);
#endif

auto view = std::make_unique<flutter::FlutterTizenView>(
flutter::kImplicitViewId, std::move(window),
Expand Down
12 changes: 5 additions & 7 deletions flutter/shell/platform/tizen/flutter_tizen_display_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <Ecore.h>
#include <system_info.h>

#include "flutter/shell/platform/tizen/flutter_tizen_display_monitor.h"
Expand All @@ -29,12 +28,11 @@ void FlutterTizenDisplayMonitor::UpdateDisplays() {
display.display_id = 0;
display.single_display = true;

double fps = ecore_animator_frametime_get();
if (fps <= 0.0) {
display.refresh_rate = 0.0;
} else {
display.refresh_rate = 1 / fps;
}
// TODO(jsuya): Default to 60Hz refresh rate. The previous implementation
// used ecore_animator_frametime_get(), which is no longer available after
// dropping the Ecore dependency. Replace this once tizen-core (or another
// public Tizen API) exposes a way to query the display refresh rate.
display.refresh_rate = 60.0;

int32_t width = 0, height = 0, dpi = 0;
FlutterTizenView* view = engine_->view();
Expand Down
4 changes: 4 additions & 0 deletions flutter/shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#include "flutter/shell/platform/tizen/flutter_tizen_view.h"
#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/system_utils.h"
#ifdef USE_TCORE_WL
#include "flutter/shell/platform/tizen/tizen_input_method_context_tcore.h"
#else
#include "flutter/shell/platform/tizen/tizen_input_method_context.h"
#endif
#include "flutter/shell/platform/tizen/tizen_renderer_egl.h"

#ifdef FLUTTER_TIZEN_EXPERIMENTAL
Expand Down
12 changes: 11 additions & 1 deletion flutter/shell/platform/tizen/flutter_tizen_engine_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

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

#ifdef USE_TCORE_WL
#include <tizen_core_wl.h>
#else
#include <Ecore.h>
#endif

#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
#include "flutter/shell/platform/tizen/testing/engine_modifier.h"
Expand All @@ -15,7 +19,13 @@ namespace testing {

class FlutterTizenEngineTest : public ::testing::Test {
public:
FlutterTizenEngineTest() { ecore_init(); }
FlutterTizenEngineTest() {
#ifdef USE_TCORE_WL
tizen_core_wl_init();
#else
ecore_init();
#endif
}

protected:
void SetUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

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

#ifdef USE_TCORE_WL
#include <tizen_core_wl.h>
#else
#include <Ecore.h>
#endif

#include <iostream>

Expand All @@ -18,7 +22,13 @@ namespace testing {

class FlutterTizenTextureRegistrarTest : public ::testing::Test {
public:
FlutterTizenTextureRegistrarTest() { ecore_init(); }
FlutterTizenTextureRegistrarTest() {
#ifdef USE_TCORE_WL
tizen_core_wl_init();
#else
ecore_init();
#endif
}

protected:
void SetUp() {
Expand Down
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/public/flutter_tizen.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ FLUTTER_EXPORT void FlutterDesktopViewDestroy(FlutterDesktopViewRef view);
// Returns a native UI toolkit handle for manipulation in host application.
//
// Cast the returned void*
// - window ecore wl2 : to Ecore_Wl2_Window*
// - window ecore wl2 : to tizen_core_wl_window_h
// @warning This API is a work-in-progress and may change.
FLUTTER_EXPORT void* FlutterDesktopViewGetNativeHandle(
FlutterDesktopViewRef view);
Expand Down
Loading
Loading