From d59781bb2f70d6c4925b5e3f773661e4db1f9bf8 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Thu, 15 Sep 2022 16:44:37 +0900 Subject: [PATCH 1/9] Support software keyboard input Converts key event information from NUI to ecore_imf_event and delivers it. --- shell/platform/tizen/flutter_tizen.cc | 4 +- shell/platform/tizen/flutter_tizen_view.cc | 9 +++++ shell/platform/tizen/flutter_tizen_view.h | 7 ++++ .../tizen/tizen_input_method_context.cc | 40 +++++++++++++++++++ .../tizen/tizen_input_method_context.h | 6 +++ shell/platform/tizen/tizen_view_base.h | 7 ++++ shell/platform/tizen/tizen_view_elementary.cc | 9 +++++ shell/platform/tizen/tizen_view_elementary.h | 7 ++++ shell/platform/tizen/tizen_view_nui.cc | 18 +++++++++ shell/platform/tizen/tizen_view_nui.h | 7 ++++ shell/platform/tizen/tizen_window.h | 10 +++++ 11 files changed, 122 insertions(+), 2 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index a41b0b9202362..9549cb5c2b7a2 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -271,8 +271,8 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, uint32_t modifiers, uint32_t scan_code, bool is_down) { - ViewFromHandle(view)->OnKey(key, string, nullptr, modifiers, scan_code, - is_down); + ViewFromHandle(view)->KeyEvent(key, string, nullptr, modifiers, scan_code, + is_down); } void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, bool focused) { diff --git a/shell/platform/tizen/flutter_tizen_view.cc b/shell/platform/tizen/flutter_tizen_view.cc index eab7f64463293..2dd6662811737 100644 --- a/shell/platform/tizen/flutter_tizen_view.cc +++ b/shell/platform/tizen/flutter_tizen_view.cc @@ -113,6 +113,15 @@ void FlutterTizenView::DestroyRenderSurface() { } } +void FlutterTizenView::KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) { + tizen_view_->KeyEvent(key, string, compose, modifiers, scan_code, is_down); +} + void FlutterTizenView::Resize(int32_t width, int32_t height) { TizenGeometry geometry = tizen_view_->GetGeometry(); geometry.width = width; diff --git a/shell/platform/tizen/flutter_tizen_view.h b/shell/platform/tizen/flutter_tizen_view.h index 2b1501a177939..8e0651271c9a6 100644 --- a/shell/platform/tizen/flutter_tizen_view.h +++ b/shell/platform/tizen/flutter_tizen_view.h @@ -41,6 +41,13 @@ class FlutterTizenView : public TizenViewEventHandlerDelegate { // Destroys current rendering surface if one has been allocated. void DestroyRenderSurface(); + void KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down); + void Resize(int32_t width, int32_t height); // Callbacks for clearing context, settings context and swapping buffers, diff --git a/shell/platform/tizen/tizen_input_method_context.cc b/shell/platform/tizen/tizen_input_method_context.cc index 02505561a9419..42151d4ef0bc8 100644 --- a/shell/platform/tizen/tizen_input_method_context.cc +++ b/shell/platform/tizen/tizen_input_method_context.cc @@ -113,6 +113,22 @@ T EcoreEventKeyToEcoreImfEvent(Ecore_Event_Key* event) { return imf_event; } +template +T NUIEventKeyToEcoreImfEvent(const char* key, + const char* string, + uint32_t modifiers, + uint32_t scan_code) { + T imf_event; + + imf_event.key = key; + imf_event.string = string; + imf_event.modifiers = EcoreInputModifiersToEcoreImfModifiers(modifiers); + imf_event.locks = EcoreInputModifiersToEcoreImfLocks(modifiers); + imf_event.keycode = scan_code; + + return imf_event; +} + } // namespace namespace flutter { @@ -191,6 +207,30 @@ bool TizenInputMethodContext::HandleEvasEventKeyUp(Evas_Event_Key_Up* event) { reinterpret_cast(&imf_event)); } +bool TizenInputMethodContext::HandleNUIEventKey(const char* key, + const char* string, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) { + if (is_down) { + Ecore_IMF_Event_Key_Down imf_event = + NUIEventKeyToEcoreImfEvent( + key, string, modifiers, scan_code); + + return ecore_imf_context_filter_event( + imf_context_, ECORE_IMF_EVENT_KEY_DOWN, + reinterpret_cast(&imf_event)); + } else { + Ecore_IMF_Event_Key_Up imf_event = + NUIEventKeyToEcoreImfEvent( + key, string, modifiers, scan_code); + + return ecore_imf_context_filter_event( + imf_context_, ECORE_IMF_EVENT_KEY_UP, + reinterpret_cast(&imf_event)); + } +} + InputPanelGeometry TizenInputMethodContext::GetInputPanelGeometry() { FT_ASSERT(imf_context_); InputPanelGeometry geometry; diff --git a/shell/platform/tizen/tizen_input_method_context.h b/shell/platform/tizen/tizen_input_method_context.h index b94ddb1538a09..bee188aeb90da 100644 --- a/shell/platform/tizen/tizen_input_method_context.h +++ b/shell/platform/tizen/tizen_input_method_context.h @@ -35,6 +35,12 @@ class TizenInputMethodContext { bool HandleEvasEventKeyUp(Evas_Event_Key_Up* event); + bool HandleNUIEventKey(const char* key, + const char* string, + uint32_t modifiers, + uint32_t scan_code, + bool is_down); + InputPanelGeometry GetInputPanelGeometry(); void ResetInputMethodContext(); diff --git a/shell/platform/tizen/tizen_view_base.h b/shell/platform/tizen/tizen_view_base.h index 3f3f6190ac6cb..ae7fe3b53a67e 100644 --- a/shell/platform/tizen/tizen_view_base.h +++ b/shell/platform/tizen/tizen_view_base.h @@ -43,6 +43,13 @@ class TizenViewBase { // Returns the dpi of the screen. virtual int32_t GetDpi() = 0; + virtual void KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) = 0; + // Sets the delegate used to communicate state changes from render target to // view such as key presses, mouse position updates etc. void SetView(TizenViewEventHandlerDelegate* view_delegate) { diff --git a/shell/platform/tizen/tizen_view_elementary.cc b/shell/platform/tizen/tizen_view_elementary.cc index 037d00a26f87b..17ac3796837a6 100644 --- a/shell/platform/tizen/tizen_view_elementary.cc +++ b/shell/platform/tizen/tizen_view_elementary.cc @@ -339,6 +339,15 @@ void TizenViewElementary::Show() { evas_object_show(image_); } +void TizenViewElementary::KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) { + FT_UNIMPLEMENTED(); +} + void TizenViewElementary::PrepareInputMethod() { input_method_context_ = std::make_unique(GetWindowId()); diff --git a/shell/platform/tizen/tizen_view_elementary.h b/shell/platform/tizen/tizen_view_elementary.h index 27b8aeb18e514..2c9b4e931f1a1 100644 --- a/shell/platform/tizen/tizen_view_elementary.h +++ b/shell/platform/tizen/tizen_view_elementary.h @@ -37,6 +37,13 @@ class TizenViewElementary : public TizenView { void Show() override; + void KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) override; + private: bool CreateView(); diff --git a/shell/platform/tizen/tizen_view_nui.cc b/shell/platform/tizen/tizen_view_nui.cc index 2cb180738ec77..ba43770932596 100644 --- a/shell/platform/tizen/tizen_view_nui.cc +++ b/shell/platform/tizen/tizen_view_nui.cc @@ -74,6 +74,24 @@ void TizenViewNui::RequestRendering() { rendering_callback_->Trigger(); } +void TizenViewNui::KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) { + bool handled = false; + + if (input_method_context_->IsInputPanelShown()) { + handled = input_method_context_->HandleNUIEventKey(key, string, modifiers, + scan_code, is_down); + } + + if (!handled) { + view_delegate_->OnKey(key, string, nullptr, modifiers, scan_code, is_down); + } +} + void TizenViewNui::PrepareInputMethod() { input_method_context_ = std::make_unique(GetWindowId()); diff --git a/shell/platform/tizen/tizen_view_nui.h b/shell/platform/tizen/tizen_view_nui.h index 83d39e65e0f78..20e3be39743f7 100644 --- a/shell/platform/tizen/tizen_view_nui.h +++ b/shell/platform/tizen/tizen_view_nui.h @@ -42,6 +42,13 @@ class TizenViewNui : public TizenView { void RequestRendering(); + void KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) override; + private: void RegisterEventHandlers(); diff --git a/shell/platform/tizen/tizen_window.h b/shell/platform/tizen/tizen_window.h index a78793f062b20..0729bbc9d0ffb 100644 --- a/shell/platform/tizen/tizen_window.h +++ b/shell/platform/tizen/tizen_window.h @@ -8,6 +8,7 @@ #include #include +#include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/tizen_view_base.h" namespace flutter { @@ -32,6 +33,15 @@ class TizenWindow : public TizenViewBase { TizenViewType GetType() override { return TizenViewType::kWindow; }; + void KeyEvent(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) override { + FT_UNIMPLEMENTED(); + }; + protected: explicit TizenWindow(TizenGeometry geometry, bool transparent, From d6e4a0655d9684bfd10af448208b68c7e4ca8534 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Thu, 22 Sep 2022 17:21:42 +0900 Subject: [PATCH 2/9] Update based on review --- shell/platform/tizen/flutter_tizen.cc | 8 ++++++-- shell/platform/tizen/flutter_tizen_view.cc | 9 --------- shell/platform/tizen/flutter_tizen_view.h | 7 ------- shell/platform/tizen/tizen_input_method_context.cc | 10 ++++------ shell/platform/tizen/tizen_input_method_context.h | 2 +- shell/platform/tizen/tizen_view.h | 7 +++++++ shell/platform/tizen/tizen_view_base.h | 7 ------- shell/platform/tizen/tizen_view_elementary.cc | 14 +++++++------- shell/platform/tizen/tizen_view_elementary.h | 12 ++++++------ shell/platform/tizen/tizen_view_nui.cc | 14 +++++++------- shell/platform/tizen/tizen_view_nui.h | 12 ++++++------ shell/platform/tizen/tizen_window.h | 9 --------- 12 files changed, 44 insertions(+), 67 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 9549cb5c2b7a2..8603261ad50a1 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -271,8 +271,12 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, uint32_t modifiers, uint32_t scan_code, bool is_down) { - ViewFromHandle(view)->KeyEvent(key, string, nullptr, modifiers, scan_code, - is_down); + auto* tizen_view = reinterpret_cast( + ViewFromHandle(view)->tizen_view()); + if (tizen_view->GetType() == flutter::TizenViewType::kView) { + reinterpret_cast(tizen_view) + ->OnKey(key, string, nullptr, modifiers, scan_code, is_down); + } } void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, bool focused) { diff --git a/shell/platform/tizen/flutter_tizen_view.cc b/shell/platform/tizen/flutter_tizen_view.cc index 2dd6662811737..eab7f64463293 100644 --- a/shell/platform/tizen/flutter_tizen_view.cc +++ b/shell/platform/tizen/flutter_tizen_view.cc @@ -113,15 +113,6 @@ void FlutterTizenView::DestroyRenderSurface() { } } -void FlutterTizenView::KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) { - tizen_view_->KeyEvent(key, string, compose, modifiers, scan_code, is_down); -} - void FlutterTizenView::Resize(int32_t width, int32_t height) { TizenGeometry geometry = tizen_view_->GetGeometry(); geometry.width = width; diff --git a/shell/platform/tizen/flutter_tizen_view.h b/shell/platform/tizen/flutter_tizen_view.h index 8e0651271c9a6..2b1501a177939 100644 --- a/shell/platform/tizen/flutter_tizen_view.h +++ b/shell/platform/tizen/flutter_tizen_view.h @@ -41,13 +41,6 @@ class FlutterTizenView : public TizenViewEventHandlerDelegate { // Destroys current rendering surface if one has been allocated. void DestroyRenderSurface(); - void KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down); - void Resize(int32_t width, int32_t height); // Callbacks for clearing context, settings context and swapping buffers, diff --git a/shell/platform/tizen/tizen_input_method_context.cc b/shell/platform/tizen/tizen_input_method_context.cc index 42151d4ef0bc8..fcc0af101ab54 100644 --- a/shell/platform/tizen/tizen_input_method_context.cc +++ b/shell/platform/tizen/tizen_input_method_context.cc @@ -114,7 +114,7 @@ T EcoreEventKeyToEcoreImfEvent(Ecore_Event_Key* event) { } template -T NUIEventKeyToEcoreImfEvent(const char* key, +T NuiEventKeyToEcoreImfEvent(const char* key, const char* string, uint32_t modifiers, uint32_t scan_code) { @@ -207,24 +207,22 @@ bool TizenInputMethodContext::HandleEvasEventKeyUp(Evas_Event_Key_Up* event) { reinterpret_cast(&imf_event)); } -bool TizenInputMethodContext::HandleNUIEventKey(const char* key, +bool TizenInputMethodContext::HandleNuiEventKey(const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, bool is_down) { if (is_down) { Ecore_IMF_Event_Key_Down imf_event = - NUIEventKeyToEcoreImfEvent( + NuiEventKeyToEcoreImfEvent( key, string, modifiers, scan_code); - return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_DOWN, reinterpret_cast(&imf_event)); } else { Ecore_IMF_Event_Key_Up imf_event = - NUIEventKeyToEcoreImfEvent( + NuiEventKeyToEcoreImfEvent( key, string, modifiers, scan_code); - return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_UP, reinterpret_cast(&imf_event)); diff --git a/shell/platform/tizen/tizen_input_method_context.h b/shell/platform/tizen/tizen_input_method_context.h index bee188aeb90da..d9eb4c355b9a6 100644 --- a/shell/platform/tizen/tizen_input_method_context.h +++ b/shell/platform/tizen/tizen_input_method_context.h @@ -35,7 +35,7 @@ class TizenInputMethodContext { bool HandleEvasEventKeyUp(Evas_Event_Key_Up* event); - bool HandleNUIEventKey(const char* key, + bool HandleNuiEventKey(const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, diff --git a/shell/platform/tizen/tizen_view.h b/shell/platform/tizen/tizen_view.h index d9979632c634e..1454bb1f16ce9 100644 --- a/shell/platform/tizen/tizen_view.h +++ b/shell/platform/tizen/tizen_view.h @@ -18,6 +18,13 @@ class TizenView : public TizenViewBase { TizenView() = default; virtual ~TizenView() = default; + virtual void OnKey(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) = 0; + TizenViewType GetType() override { return TizenViewType::kView; }; bool focused() { return focused_; }; diff --git a/shell/platform/tizen/tizen_view_base.h b/shell/platform/tizen/tizen_view_base.h index ae7fe3b53a67e..3f3f6190ac6cb 100644 --- a/shell/platform/tizen/tizen_view_base.h +++ b/shell/platform/tizen/tizen_view_base.h @@ -43,13 +43,6 @@ class TizenViewBase { // Returns the dpi of the screen. virtual int32_t GetDpi() = 0; - virtual void KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) = 0; - // Sets the delegate used to communicate state changes from render target to // view such as key presses, mouse position updates etc. void SetView(TizenViewEventHandlerDelegate* view_delegate) { diff --git a/shell/platform/tizen/tizen_view_elementary.cc b/shell/platform/tizen/tizen_view_elementary.cc index 17ac3796837a6..0a8866eb5da42 100644 --- a/shell/platform/tizen/tizen_view_elementary.cc +++ b/shell/platform/tizen/tizen_view_elementary.cc @@ -339,13 +339,13 @@ void TizenViewElementary::Show() { evas_object_show(image_); } -void TizenViewElementary::KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) { - FT_UNIMPLEMENTED(); +void TizenViewElementary::OnKey(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) { + // no-op } void TizenViewElementary::PrepareInputMethod() { diff --git a/shell/platform/tizen/tizen_view_elementary.h b/shell/platform/tizen/tizen_view_elementary.h index 2c9b4e931f1a1..e3fe0f5072af5 100644 --- a/shell/platform/tizen/tizen_view_elementary.h +++ b/shell/platform/tizen/tizen_view_elementary.h @@ -37,12 +37,12 @@ class TizenViewElementary : public TizenView { void Show() override; - void KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) override; + void OnKey(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) override; private: bool CreateView(); diff --git a/shell/platform/tizen/tizen_view_nui.cc b/shell/platform/tizen/tizen_view_nui.cc index ba43770932596..7080dab3e4c64 100644 --- a/shell/platform/tizen/tizen_view_nui.cc +++ b/shell/platform/tizen/tizen_view_nui.cc @@ -74,16 +74,16 @@ void TizenViewNui::RequestRendering() { rendering_callback_->Trigger(); } -void TizenViewNui::KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) { +void TizenViewNui::OnKey(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) { bool handled = false; if (input_method_context_->IsInputPanelShown()) { - handled = input_method_context_->HandleNUIEventKey(key, string, modifiers, + handled = input_method_context_->HandleNuiEventKey(key, string, modifiers, scan_code, is_down); } diff --git a/shell/platform/tizen/tizen_view_nui.h b/shell/platform/tizen/tizen_view_nui.h index 20e3be39743f7..d92b14efe8cb7 100644 --- a/shell/platform/tizen/tizen_view_nui.h +++ b/shell/platform/tizen/tizen_view_nui.h @@ -42,12 +42,12 @@ class TizenViewNui : public TizenView { void RequestRendering(); - void KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) override; + void OnKey(const char* key, + const char* string, + const char* compose, + uint32_t modifiers, + uint32_t scan_code, + bool is_down) override; private: void RegisterEventHandlers(); diff --git a/shell/platform/tizen/tizen_window.h b/shell/platform/tizen/tizen_window.h index 0729bbc9d0ffb..9d2fd9e888880 100644 --- a/shell/platform/tizen/tizen_window.h +++ b/shell/platform/tizen/tizen_window.h @@ -33,15 +33,6 @@ class TizenWindow : public TizenViewBase { TizenViewType GetType() override { return TizenViewType::kWindow; }; - void KeyEvent(const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - bool is_down) override { - FT_UNIMPLEMENTED(); - }; - protected: explicit TizenWindow(TizenGeometry geometry, bool transparent, From bebb254a2a2de5923a812bcad0767530c0e90c8e Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 27 Sep 2022 11:02:22 +0900 Subject: [PATCH 3/9] Update based on review --- shell/platform/tizen/flutter_tizen.cc | 3 +- shell/platform/tizen/public/flutter_tizen.h | 1 + .../tizen/tizen_input_method_context.cc | 30 +++++++------------ .../tizen/tizen_input_method_context.h | 1 + shell/platform/tizen/tizen_view.h | 1 + shell/platform/tizen/tizen_view_elementary.cc | 1 + shell/platform/tizen/tizen_view_elementary.h | 1 + shell/platform/tizen/tizen_view_nui.cc | 7 +++-- shell/platform/tizen/tizen_view_nui.h | 1 + shell/platform/tizen/tizen_window.h | 1 - 10 files changed, 22 insertions(+), 25 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 8603261ad50a1..f6f902ac6a8ec 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -270,12 +270,13 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, const char* string, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) { auto* tizen_view = reinterpret_cast( ViewFromHandle(view)->tizen_view()); if (tizen_view->GetType() == flutter::TizenViewType::kView) { reinterpret_cast(tizen_view) - ->OnKey(key, string, nullptr, modifiers, scan_code, is_down); + ->OnKey(key, string, nullptr, modifiers, scan_code, timestamp, is_down); } } diff --git a/shell/platform/tizen/public/flutter_tizen.h b/shell/platform/tizen/public/flutter_tizen.h index 23b4d3767193d..803a053d71cc2 100644 --- a/shell/platform/tizen/public/flutter_tizen.h +++ b/shell/platform/tizen/public/flutter_tizen.h @@ -214,6 +214,7 @@ FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, const char* string, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down); FLUTTER_EXPORT void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, diff --git a/shell/platform/tizen/tizen_input_method_context.cc b/shell/platform/tizen/tizen_input_method_context.cc index fcc0af101ab54..8f483c0bfa557 100644 --- a/shell/platform/tizen/tizen_input_method_context.cc +++ b/shell/platform/tizen/tizen_input_method_context.cc @@ -113,22 +113,6 @@ T EcoreEventKeyToEcoreImfEvent(Ecore_Event_Key* event) { return imf_event; } -template -T NuiEventKeyToEcoreImfEvent(const char* key, - const char* string, - uint32_t modifiers, - uint32_t scan_code) { - T imf_event; - - imf_event.key = key; - imf_event.string = string; - imf_event.modifiers = EcoreInputModifiersToEcoreImfModifiers(modifiers); - imf_event.locks = EcoreInputModifiersToEcoreImfLocks(modifiers); - imf_event.keycode = scan_code; - - return imf_event; -} - } // namespace namespace flutter { @@ -211,18 +195,24 @@ bool TizenInputMethodContext::HandleNuiEventKey(const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) { + Ecore_Event_Key event; + event.keyname = event.key = key ? key : ""; + event.string = string ? string : ""; + event.modifiers = modifiers; + event.keycode = scan_code; + event.timestamp = timestamp; + if (is_down) { Ecore_IMF_Event_Key_Down imf_event = - NuiEventKeyToEcoreImfEvent( - key, string, modifiers, scan_code); + EcoreEventKeyToEcoreImfEvent(&event); return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_DOWN, reinterpret_cast(&imf_event)); } else { Ecore_IMF_Event_Key_Up imf_event = - NuiEventKeyToEcoreImfEvent( - key, string, modifiers, scan_code); + EcoreEventKeyToEcoreImfEvent(&event); return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_UP, reinterpret_cast(&imf_event)); diff --git a/shell/platform/tizen/tizen_input_method_context.h b/shell/platform/tizen/tizen_input_method_context.h index d9eb4c355b9a6..ed1cb1860f2dd 100644 --- a/shell/platform/tizen/tizen_input_method_context.h +++ b/shell/platform/tizen/tizen_input_method_context.h @@ -39,6 +39,7 @@ class TizenInputMethodContext { const char* string, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down); InputPanelGeometry GetInputPanelGeometry(); diff --git a/shell/platform/tizen/tizen_view.h b/shell/platform/tizen/tizen_view.h index 1454bb1f16ce9..d833407065769 100644 --- a/shell/platform/tizen/tizen_view.h +++ b/shell/platform/tizen/tizen_view.h @@ -23,6 +23,7 @@ class TizenView : public TizenViewBase { const char* compose, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) = 0; TizenViewType GetType() override { return TizenViewType::kView; }; diff --git a/shell/platform/tizen/tizen_view_elementary.cc b/shell/platform/tizen/tizen_view_elementary.cc index 0a8866eb5da42..0377059d01e73 100644 --- a/shell/platform/tizen/tizen_view_elementary.cc +++ b/shell/platform/tizen/tizen_view_elementary.cc @@ -344,6 +344,7 @@ void TizenViewElementary::OnKey(const char* key, const char* compose, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) { // no-op } diff --git a/shell/platform/tizen/tizen_view_elementary.h b/shell/platform/tizen/tizen_view_elementary.h index e3fe0f5072af5..99312502a25e4 100644 --- a/shell/platform/tizen/tizen_view_elementary.h +++ b/shell/platform/tizen/tizen_view_elementary.h @@ -42,6 +42,7 @@ class TizenViewElementary : public TizenView { const char* compose, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) override; private: diff --git a/shell/platform/tizen/tizen_view_nui.cc b/shell/platform/tizen/tizen_view_nui.cc index 7080dab3e4c64..18474960465cc 100644 --- a/shell/platform/tizen/tizen_view_nui.cc +++ b/shell/platform/tizen/tizen_view_nui.cc @@ -79,16 +79,17 @@ void TizenViewNui::OnKey(const char* key, const char* compose, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) { bool handled = false; if (input_method_context_->IsInputPanelShown()) { - handled = input_method_context_->HandleNuiEventKey(key, string, modifiers, - scan_code, is_down); + handled = input_method_context_->HandleNuiEventKey( + key, string, modifiers, scan_code, timestamp, is_down); } if (!handled) { - view_delegate_->OnKey(key, string, nullptr, modifiers, scan_code, is_down); + view_delegate_->OnKey(key, string, compose, modifiers, scan_code, is_down); } } diff --git a/shell/platform/tizen/tizen_view_nui.h b/shell/platform/tizen/tizen_view_nui.h index d92b14efe8cb7..c41614d14dcff 100644 --- a/shell/platform/tizen/tizen_view_nui.h +++ b/shell/platform/tizen/tizen_view_nui.h @@ -47,6 +47,7 @@ class TizenViewNui : public TizenView { const char* compose, uint32_t modifiers, uint32_t scan_code, + size_t timestamp, bool is_down) override; private: diff --git a/shell/platform/tizen/tizen_window.h b/shell/platform/tizen/tizen_window.h index 9d2fd9e888880..a78793f062b20 100644 --- a/shell/platform/tizen/tizen_window.h +++ b/shell/platform/tizen/tizen_window.h @@ -8,7 +8,6 @@ #include #include -#include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/tizen_view_base.h" namespace flutter { From 7f8cef082ada92b7d846c48bc3390b50651ea5ff Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 27 Sep 2022 13:44:06 +0900 Subject: [PATCH 4/9] Add device info --- shell/platform/tizen/flutter_tizen.cc | 6 +++++- shell/platform/tizen/public/flutter_tizen.h | 3 +++ .../tizen/tizen_input_method_context.cc | 19 ++++++++++++++++++- .../tizen/tizen_input_method_context.h | 5 ++++- shell/platform/tizen/tizen_view.h | 5 ++++- shell/platform/tizen/tizen_view_elementary.cc | 5 ++++- shell/platform/tizen/tizen_view_elementary.h | 5 ++++- shell/platform/tizen/tizen_view_nui.cc | 8 ++++++-- shell/platform/tizen/tizen_view_nui.h | 5 ++++- 9 files changed, 52 insertions(+), 9 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index f6f902ac6a8ec..6570381d5651a 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -266,6 +266,9 @@ void FlutterDesktopViewOnPointerEvent(FlutterDesktopViewRef view, } void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, + const char* device_name, + uint32_t device_class, + uint32_t device_subclass, const char* key, const char* string, uint32_t modifiers, @@ -276,7 +279,8 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, ViewFromHandle(view)->tizen_view()); if (tizen_view->GetType() == flutter::TizenViewType::kView) { reinterpret_cast(tizen_view) - ->OnKey(key, string, nullptr, modifiers, scan_code, timestamp, is_down); + ->OnKey(device_name, device_class, device_subclass, key, string, + nullptr, modifiers, scan_code, timestamp, is_down); } } diff --git a/shell/platform/tizen/public/flutter_tizen.h b/shell/platform/tizen/public/flutter_tizen.h index 803a053d71cc2..c1132d6cd223a 100644 --- a/shell/platform/tizen/public/flutter_tizen.h +++ b/shell/platform/tizen/public/flutter_tizen.h @@ -210,6 +210,9 @@ FLUTTER_EXPORT void FlutterDesktopViewOnPointerEvent( int32_t device_id); FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, + const char* device_name, + uint32_t device_class, + uint32_t device_subclass, const char* key, const char* string, uint32_t modifiers, diff --git a/shell/platform/tizen/tizen_input_method_context.cc b/shell/platform/tizen/tizen_input_method_context.cc index 8f483c0bfa557..1199dfc0552cf 100644 --- a/shell/platform/tizen/tizen_input_method_context.cc +++ b/shell/platform/tizen/tizen_input_method_context.cc @@ -191,7 +191,10 @@ bool TizenInputMethodContext::HandleEvasEventKeyUp(Evas_Event_Key_Up* event) { reinterpret_cast(&imf_event)); } -bool TizenInputMethodContext::HandleNuiEventKey(const char* key, +bool TizenInputMethodContext::HandleNuiEventKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, @@ -203,16 +206,30 @@ bool TizenInputMethodContext::HandleNuiEventKey(const char* key, event.modifiers = modifiers; event.keycode = scan_code; event.timestamp = timestamp; + if (device_name) { + event.dev = ecore_device_add(); + ecore_device_name_set(event.dev, device_name); + ecore_device_class_set(event.dev, + static_cast(device_class)); + ecore_device_subclass_set( + event.dev, static_cast(device_subclass)); + } if (is_down) { Ecore_IMF_Event_Key_Down imf_event = EcoreEventKeyToEcoreImfEvent(&event); + if (event.dev) { + ecore_device_del(event.dev); + } return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_DOWN, reinterpret_cast(&imf_event)); } else { Ecore_IMF_Event_Key_Up imf_event = EcoreEventKeyToEcoreImfEvent(&event); + if (event.dev) { + ecore_device_del(event.dev); + } return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_UP, reinterpret_cast(&imf_event)); diff --git a/shell/platform/tizen/tizen_input_method_context.h b/shell/platform/tizen/tizen_input_method_context.h index ed1cb1860f2dd..1feccfce847fd 100644 --- a/shell/platform/tizen/tizen_input_method_context.h +++ b/shell/platform/tizen/tizen_input_method_context.h @@ -35,7 +35,10 @@ class TizenInputMethodContext { bool HandleEvasEventKeyUp(Evas_Event_Key_Up* event); - bool HandleNuiEventKey(const char* key, + bool HandleNuiEventKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, diff --git a/shell/platform/tizen/tizen_view.h b/shell/platform/tizen/tizen_view.h index d833407065769..3384237b971ea 100644 --- a/shell/platform/tizen/tizen_view.h +++ b/shell/platform/tizen/tizen_view.h @@ -18,7 +18,10 @@ class TizenView : public TizenViewBase { TizenView() = default; virtual ~TizenView() = default; - virtual void OnKey(const char* key, + virtual void OnKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, const char* compose, uint32_t modifiers, diff --git a/shell/platform/tizen/tizen_view_elementary.cc b/shell/platform/tizen/tizen_view_elementary.cc index 0377059d01e73..15fa203348be4 100644 --- a/shell/platform/tizen/tizen_view_elementary.cc +++ b/shell/platform/tizen/tizen_view_elementary.cc @@ -339,7 +339,10 @@ void TizenViewElementary::Show() { evas_object_show(image_); } -void TizenViewElementary::OnKey(const char* key, +void TizenViewElementary::OnKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, const char* compose, uint32_t modifiers, diff --git a/shell/platform/tizen/tizen_view_elementary.h b/shell/platform/tizen/tizen_view_elementary.h index 99312502a25e4..d81bf9e1260e3 100644 --- a/shell/platform/tizen/tizen_view_elementary.h +++ b/shell/platform/tizen/tizen_view_elementary.h @@ -37,7 +37,10 @@ class TizenViewElementary : public TizenView { void Show() override; - void OnKey(const char* key, + void OnKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, const char* compose, uint32_t modifiers, diff --git a/shell/platform/tizen/tizen_view_nui.cc b/shell/platform/tizen/tizen_view_nui.cc index 18474960465cc..dac1d7ccf64d2 100644 --- a/shell/platform/tizen/tizen_view_nui.cc +++ b/shell/platform/tizen/tizen_view_nui.cc @@ -74,7 +74,10 @@ void TizenViewNui::RequestRendering() { rendering_callback_->Trigger(); } -void TizenViewNui::OnKey(const char* key, +void TizenViewNui::OnKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, const char* compose, uint32_t modifiers, @@ -85,7 +88,8 @@ void TizenViewNui::OnKey(const char* key, if (input_method_context_->IsInputPanelShown()) { handled = input_method_context_->HandleNuiEventKey( - key, string, modifiers, scan_code, timestamp, is_down); + device_name, device_class, device_subclass, key, string, modifiers, + scan_code, timestamp, is_down); } if (!handled) { diff --git a/shell/platform/tizen/tizen_view_nui.h b/shell/platform/tizen/tizen_view_nui.h index c41614d14dcff..8b78584bb79e0 100644 --- a/shell/platform/tizen/tizen_view_nui.h +++ b/shell/platform/tizen/tizen_view_nui.h @@ -42,7 +42,10 @@ class TizenViewNui : public TizenView { void RequestRendering(); - void OnKey(const char* key, + void OnKey(const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, const char* string, const char* compose, uint32_t modifiers, From bb8d7f7a1c5fde0c31cdafccfc93f5898c8ae866 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 27 Sep 2022 14:36:21 +0900 Subject: [PATCH 5/9] Rename NuiEventKey to NuiKeyEvent --- shell/platform/tizen/tizen_input_method_context.cc | 2 +- shell/platform/tizen/tizen_input_method_context.h | 2 +- shell/platform/tizen/tizen_view_nui.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/platform/tizen/tizen_input_method_context.cc b/shell/platform/tizen/tizen_input_method_context.cc index 1199dfc0552cf..e0ac901d2f914 100644 --- a/shell/platform/tizen/tizen_input_method_context.cc +++ b/shell/platform/tizen/tizen_input_method_context.cc @@ -191,7 +191,7 @@ bool TizenInputMethodContext::HandleEvasEventKeyUp(Evas_Event_Key_Up* event) { reinterpret_cast(&imf_event)); } -bool TizenInputMethodContext::HandleNuiEventKey(const char* device_name, +bool TizenInputMethodContext::HandleNuiKeyEvent(const char* device_name, uint32_t device_class, uint32_t device_subclass, const char* key, diff --git a/shell/platform/tizen/tizen_input_method_context.h b/shell/platform/tizen/tizen_input_method_context.h index 1feccfce847fd..af8055d9621d7 100644 --- a/shell/platform/tizen/tizen_input_method_context.h +++ b/shell/platform/tizen/tizen_input_method_context.h @@ -35,7 +35,7 @@ class TizenInputMethodContext { bool HandleEvasEventKeyUp(Evas_Event_Key_Up* event); - bool HandleNuiEventKey(const char* device_name, + bool HandleNuiKeyEvent(const char* device_name, uint32_t device_class, uint32_t device_subclass, const char* key, diff --git a/shell/platform/tizen/tizen_view_nui.cc b/shell/platform/tizen/tizen_view_nui.cc index dac1d7ccf64d2..c9eb2eb4a196c 100644 --- a/shell/platform/tizen/tizen_view_nui.cc +++ b/shell/platform/tizen/tizen_view_nui.cc @@ -87,7 +87,7 @@ void TizenViewNui::OnKey(const char* device_name, bool handled = false; if (input_method_context_->IsInputPanelShown()) { - handled = input_method_context_->HandleNuiEventKey( + handled = input_method_context_->HandleNuiKeyEvent( device_name, device_class, device_subclass, key, string, modifiers, scan_code, timestamp, is_down); } From eee1ce2e791bac7a56df5eb31b7c0dd00732be2c Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 27 Sep 2022 16:24:21 +0900 Subject: [PATCH 6/9] Update based on review --- shell/platform/tizen/flutter_tizen.cc | 16 ++++++++++++--- .../tizen/tizen_input_method_context.cc | 20 ++++++++++++------- .../tizen/tizen_input_method_context.h | 5 +++++ shell/platform/tizen/tizen_view.h | 11 ---------- shell/platform/tizen/tizen_view_elementary.cc | 13 ------------ shell/platform/tizen/tizen_view_elementary.h | 11 ---------- shell/platform/tizen/tizen_view_nui.h | 2 +- 7 files changed, 32 insertions(+), 46 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 6570381d5651a..2d5fb17306593 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -13,7 +13,9 @@ #include "flutter/shell/platform/tizen/flutter_tizen_view.h" #include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/public/flutter_platform_view.h" -#include "flutter/shell/platform/tizen/tizen_view.h" +#ifdef NUI_SUPPORT +#include "flutter/shell/platform/tizen/tizen_view_nui.h" +#endif #include "flutter/shell/platform/tizen/tizen_window.h" #ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/tizen_window_ecore_wl2.h" @@ -275,13 +277,21 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, uint32_t scan_code, size_t timestamp, bool is_down) { +#ifdef NUI_SUPPORT auto* tizen_view = reinterpret_cast( ViewFromHandle(view)->tizen_view()); - if (tizen_view->GetType() == flutter::TizenViewType::kView) { - reinterpret_cast(tizen_view) + + if (tizen_view->GetType() == flutter::TizenViewType::kView && + ViewFromHandle(view)->engine()->renderer()->type() == + FlutterDesktopRendererType::kEGL) { + reinterpret_cast(tizen_view) ->OnKey(device_name, device_class, device_subclass, key, string, nullptr, modifiers, scan_code, timestamp, is_down); } +#else + ViewFromHandle(view)->OnKey(key, string, nullptr, modifiers, scan_code, + is_down); +#endif } void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, bool focused) { diff --git a/shell/platform/tizen/tizen_input_method_context.cc b/shell/platform/tizen/tizen_input_method_context.cc index e0ac901d2f914..0c94620a22863 100644 --- a/shell/platform/tizen/tizen_input_method_context.cc +++ b/shell/platform/tizen/tizen_input_method_context.cc @@ -146,6 +146,12 @@ TizenInputMethodContext::TizenInputMethodContext(uintptr_t window_id) { TizenInputMethodContext::~TizenInputMethodContext() { UnregisterEventCallbacks(); +#ifdef NUI_SUPPORT + if (ecore_device_) { + ecore_device_del(ecore_device_); + } +#endif + if (imf_context_) { ecore_imf_context_del(imf_context_); } @@ -191,6 +197,7 @@ bool TizenInputMethodContext::HandleEvasEventKeyUp(Evas_Event_Key_Up* event) { reinterpret_cast(&imf_event)); } +#ifdef NUI_SUPPORT bool TizenInputMethodContext::HandleNuiKeyEvent(const char* device_name, uint32_t device_class, uint32_t device_subclass, @@ -207,7 +214,11 @@ bool TizenInputMethodContext::HandleNuiKeyEvent(const char* device_name, event.keycode = scan_code; event.timestamp = timestamp; if (device_name) { - event.dev = ecore_device_add(); + if (!ecore_device_) { + ecore_device_ = ecore_device_add(); + } + + event.dev = ecore_device_; ecore_device_name_set(event.dev, device_name); ecore_device_class_set(event.dev, static_cast(device_class)); @@ -218,23 +229,18 @@ bool TizenInputMethodContext::HandleNuiKeyEvent(const char* device_name, if (is_down) { Ecore_IMF_Event_Key_Down imf_event = EcoreEventKeyToEcoreImfEvent(&event); - if (event.dev) { - ecore_device_del(event.dev); - } return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_DOWN, reinterpret_cast(&imf_event)); } else { Ecore_IMF_Event_Key_Up imf_event = EcoreEventKeyToEcoreImfEvent(&event); - if (event.dev) { - ecore_device_del(event.dev); - } return ecore_imf_context_filter_event( imf_context_, ECORE_IMF_EVENT_KEY_UP, reinterpret_cast(&imf_event)); } } +#endif InputPanelGeometry TizenInputMethodContext::GetInputPanelGeometry() { FT_ASSERT(imf_context_); diff --git a/shell/platform/tizen/tizen_input_method_context.h b/shell/platform/tizen/tizen_input_method_context.h index af8055d9621d7..c241f909ad7ae 100644 --- a/shell/platform/tizen/tizen_input_method_context.h +++ b/shell/platform/tizen/tizen_input_method_context.h @@ -35,6 +35,7 @@ class TizenInputMethodContext { bool HandleEvasEventKeyUp(Evas_Event_Key_Up* event); +#ifdef NUI_SUPPORT bool HandleNuiKeyEvent(const char* device_name, uint32_t device_class, uint32_t device_subclass, @@ -44,6 +45,7 @@ class TizenInputMethodContext { uint32_t scan_code, size_t timestamp, bool is_down); +#endif InputPanelGeometry GetInputPanelGeometry(); @@ -80,6 +82,9 @@ class TizenInputMethodContext { void SetContextOptions(); void SetInputPanelOptions(); +#ifdef NUI_SUPPORT + Ecore_Device* ecore_device_ = nullptr; +#endif Ecore_IMF_Context* imf_context_ = nullptr; OnCommit on_commit_; OnPreeditChanged on_preedit_changed_; diff --git a/shell/platform/tizen/tizen_view.h b/shell/platform/tizen/tizen_view.h index 3384237b971ea..d9979632c634e 100644 --- a/shell/platform/tizen/tizen_view.h +++ b/shell/platform/tizen/tizen_view.h @@ -18,17 +18,6 @@ class TizenView : public TizenViewBase { TizenView() = default; virtual ~TizenView() = default; - virtual void OnKey(const char* device_name, - uint32_t device_class, - uint32_t device_subclass, - const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - size_t timestamp, - bool is_down) = 0; - TizenViewType GetType() override { return TizenViewType::kView; }; bool focused() { return focused_; }; diff --git a/shell/platform/tizen/tizen_view_elementary.cc b/shell/platform/tizen/tizen_view_elementary.cc index 15fa203348be4..037d00a26f87b 100644 --- a/shell/platform/tizen/tizen_view_elementary.cc +++ b/shell/platform/tizen/tizen_view_elementary.cc @@ -339,19 +339,6 @@ void TizenViewElementary::Show() { evas_object_show(image_); } -void TizenViewElementary::OnKey(const char* device_name, - uint32_t device_class, - uint32_t device_subclass, - const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - size_t timestamp, - bool is_down) { - // no-op -} - void TizenViewElementary::PrepareInputMethod() { input_method_context_ = std::make_unique(GetWindowId()); diff --git a/shell/platform/tizen/tizen_view_elementary.h b/shell/platform/tizen/tizen_view_elementary.h index d81bf9e1260e3..27b8aeb18e514 100644 --- a/shell/platform/tizen/tizen_view_elementary.h +++ b/shell/platform/tizen/tizen_view_elementary.h @@ -37,17 +37,6 @@ class TizenViewElementary : public TizenView { void Show() override; - void OnKey(const char* device_name, - uint32_t device_class, - uint32_t device_subclass, - const char* key, - const char* string, - const char* compose, - uint32_t modifiers, - uint32_t scan_code, - size_t timestamp, - bool is_down) override; - private: bool CreateView(); diff --git a/shell/platform/tizen/tizen_view_nui.h b/shell/platform/tizen/tizen_view_nui.h index 8b78584bb79e0..5ddf9172f7b16 100644 --- a/shell/platform/tizen/tizen_view_nui.h +++ b/shell/platform/tizen/tizen_view_nui.h @@ -51,7 +51,7 @@ class TizenViewNui : public TizenView { uint32_t modifiers, uint32_t scan_code, size_t timestamp, - bool is_down) override; + bool is_down); private: void RegisterEventHandlers(); From 25f4900c513e98ab44eac1f9fb1c0e4e8f4cb1e8 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 28 Sep 2022 10:22:29 +0900 Subject: [PATCH 7/9] Resolve merge conflict --- shell/platform/tizen/flutter_tizen.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 2d5fb17306593..6588925a1ebd4 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -13,6 +13,7 @@ #include "flutter/shell/platform/tizen/flutter_tizen_view.h" #include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/public/flutter_platform_view.h" +#include "flutter/shell/platform/tizen/tizen_view.h" #ifdef NUI_SUPPORT #include "flutter/shell/platform/tizen/tizen_view_nui.h" #endif From dc26259a11bfe60ee728778ee4fb066b8117740e Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 5 Oct 2022 15:01:07 +0900 Subject: [PATCH 8/9] Change to default parameter --- shell/platform/tizen/flutter_tizen.cc | 10 +++++----- shell/platform/tizen/public/flutter_tizen.h | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 6588925a1ebd4..07b5f268f73b6 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -269,15 +269,15 @@ void FlutterDesktopViewOnPointerEvent(FlutterDesktopViewRef view, } void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, - const char* device_name, - uint32_t device_class, - uint32_t device_subclass, const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, - size_t timestamp, - bool is_down) { + bool is_down, + size_t timestamp = 0, + const char* device_name = nullptr, + uint32_t device_class = 0, + uint32_t device_subclass = 0) { #ifdef NUI_SUPPORT auto* tizen_view = reinterpret_cast( ViewFromHandle(view)->tizen_view()); diff --git a/shell/platform/tizen/public/flutter_tizen.h b/shell/platform/tizen/public/flutter_tizen.h index c1132d6cd223a..e09cd6ad29a54 100644 --- a/shell/platform/tizen/public/flutter_tizen.h +++ b/shell/platform/tizen/public/flutter_tizen.h @@ -209,16 +209,17 @@ FLUTTER_EXPORT void FlutterDesktopViewOnPointerEvent( size_t timestamp, int32_t device_id); -FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, - const char* device_name, - uint32_t device_class, - uint32_t device_subclass, - const char* key, - const char* string, - uint32_t modifiers, - uint32_t scan_code, - size_t timestamp, - bool is_down); +FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent( + FlutterDesktopViewRef view, + const char* key, + const char* string, + uint32_t modifiers, + uint32_t scan_code, + bool is_down, + size_t timestamp = 0, + const char* device_name = nullptr, + uint32_t device_class = 0, + uint32_t device_subclass = 0); FLUTTER_EXPORT void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, bool focused); From bb88ea05aaebc2c0aa18989eee7ca765a259d900 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 5 Oct 2022 16:05:19 +0900 Subject: [PATCH 9/9] Revert "Change to default parameter" This reverts commit a98e9981a23551c9ff656e9d10418994d8456d34. --- shell/platform/tizen/flutter_tizen.cc | 10 +++++----- shell/platform/tizen/public/flutter_tizen.h | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 07b5f268f73b6..6588925a1ebd4 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -269,15 +269,15 @@ void FlutterDesktopViewOnPointerEvent(FlutterDesktopViewRef view, } void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, + const char* device_name, + uint32_t device_class, + uint32_t device_subclass, const char* key, const char* string, uint32_t modifiers, uint32_t scan_code, - bool is_down, - size_t timestamp = 0, - const char* device_name = nullptr, - uint32_t device_class = 0, - uint32_t device_subclass = 0) { + size_t timestamp, + bool is_down) { #ifdef NUI_SUPPORT auto* tizen_view = reinterpret_cast( ViewFromHandle(view)->tizen_view()); diff --git a/shell/platform/tizen/public/flutter_tizen.h b/shell/platform/tizen/public/flutter_tizen.h index e09cd6ad29a54..c1132d6cd223a 100644 --- a/shell/platform/tizen/public/flutter_tizen.h +++ b/shell/platform/tizen/public/flutter_tizen.h @@ -209,17 +209,16 @@ FLUTTER_EXPORT void FlutterDesktopViewOnPointerEvent( size_t timestamp, int32_t device_id); -FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent( - FlutterDesktopViewRef view, - const char* key, - const char* string, - uint32_t modifiers, - uint32_t scan_code, - bool is_down, - size_t timestamp = 0, - const char* device_name = nullptr, - uint32_t device_class = 0, - uint32_t device_subclass = 0); +FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, + const char* device_name, + uint32_t device_class, + uint32_t device_subclass, + const char* key, + const char* string, + uint32_t modifiers, + uint32_t scan_code, + size_t timestamp, + bool is_down); FLUTTER_EXPORT void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, bool focused);