#include "flutter/shell/platform/linux/fl_key_embedder_responder.h"
#include <gtk/gtk.h>
#include <cinttypes>
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/linux/fl_key_embedder_responder_private.h"
#include "flutter/shell/platform/linux/key_mapping.h"
Go to the source code of this file.
Classes | |
struct | _FlKeyEmbedderUserData |
struct | _FlKeyEmbedderResponder |
Macros | |
#define | FL_TYPE_EMBEDDER_USER_DATA fl_key_embedder_user_data_get_type() |
#define | FL_TYPE_EMBEDDER_RESPONDER_USER_DATA fl_key_embedder_responder_get_type() |
Functions | |
static uint64_t | lookup_hash_table (GHashTable *table, uint64_t key) |
static gboolean | hash_table_find_equal_value (gpointer key, gpointer value, gpointer user_data) |
static uint64_t | reverse_lookup_hash_table (GHashTable *table, uint64_t value) |
static uint64_t | to_lower (uint64_t n) |
G_DECLARE_FINAL_TYPE (FlKeyEmbedderUserData, fl_key_embedder_user_data, FL, KEY_EMBEDDER_USER_DATA, GObject) | |
static void | fl_key_embedder_user_data_dispose (GObject *object) |
static void | fl_key_embedder_user_data_class_init (FlKeyEmbedderUserDataClass *klass) |
static void | fl_key_embedder_user_data_init (FlKeyEmbedderUserData *self) |
static FlKeyEmbedderUserData * | fl_key_embedder_user_data_new (FlKeyResponderAsyncCallback callback, gpointer user_data) |
static void | fl_key_embedder_responder_iface_init (FlKeyResponderInterface *iface) |
static void | fl_key_embedder_responder_dispose (GObject *object) |
G_DEFINE_TYPE_WITH_CODE (FlKeyEmbedderResponder, fl_key_embedder_responder, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(FL_TYPE_KEY_RESPONDER, fl_key_embedder_responder_iface_init)) static void fl_key_embedder_responder_handle_event(FlKeyResponder *responder | |
static void | fl_key_embedder_responder_class_init (FlKeyEmbedderResponderClass *klass) |
static void | fl_key_embedder_responder_init (FlKeyEmbedderResponder *self) |
static void | initialize_logical_key_to_lock_bit_loop_body (gpointer lock_bit, gpointer value, gpointer user_data) |
FlKeyEmbedderResponder * | fl_key_embedder_responder_new (EmbedderSendKeyEvent send_key_event, void *send_key_event_user_data) |
static uint64_t | apply_id_plane (uint64_t logical_id, uint64_t plane) |
static uint64_t | event_to_physical_key (const FlKeyEvent *event) |
static uint64_t | event_to_logical_key (const FlKeyEvent *event) |
static uint64_t | event_to_timestamp (const FlKeyEvent *event) |
static char * | event_to_character (const FlKeyEvent *event) |
static void | handle_response (bool handled, gpointer user_data) |
static void | synthesize_simple_event (FlKeyEmbedderResponder *self, FlutterKeyEventType type, uint64_t physical, uint64_t logical, double timestamp) |
static void | update_pressing_state (FlKeyEmbedderResponder *self, uint64_t physical_key, uint64_t logical_key) |
static void | possibly_update_lock_bit (FlKeyEmbedderResponder *self, uint64_t logical_key, bool is_down) |
static void | update_mapping_record (FlKeyEmbedderResponder *self, uint64_t physical_key, uint64_t logical_key) |
static void | synchronize_pressed_states_loop_body (gpointer key, gpointer value, gpointer user_data) |
static int | find_stage_by_record (bool is_down, bool is_enabled) |
static int | find_stage_by_self_event (int stage_by_record, bool is_down_event, bool is_state_on, bool reverse_state_logic) |
static int | find_stage_by_others_event (int stage_by_record, bool is_state_on) |
static void | update_caps_lock_state_logic_inferrence (FlKeyEmbedderResponder *self, bool is_down_event, bool enabled_by_state, int stage_by_record) |
static void | synchronize_lock_states_loop_body (gpointer key, gpointer value, gpointer user_data) |
static void | is_known_modifier_physical_key_loop_body (gpointer key, gpointer value, gpointer user_data) |
static void | find_physical_from_logical_loop_body (gpointer key, gpointer value, gpointer user_data) |
static uint64_t | corrected_modifier_physical_key (GHashTable *modifier_bit_to_checked_keys, uint64_t physical_key_from_event, uint64_t logical_key) |
static void | fl_key_embedder_responder_handle_event_impl (FlKeyResponder *responder, FlKeyEvent *event, uint64_t specified_logical_key, FlKeyResponderAsyncCallback callback, gpointer user_data) |
static void | fl_key_embedder_responder_handle_event (FlKeyResponder *responder, FlKeyEvent *event, uint64_t specified_logical_key, FlKeyResponderAsyncCallback callback, gpointer user_data) |
void | fl_key_embedder_responder_sync_modifiers_if_needed (FlKeyEmbedderResponder *responder, guint state, double event_time) |
GHashTable * | fl_key_embedder_responder_get_pressed_state (FlKeyEmbedderResponder *self) |
Variables | |
constexpr uint64_t | kMicrosecondsPerMillisecond = 1000 |
static const FlutterKeyEvent | kEmptyEvent |
FlKeyEvent * | event |
FlKeyEvent uint64_t | specified_logical_key |
FlKeyEvent uint64_t FlKeyResponderAsyncCallback | callback |
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer | user_data |
#define FL_TYPE_EMBEDDER_RESPONDER_USER_DATA fl_key_embedder_responder_get_type() |
Definition at line 204 of file fl_key_embedder_responder.cc.
#define FL_TYPE_EMBEDDER_USER_DATA fl_key_embedder_user_data_get_type() |
FlKeyEmbedderUserData: The user_data used when #FlKeyEmbedderResponder sends message through the embedder.SendKeyEvent API.
Definition at line 83 of file fl_key_embedder_responder.cc.
|
static |
Definition at line 296 of file fl_key_embedder_responder.cc.
References kValueMask.
Referenced by event_to_logical_key(), and event_to_physical_key().
|
static |
Definition at line 747 of file fl_key_embedder_responder.cc.
References find_physical_from_logical_loop_body(), and is_known_modifier_physical_key_loop_body().
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 328 of file fl_key_embedder_responder.cc.
References event, _FlKeyEvent::keyval, and result.
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 308 of file fl_key_embedder_responder.cc.
References apply_id_plane(), gtk_keyval_to_logical_key_map, kGtkPlane, kUnicodePlane, and to_lower().
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 300 of file fl_key_embedder_responder.cc.
References apply_id_plane(), event, _FlKeyEvent::keycode, kGtkPlane, and xkb_to_physical_key_map.
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 322 of file fl_key_embedder_responder.cc.
References kMicrosecondsPerMillisecond.
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 733 of file fl_key_embedder_responder.cc.
References FlKeyEmbedderCheckedKey::primary_logical_key, FlKeyEmbedderCheckedKey::primary_physical_key, FlKeyEmbedderCheckedKey::secondary_logical_key, user_data, and value.
Referenced by corrected_modifier_physical_key().
|
static |
Definition at line 555 of file fl_key_embedder_responder.cc.
Referenced by synchronize_lock_states_loop_body().
|
static |
Definition at line 528 of file fl_key_embedder_responder.cc.
Referenced by synchronize_lock_states_loop_body().
|
static |
Definition at line 540 of file fl_key_embedder_responder.cc.
Referenced by synchronize_lock_states_loop_body(), and update_caps_lock_state_logic_inferrence().
|
static |
Definition at line 226 of file fl_key_embedder_responder.cc.
References fl_key_embedder_responder_dispose().
|
static |
Definition at line 235 of file fl_key_embedder_responder.cc.
Referenced by fl_key_embedder_responder_class_init().
GHashTable* fl_key_embedder_responder_get_pressed_state | ( | FlKeyEmbedderResponder * | responder | ) |
fl_key_embedder_responder_get_pressed_state: @responder: the #FlKeyEmbedderResponder 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 895 of file fl_key_embedder_responder.cc.
Referenced by fl_keyboard_manager_get_pressed_state().
|
static |
Definition at line 862 of file fl_key_embedder_responder.cc.
References callback, event, fl_key_embedder_responder_handle_event_impl(), kEmptyEvent, specified_logical_key, and user_data.
Referenced by fl_key_embedder_responder_iface_init().
|
static |
Definition at line 775 of file fl_key_embedder_responder.cc.
References callback, corrected_modifier_physical_key(), event, event_to_character(), event_to_logical_key(), event_to_physical_key(), event_to_timestamp(), fl_key_embedder_user_data_new(), handle_response(), lookup_hash_table(), possibly_update_lock_bit(), specified_logical_key, synchronize_lock_states_loop_body(), synchronize_pressed_states_loop_body(), update_mapping_record(), update_pressing_state(), and user_data.
Referenced by fl_key_embedder_responder_handle_event().
|
static |
Definition at line 220 of file fl_key_embedder_responder.cc.
References fl_key_embedder_responder_handle_event().
|
static |
Definition at line 232 of file fl_key_embedder_responder.cc.
FlKeyEmbedderResponder* fl_key_embedder_responder_new | ( | EmbedderSendKeyEvent | send_key_event, |
void * | send_key_event_user_data | ||
) |
FlKeyEmbedderResponder:
A #FlKeyResponder that handles events by sending the converted events through the embedder API.
This class communicates with the HardwareKeyboard API in the framework. fl_key_embedder_responder_new: @engine: The #FlEngine, whose the embedder API will be used to send the event.
Creates a new #FlKeyEmbedderResponder. @send_key_event: a function that is called on every key event. @send_key_event_user_data: an opaque pointer that will be sent back as the last argument of send_key_event, created and managed by the object that holds FlKeyEmbedderResponder.
Returns: a new #FlKeyEmbedderResponder.
Definition at line 263 of file fl_key_embedder_responder.cc.
References FL_TYPE_EMBEDDER_RESPONDER_USER_DATA, initialize_lock_bit_to_checked_keys(), initialize_logical_key_to_lock_bit_loop_body(), initialize_modifier_bit_to_checked_keys(), and send_key_event().
Referenced by fl_keyboard_manager_new(), and TEST().
void fl_key_embedder_responder_sync_modifiers_if_needed | ( | FlKeyEmbedderResponder * | responder, |
guint | state, | ||
double | event_time | ||
) |
fl_key_embedder_responder_sync_modifiers_if_needed: @responder: the #FlKeyEmbedderResponder 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 878 of file fl_key_embedder_responder.cc.
References kMicrosecondsPerMillisecond, state, and synchronize_pressed_states_loop_body().
Referenced by fl_keyboard_manager_sync_modifier_if_needed().
|
static |
Definition at line 101 of file fl_key_embedder_responder.cc.
References fl_key_embedder_user_data_dispose().
|
static |
Definition at line 108 of file fl_key_embedder_responder.cc.
Referenced by fl_key_embedder_user_data_class_init().
|
static |
Definition at line 106 of file fl_key_embedder_responder.cc.
|
static |
Definition at line 117 of file fl_key_embedder_responder.cc.
References callback, FL_TYPE_EMBEDDER_USER_DATA, and user_data.
Referenced by fl_key_embedder_responder_handle_event_impl().
G_DECLARE_FINAL_TYPE | ( | FlKeyEmbedderUserData | , |
fl_key_embedder_user_data | , | ||
FL | , | ||
KEY_EMBEDDER_USER_DATA | , | ||
GObject | |||
) |
G_DEFINE_TYPE_WITH_CODE | ( | FlKeyEmbedderResponder | , |
fl_key_embedder_responder | , | ||
G_TYPE_OBJECT | , | ||
G_IMPLEMENT_INTERFACE(FL_TYPE_KEY_RESPONDER, fl_key_embedder_responder_iface_init) | |||
) |
|
static |
Definition at line 343 of file fl_key_embedder_responder.cc.
References user_data.
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 36 of file fl_key_embedder_responder.cc.
References gpointer_to_uint64(), user_data, and value.
Referenced by reverse_lookup_hash_table().
|
static |
Definition at line 251 of file fl_key_embedder_responder.cc.
References FlKeyEmbedderCheckedKey::primary_logical_key, uint64_to_gpointer(), user_data, and value.
Referenced by fl_key_embedder_responder_new().
|
static |
Definition at line 716 of file fl_key_embedder_responder.cc.
References FlKeyEmbedderCheckedKey::primary_physical_key, user_data, and value.
Referenced by corrected_modifier_physical_key().
|
static |
Definition at line 31 of file fl_key_embedder_responder.cc.
References gpointer_to_uint64(), and uint64_to_gpointer().
Referenced by fl_key_embedder_responder_handle_event_impl(), synchronize_lock_states_loop_body(), synchronize_pressed_states_loop_body(), and update_pressing_state().
|
static |
Definition at line 419 of file fl_key_embedder_responder.cc.
References uint64_to_gpointer().
Referenced by fl_key_embedder_responder_handle_event_impl(), and synchronize_lock_states_loop_body().
|
static |
Definition at line 48 of file fl_key_embedder_responder.cc.
References gpointer_to_uint64(), hash_table_find_equal_value(), uint64_to_gpointer(), and value.
Referenced by synchronize_pressed_states_loop_body().
|
static |
Definition at line 609 of file fl_key_embedder_responder.cc.
References find_stage_by_others_event(), find_stage_by_record(), find_stage_by_self_event(), FlKeyEmbedderCheckedKey::is_caps_lock, lookup_hash_table(), possibly_update_lock_bit(), FlKeyEmbedderCheckedKey::primary_logical_key, FlKeyEmbedderCheckedKey::primary_physical_key, synthesize_simple_event(), type, update_caps_lock_state_logic_inferrence(), update_mapping_record(), update_pressing_state(), user_data, and value.
Referenced by fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 443 of file fl_key_embedder_responder.cc.
References length, lookup_hash_table(), FlKeyEmbedderCheckedKey::primary_logical_key, FlKeyEmbedderCheckedKey::primary_physical_key, reverse_lookup_hash_table(), FlKeyEmbedderCheckedKey::secondary_logical_key, synthesize_simple_event(), update_mapping_record(), update_pressing_state(), user_data, and value.
Referenced by fl_key_embedder_responder_handle_event_impl(), and fl_key_embedder_responder_sync_modifiers_if_needed().
|
static |
Definition at line 352 of file fl_key_embedder_responder.cc.
References type.
Referenced by synchronize_lock_states_loop_body(), and synchronize_pressed_states_loop_body().
|
static |
|
static |
Definition at line 582 of file fl_key_embedder_responder.cc.
References find_stage_by_self_event().
Referenced by synchronize_lock_states_loop_body().
|
static |
Definition at line 432 of file fl_key_embedder_responder.cc.
References uint64_to_gpointer().
Referenced by fl_key_embedder_responder_handle_event_impl(), synchronize_lock_states_loop_body(), and synchronize_pressed_states_loop_body().
|
static |
Definition at line 398 of file fl_key_embedder_responder.cc.
References lookup_hash_table(), and uint64_to_gpointer().
Referenced by fl_key_embedder_responder_handle_event_impl(), synchronize_lock_states_loop_body(), and synchronize_pressed_states_loop_body().
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback |
Definition at line 217 of file fl_key_embedder_responder.cc.
Referenced by fl_key_embedder_responder_handle_event(), fl_key_embedder_responder_handle_event_impl(), and fl_key_embedder_user_data_new().
FlKeyEvent* event |
Definition at line 215 of file fl_key_embedder_responder.cc.
Referenced by event_to_character(), event_to_physical_key(), fl_key_embedder_responder_handle_event(), and fl_key_embedder_responder_handle_event_impl().
|
static |
Definition at line 16 of file fl_key_embedder_responder.cc.
Referenced by fl_key_embedder_responder_handle_event().
|
constexpr |
Definition at line 14 of file fl_key_embedder_responder.cc.
Referenced by event_to_timestamp(), and fl_key_embedder_responder_sync_modifiers_if_needed().
FlKeyEvent uint64_t specified_logical_key |
Definition at line 216 of file fl_key_embedder_responder.cc.
Referenced by fl_key_embedder_responder_handle_event(), and fl_key_embedder_responder_handle_event_impl().
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data |
Definition at line 218 of file fl_key_embedder_responder.cc.
Referenced by find_physical_from_logical_loop_body(), fl_key_embedder_responder_handle_event(), fl_key_embedder_responder_handle_event_impl(), fl_key_embedder_user_data_new(), handle_response(), hash_table_find_equal_value(), initialize_logical_key_to_lock_bit_loop_body(), is_known_modifier_physical_key_loop_body(), synchronize_lock_states_loop_body(), and synchronize_pressed_states_loop_body().