| Flutter Linux Embedder |

fl_key_event.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_KEY_EVENT_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EVENT_H_
7
8 #include <gdk/gdk.h>
9
10 /**
11 * FlKeyEvent:
12 * A struct that stores information from GdkEvent.
13 *
14 * This is a class only used within the GTK embedding, created by
15 * FlView and consumed by FlKeyboardManager. It is not sent to
16 * the embedder.
17 *
18 * This object contains information from GdkEvent as well as an origin event
19 * object, so that Flutter can create an event object in unit tests even after
20 * migrating to GDK 4.0 which stops supporting creating GdkEvent.
21 */
22 typedef struct _FlKeyEvent {
23 // Time in milliseconds.
24 guint32 time;
25 // True if is a press event, otherwise a release event.
26 bool is_press;
27 // Hardware keycode.
28 guint16 keycode;
29 // Keyval.
30 guint keyval;
31 // Modifier state.
32 GdkModifierType state;
33 // Keyboard group.
34 guint8 group;
35 // The original event.
36 GdkEvent* origin;
37 } FlKeyEvent;
38
39 /**
40 * fl_key_event_new_from_gdk_event:
41 * @event: the #GdkEvent this #FlKeyEvent is based on. The #event must be a
42 * #GdkEventKey, and will be destroyed by #fl_key_event_dispose.
43 *
44 * Create a new #FlKeyEvent based on a #GdkEvent.
45 *
46 * Returns: a new #FlKeyEvent. Must be freed with #fl_key_event_dispose.
47 */
48 FlKeyEvent* fl_key_event_new_from_gdk_event(GdkEvent* event);
49
50 /**
51 * fl_key_event_dispose:
52 * @event: the event to dispose.
53 *
54 * Properly disposes the content of #event and then the pointer.
55 */
56 void fl_key_event_dispose(FlKeyEvent* event);
57
58 FlKeyEvent* fl_key_event_clone(const FlKeyEvent* source);
59
60 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EVENT_H_
_FlKeyEvent::time
guint32 time
Definition: fl_key_event.h:24
_FlKeyEvent::group
guint8 group
Definition: fl_key_event.h:34
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
fl_key_event_dispose
void fl_key_event_dispose(FlKeyEvent *event)
Definition: fl_key_event.cc:32
fl_key_event_new_from_gdk_event
FlKeyEvent * fl_key_event_new_from_gdk_event(GdkEvent *event)
Definition: fl_key_event.cc:7
FlKeyEvent
struct _FlKeyEvent FlKeyEvent
_FlKeyEvent::origin
GdkEvent * origin
Definition: fl_key_event.h:36
_FlKeyEvent
Definition: fl_key_event.h:22
_FlKeyEvent::state
GdkModifierType state
Definition: fl_key_event.h:32
_FlKeyEvent::keycode
guint16 keycode
Definition: fl_key_event.h:28
_FlKeyEvent::is_press
bool is_press
Definition: fl_key_event.h:26
_FlKeyEvent::keyval
guint keyval
Definition: fl_key_event.h:30
fl_key_event_clone
FlKeyEvent * fl_key_event_clone(const FlKeyEvent *source)
Definition: fl_key_event.cc:39