#include "flutter/shell/platform/linux/fl_keyboard_manager.h"#include <array>#include <cinttypes>#include <memory>#include <string>#include "flutter/shell/platform/linux/fl_key_channel_responder.h"#include "flutter/shell/platform/linux/fl_key_embedder_responder.h"#include "flutter/shell/platform/linux/fl_keyboard_layout.h"#include "flutter/shell/platform/linux/key_mapping.h"Go to the source code of this file.
Classes | |
| struct | HandleEventData |
| struct | _FlKeyboardManager |
Macros | |
| #define | DEBUG_PRINT_LAYOUT |
Functions | |
| static HandleEventData * | handle_event_data_new (FlKeyEvent *event) |
| static void | handle_event_data_free (HandleEventData *data) |
| G_DEFINE_TYPE (FlKeyboardManager, fl_keyboard_manager, G_TYPE_OBJECT) | |
| static gboolean | event_is_redispatched (FlKeyboardManager *self, FlKeyEvent *event) |
| static void | keymap_keys_changed_cb (FlKeyboardManager *self) |
| static void | complete_handle_event (FlKeyboardManager *self, GTask *task) |
| static void | responder_handle_embedder_event_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
| static void | responder_handle_channel_event_cb (GObject *object, GAsyncResult *result, gpointer user_data) |
| static uint16_t | convert_key_to_char (FlKeyboardManager *self, guint keycode, gint group, gint level) |
| static void | guarantee_layout (FlKeyboardManager *self, FlKeyEvent *event) |
| static void | fl_keyboard_manager_dispose (GObject *object) |
| static void | fl_keyboard_manager_class_init (FlKeyboardManagerClass *klass) |
| static void | fl_keyboard_manager_init (FlKeyboardManager *self) |
| FlKeyboardManager * | fl_keyboard_manager_new (FlEngine *engine) |
| void | fl_keyboard_manager_add_redispatched_event (FlKeyboardManager *self, FlKeyEvent *event) |
| void | fl_keyboard_manager_handle_event (FlKeyboardManager *self, FlKeyEvent *event, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) |
| gboolean | fl_keyboard_manager_handle_event_finish (FlKeyboardManager *self, GAsyncResult *result, FlKeyEvent **redispatched_event, GError **error) |
| void | fl_keyboard_manager_sync_modifier_if_needed (FlKeyboardManager *self, guint state, double event_time) |
| GHashTable * | fl_keyboard_manager_get_pressed_state (FlKeyboardManager *self) |
| void | fl_keyboard_manager_set_lookup_key_handler (FlKeyboardManager *self, FlKeyboardManagerLookupKeyHandler lookup_key_handler, gpointer user_data) |
| #define DEBUG_PRINT_LAYOUT |
Definition at line 19 of file fl_keyboard_manager.cc.
|
static |
Definition at line 147 of file fl_keyboard_manager.cc.
References data, HandleEventData::redispatch, and TRUE.
Referenced by responder_handle_channel_event_cb(), and responder_handle_embedder_event_cb().
|
static |
Definition at line 212 of file fl_keyboard_manager.cc.
References gdk_keymap_lookup_key(), key, and self.
Referenced by guarantee_layout().
|
static |
Definition at line 123 of file fl_keyboard_manager.cc.
References fl_key_event_get_is_press(), fl_key_event_get_keycode(), fl_key_event_get_time(), i, self, and TRUE.
Referenced by fl_keyboard_manager_handle_event().
| void fl_keyboard_manager_add_redispatched_event | ( | FlKeyboardManager * | manager, |
| FlKeyEvent * | event | ||
| ) |
fl_keyboard_manager_add_redispatched_event: @manager: an #FlKeyboardManager. @event: an event that will be handled by the manager in the future.
Add an event that will be redispatched and handled by the manager in the future. When that event is received it will be ignored.
Definition at line 367 of file fl_keyboard_manager.cc.
References self.
|
static |
Definition at line 330 of file fl_keyboard_manager.cc.
References fl_keyboard_manager_dispose().
|
static |
Definition at line 309 of file fl_keyboard_manager.cc.
References self.
Referenced by fl_keyboard_manager_class_init().
| GHashTable * fl_keyboard_manager_get_pressed_state | ( | FlKeyboardManager * | manager | ) |
fl_keyboard_manager_get_pressed_state: @manager: the #FlKeyboardManager self.
Returns the keyboard pressed state. The hash table contains one entry per pressed keys, mapping from the logical key to the physical key.*
Definition at line 435 of file fl_keyboard_manager.cc.
References fl_key_embedder_responder_get_pressed_state(), and self.
Referenced by get_keyboard_state().
| void fl_keyboard_manager_handle_event | ( | FlKeyboardManager * | manager, |
| FlKeyEvent * | event, | ||
| GCancellable * | cancellable, | ||
| GAsyncReadyCallback | callback, | ||
| gpointer | user_data | ||
| ) |
fl_keyboard_manager_handle_event: @manager: an #FlKeyboardManager. @event: the event to be dispatched. It is usually a wrap of a GdkEventKey. This event will be managed and released by #FlKeyboardManager. @cancellable: (allow-none): a #GCancellable or NULL. @callback: (scope async): a #GAsyncReadyCallback to call when the view is added. @user_data: (closure): user data to pass to @callback.
Make the manager process a system key event. This might eventually send messages to the framework, trigger text input effects, or redispatch the event back to the system.
Definition at line 374 of file fl_keyboard_manager.cc.
References callback, data, event_is_redispatched(), fl_key_channel_responder_handle_event(), fl_key_embedder_responder_handle_event(), fl_key_event_get_group(), fl_key_event_get_keycode(), fl_keyboard_layout_get_logical_key(), g_autoptr(), guarantee_layout(), handle_event_data_free(), handle_event_data_new(), HandleEventData::handled, responder_handle_channel_event_cb(), responder_handle_embedder_event_cb(), self, TRUE, and user_data.
Referenced by handle_key_event(), and TEST().
| gboolean fl_keyboard_manager_handle_event_finish | ( | FlKeyboardManager * | manager, |
| GAsyncResult * | result, | ||
| FlKeyEvent ** | redispatched_event, | ||
| GError ** | error | ||
| ) |
fl_keyboard_manager_handle_event_finish: @manager: an #FlKeyboardManager.
Completes request started with fl_keyboard_manager_handle_event().
Returns: TRUE on success.
Definition at line 410 of file fl_keyboard_manager.cc.
References data, error, and self.
Referenced by TEST().
|
static |
Definition at line 334 of file fl_keyboard_manager.cc.
References fl_keyboard_layout_new(), gdk_display_get_default(), gdk_keymap_get_for_display(), keymap_keys_changed_cb(), layout_goals, and self.
| FlKeyboardManager * fl_keyboard_manager_new | ( | FlEngine * | engine | ) |
FlKeyboardManager:
Processes keyboard events and cooperate with TextInputManager.
A keyboard event goes through a few sections, each can choose to handle the event, and only unhandled events can move to the next section:
TextInputManager) and are handled synchronously.Create a new #FlKeyboardManager.
Returns: a new #FlKeyboardManager.
Definition at line 356 of file fl_keyboard_manager.cc.
References engine, fl_engine_get_binary_messenger(), fl_key_channel_responder_new(), fl_key_embedder_responder_new(), and self.
Referenced by fl_engine_new_full(), setup_keyboard(), and TEST().
| void fl_keyboard_manager_set_lookup_key_handler | ( | FlKeyboardManager * | manager, |
| FlKeyboardManagerLookupKeyHandler | lookup_key_handler, | ||
| gpointer | user_data | ||
| ) |
fl_keyboard_manager_set_lookup_key_handler: @manager: the #FlKeyboardManager self.
Set the handler for key lookup, for testing purposes only.
Definition at line 441 of file fl_keyboard_manager.cc.
| void fl_keyboard_manager_sync_modifier_if_needed | ( | FlKeyboardManager * | manager, |
| guint | state, | ||
| double | event_time | ||
| ) |
fl_keyboard_manager_sync_modifier_if_needed: @manager: the #FlKeyboardManager self. @state: the state of the modifiers mask. @event_time: the time attribute of the incoming GDK event.
If needed, synthesize modifier keys up and down event by comparing their current pressing states with the given modifiers mask.
Definition at line 427 of file fl_keyboard_manager.cc.
References fl_key_embedder_responder_sync_modifiers_if_needed(), and self.
Referenced by sync_modifier_if_needed().
| G_DEFINE_TYPE | ( | FlKeyboardManager | , |
| fl_keyboard_manager | , | ||
| G_TYPE_OBJECT | |||
| ) |
|
static |
Definition at line 229 of file fl_keyboard_manager.cc.
References convert_key_to_char(), fl_key_event_get_group(), fl_key_event_get_keycode(), fl_keyboard_layout_get_logical_key(), fl_keyboard_layout_has_group(), fl_keyboard_layout_set_logical_key(), LayoutGoal::keycode, layout_goals, LayoutGoal::logical_key, and self.
Referenced by fl_keyboard_manager_handle_event().
|
static |
Definition at line 78 of file fl_keyboard_manager.cc.
References data.
Referenced by fl_keyboard_manager_handle_event().
|
static |
Definition at line 71 of file fl_keyboard_manager.cc.
References data, and HandleEventData::event.
Referenced by fl_keyboard_manager_handle_event().
|
static |
Definition at line 142 of file fl_keyboard_manager.cc.
References fl_keyboard_layout_new(), and self.
Referenced by fl_keyboard_manager_init().
|
static |
Definition at line 186 of file fl_keyboard_manager.cc.
References HandleEventData::channel_responded, complete_handle_event(), data, error, fl_key_channel_responder_handle_event_finish(), g_autoptr(), self, TRUE, and user_data.
Referenced by fl_keyboard_manager_handle_event().
|
static |
Definition at line 160 of file fl_keyboard_manager.cc.
References complete_handle_event(), data, HandleEventData::embedder_responded, error, fl_key_embedder_responder_handle_event_finish(), g_autoptr(), self, TRUE, and user_data.
Referenced by fl_keyboard_manager_handle_event().