-
Notifications
You must be signed in to change notification settings - Fork 9
Add input panel state event channel #142
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
flutter/shell/platform/tizen/channels/input_panel_channel.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "input_panel_channel.h" | ||
|
|
||
| #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" | ||
| #include "flutter/shell/platform/tizen/tizen_input_method_context.h" | ||
|
|
||
| namespace { | ||
|
|
||
| constexpr char kChannelName[] = "tizen/internal/inputpanel"; | ||
|
|
||
| } // namespace | ||
|
|
||
| namespace flutter { | ||
|
|
||
| InputPanelChannel::InputPanelChannel(BinaryMessenger* messenger, | ||
| TizenInputMethodContext* imf_context) | ||
| : imf_context_(imf_context) { | ||
| event_channel_ = std::make_unique<EventChannel<EncodableValue>>( | ||
| messenger, kChannelName, &StandardMethodCodec::GetInstance()); | ||
| auto event_channel_handler = std::make_unique<StreamHandlerFunctions<>>( | ||
| [this](const EncodableValue* arguments, | ||
| std::unique_ptr<EventSink<>>&& events) | ||
| -> std::unique_ptr<StreamHandlerError<>> { | ||
| event_sink_ = std::move(events); | ||
| imf_context_->SetOnInputPanelStateChanged( | ||
| [this](const std::string& state) { | ||
| SendInputPanelStateEvent(state); | ||
| }); | ||
| return nullptr; | ||
| }, | ||
| [this](const EncodableValue* arguments) | ||
| -> std::unique_ptr<StreamHandlerError<>> { | ||
| imf_context_->SetOnInputPanelStateChanged(nullptr); | ||
| event_sink_.reset(); | ||
| return nullptr; | ||
| }); | ||
|
|
||
| event_channel_->SetStreamHandler(std::move(event_channel_handler)); | ||
| } | ||
|
|
||
| InputPanelChannel::~InputPanelChannel() { | ||
| event_channel_->SetStreamHandler(nullptr); | ||
|
|
||
| imf_context_->SetOnInputPanelStateChanged(nullptr); | ||
| } | ||
|
|
||
| void InputPanelChannel::SendInputPanelStateEvent(const std::string& state) { | ||
| if (!event_sink_) { | ||
| return; | ||
| } | ||
|
|
||
| EncodableMap event; | ||
| event[EncodableValue("state")] = EncodableValue(state); | ||
| event_sink_->Success(EncodableValue(event)); | ||
| } | ||
|
|
||
| } // namespace flutter | ||
35 changes: 35 additions & 0 deletions
35
flutter/shell/platform/tizen/channels/input_panel_channel.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #ifndef EMBEDDER_INPUT_PANEL_CHANNEL_H_ | ||
| #define EMBEDDER_INPUT_PANEL_CHANNEL_H_ | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h" | ||
| #include "flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h" | ||
| #include "flutter/shell/platform/common/client_wrapper/include/flutter/event_channel.h" | ||
|
|
||
| namespace flutter { | ||
|
|
||
| class TizenInputMethodContext; | ||
|
|
||
| class InputPanelChannel { | ||
| public: | ||
| explicit InputPanelChannel(BinaryMessenger* messenger, | ||
| TizenInputMethodContext* imf_context); | ||
| virtual ~InputPanelChannel(); | ||
|
|
||
| private: | ||
| void SendInputPanelStateEvent(const std::string& state); | ||
|
|
||
| std::unique_ptr<EventChannel<EncodableValue>> event_channel_; | ||
| std::unique_ptr<EventSink<EncodableValue>> event_sink_; | ||
| TizenInputMethodContext* imf_context_; | ||
| }; | ||
|
|
||
| } // namespace flutter | ||
|
|
||
| #endif // EMBEDDER_INPUT_PANEL_CHANNEL_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.