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