| Flutter Linux Embedder |

Classes | Functions
fl_key_event.cc File Reference
`#include "flutter/shell/platform/linux/fl_key_event.h"`

Go to the source code of this file.

## Classes
struct | _FlKeyEvent

## Functions
FlKeyEvent * | fl_key_event_new (guint32 time, gboolean is_press, guint16 keycode, guint keyval, GdkModifierType state, guint8 group)
FlKeyEvent * | fl_key_event_new_from_gdk_event (GdkEvent *event)
guint32 | fl_key_event_get_time (FlKeyEvent *self)
gboolean | fl_key_event_get_is_press (FlKeyEvent *self)
guint16 | fl_key_event_get_keycode (FlKeyEvent *self)
guint | fl_key_event_get_keyval (FlKeyEvent *self)
GdkModifierType | fl_key_event_get_state (FlKeyEvent *self)
guint8 | fl_key_event_get_group (FlKeyEvent *self)
GdkEvent * | fl_key_event_get_origin (FlKeyEvent *self)
static void | fl_key_event_dispose (GObject *object)
static void | fl_key_event_class_init (FlKeyEventClass *klass)
static void | fl_key_event_init (FlKeyEvent *self)

## Function Documentation

## ◆ fl_key_event_class_init()

static void fl_key_event_class_init | ( | FlKeyEventClass * | klass | ) |
| static

Definition at line 122 of file fl_key_event.cc.

122 {
123 G_OBJECT_CLASS(klass)->dispose = fl_key_event_dispose;
124 }
fl_key_event_dispose
static void fl_key_event_dispose(GObject *object)
Definition: fl_key_event.cc:114

References fl_key_event_dispose().

## ◆ fl_key_event_dispose()

static void fl_key_event_dispose | ( | GObject * | object | ) |
| static

Definition at line 114 of file fl_key_event.cc.

114 {
115 FlKeyEvent* self = FL_KEY_EVENT(object);
116
117 g_clear_pointer(&self->origin, gdk_event_free);
118
119 G_OBJECT_CLASS(fl_key_event_parent_class)->dispose(object);
120 }

Referenced by fl_key_event_class_init().

## ◆ fl_key_event_get_group()

guint8 fl_key_event_get_group | ( | FlKeyEvent * | self | ) |

Definition at line 104 of file fl_key_event.cc.

104 {
105 g_return_val_if_fail(FL_IS_KEY_EVENT(self), 0);
106 return self->group;
107 }

Referenced by fl_keyboard_manager_handle_event(), and guarantee_layout().

## ◆ fl_key_event_get_is_press()

gboolean fl_key_event_get_is_press | ( | FlKeyEvent * | self | ) |

Definition at line 84 of file fl_key_event.cc.

84 {
85 g_return_val_if_fail(FL_IS_KEY_EVENT(self), FALSE);
86 return self->is_press;
87 }

Referenced by event_is_redispatched(), fl_key_channel_responder_handle_event(), fl_key_embedder_responder_handle_event_impl(), and fl_text_input_handler_filter_keypress().

## ◆ fl_key_event_get_keycode()

guint16 fl_key_event_get_keycode | ( | FlKeyEvent * | self | ) |

Definition at line 89 of file fl_key_event.cc.

89 {
90 g_return_val_if_fail(FL_IS_KEY_EVENT(self), 0);
91 return self->keycode;
92 }

Referenced by event_is_redispatched(), event_to_physical_key(), fl_key_channel_responder_handle_event(), fl_keyboard_manager_handle_event(), and guarantee_layout().

## ◆ fl_key_event_get_keyval()

guint fl_key_event_get_keyval | ( | FlKeyEvent * | self | ) |

Definition at line 94 of file fl_key_event.cc.

94 {
95 g_return_val_if_fail(FL_IS_KEY_EVENT(self), 0);
96 return self->keyval;
97 }

Referenced by event_to_character(), event_to_logical_key(), fl_key_channel_responder_handle_event(), and fl_text_input_handler_filter_keypress().

