| Flutter Linux Embedder |

fl_key_responder.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_RESPONDER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_RESPONDER_H_
7
8 #include <gdk/gdk.h>
9 #include <cinttypes>
10
11 #include "flutter/shell/platform/linux/fl_key_event.h"
12 #include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
13 #include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h"
14
15 G_BEGIN_DECLS
16
17 typedef struct _FlKeyboardManager FlKeyboardManager;
18
19 /**
20 * FlKeyResponderAsyncCallback:
21 * @event: whether the event has been handled.
22 * @user_data: the same value as user_data sent by
23 * #fl_key_responder_handle_event.
24 *
25 * The signature for a callback with which a #FlKeyResponder asynchronously
26 * reports whether the responder handles the event.
27 **/
28 typedef void (*FlKeyResponderAsyncCallback)(bool handled, gpointer user_data);
29
30 #define FL_TYPE_KEY_RESPONDER fl_key_responder_get_type()
31 G_DECLARE_INTERFACE(FlKeyResponder,
32 fl_key_responder,
33 FL,
34 KEY_RESPONDER,
35 GObject);
36
37 /**
38 * FlKeyResponder:
39 *
40 * An interface for a responder that can process a key event and decides
41 * asynchronously whether to handle an event.
42 *
43 * To use this class, add it with #fl_keyboard_manager_add_responder.
44 */
45
46 struct _FlKeyResponderInterface {
47 GTypeInterface g_iface;
48
49 /**
50 * FlKeyResponder::handle_event:
51 *
52 * The implementation of #fl_key_responder_handle_event.
53 */
54 void (*handle_event)(FlKeyResponder* responder,
55 FlKeyEvent* event,
56 uint64_t specified_logical_key,
57 FlKeyResponderAsyncCallback callback,
58 gpointer user_data);
59 };
60
61 /**
62 * fl_key_responder_handle_event:
63 * @responder: the #FlKeyResponder self.
64 * @event: the event to be handled. Must not be null. The object is managed
65 * by callee and must not be assumed available after this function.
66 * @callback: the callback to report the result. It should be called exactly
67 * once. Must not be null.
68 * @user_data: a value that will be sent back in the callback. Can be null.
69 *
70 * Let the responder handle an event, expecting the responder to report
71 * whether to handle the event. The result will be reported by invoking
72 * `callback` exactly once, which might happen after
73 * `fl_key_responder_handle_event` or during it.
74 */
75 void fl_key_responder_handle_event(FlKeyResponder* responder,
76 FlKeyEvent* event,
77 FlKeyResponderAsyncCallback callback,
78 gpointer user_data,
79 uint64_t specified_logical_key = 0);
80
81 G_END_DECLS
82
83 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_RESPONDER_H_
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
_FlKeyResponderInterface::g_iface
GTypeInterface g_iface
Definition: fl_key_responder.h:47
G_DECLARE_INTERFACE
G_DECLARE_INTERFACE(FlKeyResponder, fl_key_responder, FL, KEY_RESPONDER, GObject)
_FlKeyEvent
Definition: fl_key_event.h:31
_FlKeyResponderInterface::handle_event
void(* handle_event)(FlKeyResponder *responder, FlKeyEvent *event, uint64_t specified_logical_key, FlKeyResponderAsyncCallback callback, gpointer user_data)
Definition: fl_key_responder.h:54
_FlKeyResponderInterface
Definition: fl_key_responder.h:46
fl_binary_messenger.h
fl_key_responder_handle_event
void fl_key_responder_handle_event(FlKeyResponder *responder, FlKeyEvent *event, FlKeyResponderAsyncCallback callback, gpointer user_data, uint64_t specified_logical_key=0)
Definition: fl_key_responder.cc:11
FlKeyResponderAsyncCallback
void(* FlKeyResponderAsyncCallback)(bool handled, gpointer user_data)
Definition: fl_key_responder.h:28
FL
FL
Definition: fl_binary_messenger.cc:27
fl_key_event.h
fl_value.h
specified_logical_key
FlKeyEvent uint64_t specified_logical_key
Definition: fl_key_channel_responder.cc:119
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: fl_key_channel_responder.cc:120
_FlKeyboardManager
Definition: fl_keyboard_manager.cc:255
FlKeyboardManager
typedefG_BEGIN_DECLS struct _FlKeyboardManager FlKeyboardManager
Definition: fl_key_responder.h:17