| 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. If `error` is not %NULL, `*error` must be initialized (typically
67 * %NULL, but an error from a previous call using GLib error handling is
68 * explicitly valid).
69 *
70 * Completes request started with fl_key_embedder_responder_handle_event().
71 *
72 * Returns %TRUE on success.
73 */
74 gboolean fl_key_embedder_responder_handle_event_finish(
75 FlKeyEmbedderResponder* responder,
76 GAsyncResult* result,
77 gboolean* handled,
78 GError** error);
79
80 /**
81 * fl_key_embedder_responder_sync_modifiers_if_needed:
82 * @responder: the #FlKeyEmbedderResponder self.
83 * @state: the state of the modifiers mask.
84 * @event_time: the time attribute of the incoming GDK event.
85 *
86 * If needed, synthesize modifier keys up and down event by comparing their
87 * current pressing states with the given modifiers mask.
88 */
89 void fl_key_embedder_responder_sync_modifiers_if_needed(
90 FlKeyEmbedderResponder* responder,
91 guint state,
92 double event_time);
93
94 /**
95 * fl_key_embedder_responder_get_pressed_state:
96 * @responder: the #FlKeyEmbedderResponder self.
97 *
98 * Returns the keyboard pressed state. The hash table contains one entry per
99 * pressed keys, mapping from the logical key to the physical key.
100 */
101 GHashTable* fl_key_embedder_responder_get_pressed_state(
102 FlKeyEmbedderResponder* responder);
103
104 G_END_DECLS
105
106 #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