Skip to content

Commit b139ae4

Browse files
committed
Fix key events propagation (#296)
1 parent 3030066 commit b139ae4

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

shell/platform/tizen/channels/platform_view_channel.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,17 @@ void PlatformViewChannel::ClearViewFactories() {
7979
view_factories_.clear();
8080
}
8181

82-
void PlatformViewChannel::SendKey(const char* key,
82+
bool PlatformViewChannel::SendKey(const char* key,
8383
const char* string,
8484
const char* compose,
8585
uint32_t modifiers,
8686
uint32_t scan_code,
8787
bool is_down) {
8888
PlatformView* view = FindFocusedView();
8989
if (view) {
90-
view->SendKey(key, string, compose, modifiers, scan_code, is_down);
90+
return view->SendKey(key, string, compose, modifiers, scan_code, is_down);
9191
}
92+
return false;
9293
}
9394

9495
void PlatformViewChannel::HandleMethodCall(

shell/platform/tizen/channels/platform_view_channel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PlatformViewChannel {
2828
return view_factories_;
2929
}
3030

31-
void SendKey(const char* key,
31+
bool SendKey(const char* key,
3232
const char* string,
3333
const char* compose,
3434
uint32_t modifiers,

shell/platform/tizen/channels/text_input_channel.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ bool TextInputChannel::SendKey(const char* key,
119119
}
120120

121121
if (is_down) {
122-
HandleKey(key, string, modifiers);
122+
return HandleKey(key, string, modifiers);
123123
}
124124

125-
return true;
125+
return false;
126126
}
127127

128128
void TextInputChannel::HandleMethodCall(
@@ -300,7 +300,7 @@ void TextInputChannel::SendStateUpdate() {
300300
channel_->InvokeMethod(kUpdateEditingStateMethod, std::move(args));
301301
}
302302

303-
void TextInputChannel::HandleKey(const char* key,
303+
bool TextInputChannel::HandleKey(const char* key,
304304
const char* string,
305305
uint32_t modifires) {
306306
bool shift = modifires & ECORE_SHIFT;
@@ -344,19 +344,21 @@ void TextInputChannel::HandleKey(const char* key,
344344
needs_update = true;
345345
} else if (key_str == "Return") {
346346
EnterPressed();
347-
return;
347+
return true;
348348
#ifdef TV_PROFILE
349349
} else if (key_str == "Select") {
350350
SelectPressed();
351-
return;
352-
} else {
351+
return true;
353352
#endif
354-
FT_LOG(Warn) << "Key[" << key << "] is unhandled.";
353+
} else {
354+
FT_LOG(Info) << "Key[" << key << "] is unhandled.";
355+
return false;
355356
}
356357

357358
if (needs_update) {
358359
SendStateUpdate();
359360
}
361+
return true;
360362
}
361363

362364
void TextInputChannel::EnterPressed() {

shell/platform/tizen/channels/text_input_channel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TextInputChannel {
4646
// Sends the current state of |active_model_| to the Flutter engine.
4747
void SendStateUpdate();
4848

49-
void HandleKey(const char* key, const char* string, uint32_t modifiers);
49+
bool HandleKey(const char* key, const char* string, uint32_t modifiers);
5050

5151
// Sends an action triggered by the Enter key to the Flutter engine.
5252
void EnterPressed();

shell/platform/tizen/flutter_tizen_view.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@ void FlutterTizenView::OnKey(const char* key,
212212
}
213213

214214
if (engine_->platform_view_channel()) {
215-
engine_->platform_view_channel()->SendKey(key, string, compose, modifiers,
216-
scan_code, is_down);
215+
if (engine_->platform_view_channel()->SendKey(
216+
key, string, compose, modifiers, scan_code, is_down)) {
217+
return;
218+
}
217219
}
218220

219221
if (engine_->key_event_channel()) {

shell/platform/tizen/public/flutter_platform_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PlatformView {
4545

4646
bool IsFocused() { return is_focused_; }
4747

48-
virtual void SendKey(const char* key,
48+
virtual bool SendKey(const char* key,
4949
const char* string,
5050
const char* compose,
5151
uint32_t modifiers,

0 commit comments

Comments
 (0)