## ◆ fl_key_event_get_origin()

GdkEvent* fl_key_event_get_origin | ( | FlKeyEvent * | self | ) |

Definition at line 109 of file fl_key_event.cc.

109 {
110 g_return_val_if_fail(FL_IS_KEY_EVENT(self), nullptr);
111 return self->origin;
112 }

Referenced by fl_text_input_handler_filter_keypress().

## ◆ fl_key_event_get_state()

GdkModifierType fl_key_event_get_state | ( | FlKeyEvent * | self | ) |

Definition at line 99 of file fl_key_event.cc.

99 {
100 g_return_val_if_fail(FL_IS_KEY_EVENT(self), static_cast<GdkModifierType>(0));
101 return self->state;
102 }

Referenced by fl_key_channel_responder_handle_event(), fl_key_embedder_responder_handle_event_impl(), and fl_text_input_handler_filter_keypress().

## ◆ fl_key_event_get_time()

guint32 fl_key_event_get_time | ( | FlKeyEvent * | self | ) |

Definition at line 79 of file fl_key_event.cc.

79 {
80 g_return_val_if_fail(FL_IS_KEY_EVENT(self), 0);
81 return self->time;
82 }

Referenced by event_is_redispatched(), and event_to_timestamp().

## ◆ fl_key_event_init()

static void fl_key_event_init | ( | FlKeyEvent * | self | ) |
| static

Definition at line 126 of file fl_key_event.cc.

126 {}

## ◆ fl_key_event_new()

FlKeyEvent* fl_key_event_new | ( | guint32 | time,
|  | gboolean | is_press,
|  | guint16 | keycode,
|  | guint | keyval,
|  | GdkModifierType | state,
|  | guint8 | group
| ) |  |

FlKeyEvent: A struct that stores information from GdkEvent.

This is a class only used within the GTK embedding, created by FlView and consumed by FlKeyboardHandler. It is not sent to the embedder.

This object contains information from GdkEvent as well as an origin event object, so that Flutter can create an event object in unit tests even after migrating to GDK 4.0 which stops supporting creating GdkEvent.

Definition at line 34 of file fl_key_event.cc.

39 {
40 FlKeyEvent* self =
41 FL_KEY_EVENT(g_object_new(fl_key_event_get_type(), nullptr));
42
43 self->time = time;
44 self->is_press = is_press;
45 self->keycode = keycode;
46 self->keyval = keyval;
47 self->state = state;
48 self->group = group;
49
50 return self;
51 }

Referenced by TEST(), and test_lock_event().

## ◆ fl_key_event_new_from_gdk_event()

FlKeyEvent* fl_key_event_new_from_gdk_event | ( | GdkEvent * | event | ) |

fl_key_event_new_from_gdk_event: @event: the #GdkEvent this #FlKeyEvent is based on.

Create a new #FlKeyEvent based on a #GdkEvent.

Returns: a new #FlKeyEvent.

Definition at line 53 of file fl_key_event.cc.

53 {
54 FlKeyEvent* self =
55 FL_KEY_EVENT(g_object_new(fl_key_event_get_type(), nullptr));
56
57 GdkEventType type = gdk_event_get_event_type(event);
58 g_return_val_if_fail(type == GDK_KEY_PRESS || type == GDK_KEY_RELEASE,
59 nullptr);
60
61 guint16 keycode = 0;
62 gdk_event_get_keycode(event, &keycode);
63 guint keyval = 0;
64 gdk_event_get_keyval(event, &keyval);
65 GdkModifierType state = static_cast<GdkModifierType>(0);
66 gdk_event_get_state(event, &state);
67
68 self->time = gdk_event_get_time(event);
69 self->is_press = type == GDK_KEY_PRESS;
70 self->keycode = keycode;
71 self->keyval = keyval;
72 self->state = state;
73 self->group = event->key.group;
74 self->origin = event;
75
76 return self;
77 }
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1117

References type.

Referenced by handle_key_event(), and send_key_event().