| Flutter Linux Embedder |

fl_key_embedder_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_EMBEDDER_RESPONDER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EMBEDDER_RESPONDER_H_
7
8 #include "flutter/shell/platform/linux/fl_engine_private.h"
9 #include "flutter/shell/platform/linux/fl_key_event.h"
10
11 G_BEGIN_DECLS
12
13 G_DECLARE_FINAL_TYPE(FlKeyEmbedderResponder,
14 fl_key_embedder_responder,
15 FL,
16 KEY_EMBEDDER_RESPONDER,
17 GObject);
18
19 /**
20 * FlKeyEmbedderResponder:
21 *
22 * A #FlKeyResponder that handles events by sending the converted events
23 * through the embedder API.
24 *
25 * This class communicates with the HardwareKeyboard API in the framework.
26 */
27
28 /**
29 * fl_key_embedder_responder_new:
30 * @engine: The #FlEngine, whose the embedder API will be used to send
31 * the event.
32 *
33 * Creates a new #FlKeyEmbedderResponder.
34 *
35 * Returns: a new #FlKeyEmbedderResponder.
36 */
37 FlKeyEmbedderResponder* fl_key_embedder_responder_new(FlEngine* engine);
38
39 /**
40 * fl_key_embedder_responder_handle_event:
41 * @responder: the #FlKeyEmbedderResponder self.
42 * @event: the event to be handled. Must not be null. The object is managed by
43 * callee and must not be assumed available after this function.
44 * @specified_logical_key:
45 * @cancellable: (allow-none): a #GCancellable or %NULL.
46 * @callback: (scope async): a #GAsyncReadyCallback to call when the view is
47 * added.
48 * @user_data: (closure): user data to pass to @callback.
49 *
50 * Let the responder handle an event, expecting the responder to report whether
51 * to handle the event.
52 */
53 void fl_key_embedder_responder_handle_event(FlKeyEmbedderResponder* responder,
54 FlKeyEvent* event,
55 uint64_t specified_logical_key,
56 GCancellable* cancellable,
57 GAsyncReadyCallback callback,
58 gpointer user_data);
59
60 /**
61 * fl_key_embedder_responder_handle_event_finish:
62 * @responder: an #FlKeyEmbedderResponder.
63 * @result: a #GAsyncResult.
64 * @handled: location to write if this event was handled by the embedder.
65 * @error: (allow-none): #GError location to store the error occurring, or %NULL
66 * to ignore.
67 *
68 * Completes request started with fl_key_embedder_responder_handle_event().
69 *
70 * Returns %TRUE on success.
71 */
72 gboolean fl_key_embedder_responder_handle_event_finish(
73 FlKeyEmbedderResponder* responder,
74 GAsyncResult* result,
75 gboolean* handled,
76 GError** error);
77
78 /**
79 * fl_key_embedder_responder_sync_modifiers_if_needed:
80 * @responder: the #FlKeyEmbedderResponder self.
81 * @state: the state of the modifiers mask.
82 * @event_time: the time attribute of the incoming GDK event.
83 *
84 * If needed, synthesize modifier keys up and down event by comparing their
85 * current pressing states with the given modifiers mask.
86 */
87 void fl_key_embedder_responder_sync_modifiers_if_needed(
88 FlKeyEmbedderResponder* responder,
89 guint state,
90 double event_time);
91
92 /**
93 * fl_key_embedder_responder_get_pressed_state:
94 * @responder: the #FlKeyEmbedderResponder self.
95 *
96 * Returns the keyboard pressed state. The hash table contains one entry per
97 * pressed keys, mapping from the logical key to the physical key.
98 */
99 GHashTable* fl_key_embedder_responder_get_pressed_state(
100 FlKeyEmbedderResponder* responder);
101
102 G_END_DECLS
103
104 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_EMBEDDER_RESPONDER_H_
FL
FL
Definition: fl_binary_messenger.cc:27
fl_engine_private.h
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
fl_key_embedder_responder_handle_event
void fl_key_embedder_responder_handle_event(FlKeyEmbedderResponder *responder, FlKeyEvent *event, uint64_t specified_logical_key, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_key_embedder_responder.cc:737
fl_key_embedder_responder_handle_event_finish
gboolean fl_key_embedder_responder_handle_event_finish(FlKeyEmbedderResponder *responder, GAsyncResult *result, gboolean *handled, GError **error)
Definition: fl_key_embedder_responder.cc:757
fl_key_embedder_responder_sync_modifiers_if_needed
void fl_key_embedder_responder_sync_modifiers_if_needed(FlKeyEmbedderResponder *responder, guint state, double event_time)
Definition: fl_key_embedder_responder.cc:774
fl_key_embedder_responder_new
FlKeyEmbedderResponder * fl_key_embedder_responder_new(FlEngine *engine)
Definition: fl_key_embedder_responder.cc:181
fl_key_embedder_responder_get_pressed_state
GHashTable * fl_key_embedder_responder_get_pressed_state(FlKeyEmbedderResponder *responder)
Definition: fl_key_embedder_responder.cc:783
G_DECLARE_FINAL_TYPE
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlKeyEmbedderResponder, fl_key_embedder_responder, FL, KEY_EMBEDDER_RESPONDER, GObject)
fl_key_event.h
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40