Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a focused platform view bug #27

Merged
Merged
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
23 changes: 16 additions & 7 deletions shell/platform/tizen/channels/platform_view_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void PlatformViewChannel::HandleMethodCall(
const auto method = call.method_name();
const auto& arguments = *call.arguments();

FT_LOGD("method: %s", method.c_str());
FT_LOGD("PlatformViewChannel method: %s", method.c_str());
if (method == "create") {
std::string viewType = ExtractStringFromMap(arguments, "viewType");
int viewId = ExtractIntFromMap(arguments, "id");
Expand All @@ -147,15 +147,9 @@ void PlatformViewChannel::HandleMethodCall(

auto viewInstance =
it->second->Create(viewId, width, height, byteMessage);
viewInstance->SetFocus(true);
view_instances_.insert(
std::pair<int, PlatformView*>(viewId, viewInstance));

if (channel_ != nullptr) {
auto id = std::make_unique<flutter::EncodableValue>(viewId);
channel_->InvokeMethod("viewFocused", std::move(id));
}

if (engine_ && engine_->text_input_channel) {
Ecore_IMF_Context* context =
engine_->text_input_channel->GetImfContext();
Expand All @@ -174,6 +168,7 @@ void PlatformViewChannel::HandleMethodCall(
};
auto it = view_instances_.find(viewId);
if (viewId >= 0 && it != view_instances_.end()) {
it->second->SetFocus(false);
bbrto21 marked this conversation as resolved.
Show resolved Hide resolved
it->second->ClearFocus();
result->Success();
} else {
Expand Down Expand Up @@ -209,6 +204,20 @@ void PlatformViewChannel::HandleMethodCall(
dy = std::get<double>(event[5]);

it->second->Touch(type, button, x, y, dx, dy);

if (!it->second->IsFocused()) {
auto focuesdView = view_instances_.find(CurrentFocusedViewId());
if (focuesdView != view_instances_.end()) {
focuesdView->second->SetFocus(false);
}

it->second->SetFocus(true);
if (channel_ != nullptr) {
auto id = std::make_unique<flutter::EncodableValue>(viewId);
channel_->InvokeMethod("viewFocused", std::move(id));
}
}

result->Success();
} else if (method == "setDirection") {
FT_LOGD("PlatformViewChannel setDirection");
Expand Down