| Flutter Linux Embedder |

fl_key_channel_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_CHANNEL_RESPONDER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_CHANNEL_RESPONDER_H_
7
8 #include <gdk/gdk.h>
9
10 #include "flutter/shell/platform/linux/fl_key_responder.h"
11 #include "flutter/shell/platform/linux/fl_keyboard_manager.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 typedef FlValue* (*FlValueConverter)(FlValue*);
16
17 /**
18 * FlKeyChannelResponderMock:
19 *
20 * Allows mocking of FlKeyChannelResponder methods and values. Only used in
21 * unittests.
22 */
23 typedef struct _FlKeyChannelResponderMock {
24 /**
25 * FlKeyChannelResponderMock::value_converter:
26 * If #value_converter is not nullptr, then this function is applied to the
27 * reply of the message, whose return value is taken as the message reply.
28 */
29 FlValueConverter value_converter;
30
31 /**
32 * FlKeyChannelResponderMock::channel_name:
33 * Mocks the channel name to send the message.
34 */
35 const char* channel_name;
36 } FlKeyChannelResponderMock;
37
38 G_BEGIN_DECLS
39
40 #define FL_TYPE_KEY_CHANNEL_RESPONDER fl_key_channel_responder_get_type()
41 G_DECLARE_FINAL_TYPE(FlKeyChannelResponder,
42 fl_key_channel_responder,
43 FL,
44 KEY_CHANNEL_RESPONDER,
45 GObject);
46
47 /**
48 * FlKeyChannelResponder:
49 *
50 * A #FlKeyResponder that handles events by sending the raw event data
51 * in JSON through the message channel.
52 *
53 * This class communicates with the RawKeyboard API in the framework.
54 */
55
56 /**
57 * fl_key_channel_responder_new:
58 * @messenger: the messenger that the message channel should be built on.
59 * @mock: options to mock several functionalities. Only used in unittests.
60 *
61 * Creates a new #FlKeyChannelResponder.
62 *
63 * Returns: a new #FlKeyChannelResponder.
64 */
65 FlKeyChannelResponder* fl_key_channel_responder_new(
66 FlBinaryMessenger* messenger,
67 FlKeyChannelResponderMock* mock = nullptr);
68
69 G_END_DECLS
70
71 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_CHANNEL_RESPONDER_H_
FlKeyChannelResponderMock
struct _FlKeyChannelResponderMock FlKeyChannelResponderMock
fl_keyboard_manager.h
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_DECLARE_FINAL_TYPE
G_DECLARE_FINAL_TYPE(FlKeyChannelResponder, fl_key_channel_responder, FL, KEY_CHANNEL_RESPONDER, GObject)
_FlKeyChannelResponderMock::value_converter
FlValueConverter value_converter
Definition: fl_key_channel_responder.h:29
_FlKeyChannelResponderMock::channel_name
const char * channel_name
Definition: fl_key_channel_responder.h:35
fl_binary_messenger.h
FL
FL
Definition: fl_binary_messenger.cc:27
fl_value.h
_FlKeyChannelResponderMock
Definition: fl_key_channel_responder.h:23
fl_key_responder.h
fl_key_channel_responder_new
FlKeyChannelResponder * fl_key_channel_responder_new(FlBinaryMessenger *messenger, FlKeyChannelResponderMock *mock=nullptr)
Definition: fl_key_channel_responder.cc:186
FlValueConverter
FlValue *(* FlValueConverter)(FlValue *)
Definition: fl_key_channel_responder.h:15