Skip to content

Commit 5566608

Browse files
committed
Implement tizen window elementary's ctxpopup_ for autofill
1 parent aa6623b commit 5566608

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

flutter/shell/platform/tizen/tizen_window_elementary.cc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <eom.h>
99
#include <ui/efl_util.h>
1010

11+
#include <memory>
12+
1113
#include "flutter/shell/platform/tizen/logger.h"
1214
#include "flutter/shell/platform/tizen/tizen_view_event_handler_delegate.h"
1315

@@ -426,6 +428,35 @@ void TizenWindowElementary::PrepareInputMethod() {
426428
[this]() { view_delegate_->OnComposeEnd(); });
427429
input_method_context_->SetOnCommit(
428430
[this](std::string str) { view_delegate_->OnCommit(str); });
431+
432+
#ifdef AUTOFILL_SUPPORT
433+
ctxpopup_ = elm_ctxpopup_add(elm_win_);
434+
435+
input_method_context_->SetOnPopupAutofillContext([this]() {
436+
if (TizenAutofill::GetInstance().GetAutofillItems().size() > 0) {
437+
for (auto& item : TizenAutofill::GetInstance().GetAutofillItems()) {
438+
elm_ctxpopup_item_append(
439+
ctxpopup_, item->label_.c_str(), nullptr,
440+
[](void* data, Evas_Object* obj, void* event_info) {
441+
AutofillItem* item = static_cast<AutofillItem*>(data);
442+
TizenAutofill::GetInstance().OnCommit(item->value_);
443+
evas_object_hide(obj);
444+
},
445+
item.get());
446+
}
447+
}
448+
// TODO : Change ctxpopup's position to focused input field.
449+
evas_object_move(ctxpopup_, initial_geometry_.left, initial_geometry_.top);
450+
evas_object_show(ctxpopup_);
451+
});
452+
453+
evas_object_event_callback_add(
454+
ctxpopup_, EVAS_CALLBACK_HIDE,
455+
[](void* data, Evas* e, Evas_Object* obj, void* event_info) {
456+
elm_ctxpopup_clear(obj);
457+
},
458+
nullptr);
459+
#endif
429460
}
430461

431462
int32_t TizenWindowElementary::GetExternalOutputId() {

flutter/shell/platform/tizen/tizen_window_elementary.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ class TizenWindowElementary : public TizenWindow {
7272

7373
Evas_Object* elm_win_ = nullptr;
7474
Evas_Object* image_ = nullptr;
75+
#ifdef AUTOFILL_SUPPORT
76+
Evas_Object* ctxpopup_ = nullptr;
77+
#endif
7578

7679
Evas_Smart_Cb rotation_changed_callback_ = nullptr;
7780
std::unordered_map<Evas_Callback_Type, Evas_Object_Event_Cb>

0 commit comments

Comments
 (0)