forked from flutter-tizen/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext_input_channel.h
More file actions
84 lines (74 loc) · 3.34 KB
/
text_input_channel.h
File metadata and controls
84 lines (74 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2020 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_TEXT_INPUT_PLUGIN_H_
#define EMBEDDER_TEXT_INPUT_PLUGIN_H_
#define EFL_BETA_API_SUPPORT
#include <Ecore_IMF.h>
#include <Ecore_Input.h>
#include <Ecore_Wl2.h>
#include <string>
#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h"
#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h"
#include "flutter/shell/platform/common/cpp/json_method_codec.h"
#include "flutter/shell/platform/common/cpp/text_input_model.h"
class TizenEmbedderEngine;
class TextInputChannel {
public:
struct SoftwareKeyboardGeometry {
int32_t x = 0, y = 0, w = 0, h = 0;
};
explicit TextInputChannel(flutter::BinaryMessenger* messenger,
TizenEmbedderEngine* engine);
virtual ~TextInputChannel();
void OnKeyDown(Ecore_Event_Key* key);
void OnCommit(const char* str);
void OnPredit(const char* str, int cursorPos);
void ShowSoftwareKeyboard();
void HideSoftwareKeyboard();
bool IsSoftwareKeyboardShowing() { return isSoftwareKeyboardShowing_; }
SoftwareKeyboardGeometry GetCurrentKeyboardGeometry() {
return current_keyboard_geometry_;
}
int32_t rotation = 0;
private:
void HandleMethodCall(
const flutter::MethodCall<rapidjson::Document>& method_call,
std::unique_ptr<flutter::MethodResult<rapidjson::Document>> result);
void SendStateUpdate(const flutter::TextInputModel& model);
bool FilterEvent(Ecore_Event_Key* keyDownEvent);
void NonIMFFallback(Ecore_Event_Key* keyDownEvent);
void EnterPressed(flutter::TextInputModel* model);
void SelectPressed(flutter::TextInputModel* model);
void RegisterIMFCallback(Ecore_Wl2_Window* ecoreWindow);
void UnregisterIMFCallback();
std::unique_ptr<flutter::MethodChannel<rapidjson::Document>> channel_;
std::unique_ptr<flutter::TextInputModel> active_model_;
static void CommitCallback(void* data, Ecore_IMF_Context* ctx,
void* event_info);
static void PreeditCallback(void* data, Ecore_IMF_Context* ctx,
void* event_info);
static void PrivateCommandCallback(void* data, Ecore_IMF_Context* ctx,
void* event_info);
static void DeleteSurroundingCallback(void* data, Ecore_IMF_Context* ctx,
void* event_info);
static void InputPanelStateChangedCallback(void* data,
Ecore_IMF_Context* context,
int value);
static void InputPanelGeometryChangedCallback(void* data,
Ecore_IMF_Context* context,
int value);
static Eina_Bool RetrieveSurroundingCallback(void* data,
Ecore_IMF_Context* ctx,
char** text, int* cursor_pos);
int client_id_;
std::string input_type_;
std::string input_action_;
bool isSoftwareKeyboardShowing_;
int lastPreeditStringLength_;
Ecore_IMF_Context* imfContext_;
bool inSelectMode_;
TizenEmbedderEngine* engine_;
SoftwareKeyboardGeometry current_keyboard_geometry_;
};
#endif