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 <stdint.h>
9 
10 #include <gdk/gdk.h>
11 
12 G_DECLARE_FINAL_TYPE(FlKeyEvent, fl_key_event, FL, KEY_EVENT, GObject);
13 
14 /**
15  * FlKeyEvent:
16  * A struct that stores information from GdkEvent.
17  *
18  * This is a class only used within the GTK embedding, created by
19  * FlView and consumed by FlKeyboardHandler. It is not sent to
20  * the embedder.
21  *
22  * This object contains information from GdkEvent as well as an origin event
23  * object, so that Flutter can create an event object in unit tests even after
24  * migrating to GDK 4.0 which stops supporting creating GdkEvent.
25  */
26 
27 FlKeyEvent* fl_key_event_new(guint32 time,
28  gboolean is_press,
29  guint16 keycode,
30  guint keyval,
31  GdkModifierType state,
32  guint8 group);
33 
34 /**
35  * fl_key_event_new_from_gdk_event:
36  * @event: the #GdkEvent this #FlKeyEvent is based on.
37  *
38  * Create a new #FlKeyEvent based on a #GdkEvent.
39  *
40  * Returns: a new #FlKeyEvent.
41  */
42 FlKeyEvent* fl_key_event_new_from_gdk_event(GdkEvent* event);
43 
44 guint32 fl_key_event_get_time(FlKeyEvent* event);
45 
46 gboolean fl_key_event_get_is_press(FlKeyEvent* event);
47 
48 guint16 fl_key_event_get_keycode(FlKeyEvent* event);
49 
50 guint fl_key_event_get_keyval(FlKeyEvent* event);
51 
52 GdkModifierType fl_key_event_get_state(FlKeyEvent* event);
53 
54 guint8 fl_key_event_get_group(FlKeyEvent* event);
55 
56 GdkEvent* fl_key_event_get_origin(FlKeyEvent* event);
57 
58 /**
59  * fl_key_event_hash:
60  * @event: an #FlKeyEvent.
61  *
62  * Calculates a unique ID for a given FlKeyEvent object to use for
63  * identification of responses from the framework.
64  *
65  * Returns: a hash code.
66  */
67 uint64_t fl_key_event_hash(FlKeyEvent* event);
68 
69 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EVENT_H_
G_DECLARE_FINAL_TYPE
G_DECLARE_FINAL_TYPE(FlKeyEvent, fl_key_event, FL, KEY_EVENT, GObject)
fl_key_event_get_state
GdkModifierType fl_key_event_get_state(FlKeyEvent *event)
Definition: fl_key_event.cc:99
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
fl_key_event_new_from_gdk_event
FlKeyEvent * fl_key_event_new_from_gdk_event(GdkEvent *event)
Definition: fl_key_event.cc:53
fl_key_event_get_group
guint8 fl_key_event_get_group(FlKeyEvent *event)
Definition: fl_key_event.cc:104
fl_key_event_get_keycode
guint16 fl_key_event_get_keycode(FlKeyEvent *event)
Definition: fl_key_event.cc:89
state
AtkStateType state
Definition: fl_accessible_node.cc:10
fl_key_event_get_time
guint32 fl_key_event_get_time(FlKeyEvent *event)
Definition: fl_key_event.cc:79
FL
FL
Definition: fl_binary_messenger.cc:27
fl_key_event_get_is_press
gboolean fl_key_event_get_is_press(FlKeyEvent *event)
Definition: fl_key_event.cc:84
fl_key_event_get_keyval
guint fl_key_event_get_keyval(FlKeyEvent *event)
Definition: fl_key_event.cc:94
fl_key_event_new
FlKeyEvent * fl_key_event_new(guint32 time, gboolean is_press, guint16 keycode, guint keyval, GdkModifierType state, guint8 group)
Definition: fl_key_event.cc:34
fl_key_event_get_origin
GdkEvent * fl_key_event_get_origin(FlKeyEvent *event)
Definition: fl_key_event.cc:109
fl_key_event_hash
uint64_t fl_key_event_hash(FlKeyEvent *event)
Definition: fl_key_event.cc:114