forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fl_key_event.h
60 lines (53 loc) · 1.73 KB
/
fl_key_event.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EVENT_H_
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EVENT_H_
#include <gdk/gdk.h>
/**
* FlKeyEvent:
* A struct that stores information from GdkEvent.
*
* This is a class only used within the GTK embedding, created by
* FlView and consumed by FlKeyboardManager. 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.
*/
typedef struct _FlKeyEvent {
// Time in milliseconds.
guint32 time;
// True if is a press event, otherwise a release event.
bool is_press;
// Hardware keycode.
guint16 keycode;
// Keyval.
guint keyval;
// Modifier state.
GdkModifierType state;
// Keyboard group.
guint8 group;
// The original event.
GdkEvent* origin;
} FlKeyEvent;
/**
* fl_key_event_new_from_gdk_event:
* @event: the #GdkEvent this #FlKeyEvent is based on. The #event must be a
* #GdkEventKey, and will be destroyed by #fl_key_event_dispose.
*
* Create a new #FlKeyEvent based on a #GdkEvent.
*
* Returns: a new #FlKeyEvent. Must be freed with #fl_key_event_dispose.
*/
FlKeyEvent* fl_key_event_new_from_gdk_event(GdkEvent* event);
/**
* fl_key_event_dispose:
* @event: the event to dispose.
*
* Properly disposes the content of #event and then the pointer.
*/
void fl_key_event_dispose(FlKeyEvent* event);
FlKeyEvent* fl_key_event_clone(const FlKeyEvent* source);
#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EVENT_H_