| Flutter Linux Embedder |

fl_keyboard_manager.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_KEYBOARD_MANAGER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEYBOARD_MANAGER_H_
7
8 #include <gdk/gdk.h>
9
10 #include "flutter/shell/platform/linux/fl_keyboard_view_delegate.h"
11
12 G_BEGIN_DECLS
13
14 #define FL_TYPE_KEYBOARD_MANAGER fl_keyboard_manager_get_type()
15 G_DECLARE_FINAL_TYPE(FlKeyboardManager,
16 fl_keyboard_manager,
17 FL,
18 KEYBOARD_MANAGER,
19 GObject);
20
21 /**
22 * FlKeyboardManager:
23 *
24 * Processes keyboard events and cooperate with `TextInputPlugin`.
25 *
26 * A keyboard event goes through a few sections, each can choose to handle the
27 * event, and only unhandled events can move to the next section:
28 *
29 * - Keyboard: Dispatch to the embedder responder and the channel responder
30 * simultaneously. After both responders have responded (asynchronously), the
31 * event is considered handled if either responder handles it.
32 * - Text input: Events are sent to IM filter (usually owned by
33 * `TextInputPlugin`) and are handled synchronously.
34 * - Redispatching: Events are inserted back to the system for redispatching.
35 */
36
37 /**
38 * fl_keyboard_manager_new:
39 * @view_delegate: An interface that the manager requires to communicate with
40 * the platform. Usually implemented by FlView.
41 *
42 * Create a new #FlKeyboardManager.
43 *
44 * Returns: a new #FlKeyboardManager.
45 */
46 FlKeyboardManager* fl_keyboard_manager_new(
47 FlBinaryMessenger* messenger,
48 FlKeyboardViewDelegate* view_delegate);
49
50 /**
51 * fl_keyboard_manager_handle_event:
52 * @manager: the #FlKeyboardManager self.
53 * @event: the event to be dispatched. It is usually a wrap of a GdkEventKey.
54 * This event will be managed and released by #FlKeyboardManager.
55 *
56 * Make the manager process a system key event. This might eventually send
57 * messages to the framework, trigger text input effects, or redispatch the
58 * event back to the system.
59 */
60 gboolean fl_keyboard_manager_handle_event(FlKeyboardManager* manager,
61 FlKeyEvent* event);
62
63 /**
64 * fl_keyboard_manager_is_state_clear:
65 * @manager: the #FlKeyboardManager self.
66 *
67 * A debug-only method that queries whether the manager's various states are
68 * cleared, i.e. no pending events for redispatching or for responding.
69 *
70 * Returns: true if the manager's various states are cleared.
71 */
72 gboolean fl_keyboard_manager_is_state_clear(FlKeyboardManager* manager);
73
74 /**
75 * fl_keyboard_manager_sync_modifier_if_needed:
76 * @manager: the #FlKeyboardManager self.
77 * @state: the state of the modifiers mask.
78 * @event_time: the time attribute of the incoming GDK event.
79 *
80 * If needed, synthesize modifier keys up and down event by comparing their
81 * current pressing states with the given modifiers mask.
82 */
83 void fl_keyboard_manager_sync_modifier_if_needed(FlKeyboardManager* manager,
84 guint state,
85 double event_time);
86
87 /**
88 * fl_keyboard_manager_get_pressed_state:
89 * @manager: the #FlKeyboardManager self.
90 *
91 * Returns the keyboard pressed state. The hash table contains one entry per
92 * pressed keys, mapping from the logical key to the physical key.*
93 */
94 GHashTable* fl_keyboard_manager_get_pressed_state(FlKeyboardManager* manager);
95
96 G_END_DECLS
97
98 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEYBOARD_MANAGER_H_
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
G_DECLARE_FINAL_TYPE
G_DECLARE_FINAL_TYPE(FlKeyboardManager, fl_keyboard_manager, FL, KEYBOARD_MANAGER, GObject)
fl_keyboard_manager_is_state_clear
gboolean fl_keyboard_manager_is_state_clear(FlKeyboardManager *manager)
Definition: fl_keyboard_manager.cc:666
_FlKeyEvent
Definition: fl_key_event.h:31
state
AtkStateType state
Definition: fl_accessible_node.cc:10
fl_keyboard_manager_new
FlKeyboardManager * fl_keyboard_manager_new(FlBinaryMessenger *messenger, FlKeyboardViewDelegate *view_delegate)
Definition: fl_keyboard_manager.cc:585
fl_keyboard_manager_handle_event
gboolean fl_keyboard_manager_handle_event(FlKeyboardManager *manager, FlKeyEvent *event)
Definition: fl_keyboard_manager.cc:635
FL
FL
Definition: fl_binary_messenger.cc:27
fl_keyboard_manager_sync_modifier_if_needed
void fl_keyboard_manager_sync_modifier_if_needed(FlKeyboardManager *manager, guint state, double event_time)
Definition: fl_keyboard_manager.cc:672
fl_keyboard_view_delegate.h
fl_keyboard_manager_get_pressed_state
GHashTable * fl_keyboard_manager_get_pressed_state(FlKeyboardManager *manager)
Definition: fl_keyboard_manager.cc:685
FlKeyboardManager
typedefG_BEGIN_DECLS struct _FlKeyboardManager FlKeyboardManager
Definition: fl_key_responder.h:17