Flutter Engine
The Flutter Engine
fl_keyboard_view_delegate.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_KEYBOARD_VIEW_DELEGATE_H_
6#define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEYBOARD_VIEW_DELEGATE_H_
7
8#include <gdk/gdk.h>
9#include <cinttypes>
10#include <functional>
11#include <memory>
12
13#include "flutter/shell/platform/embedder/embedder.h"
14#include "flutter/shell/platform/linux/fl_key_event.h"
15#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
16
18
19G_BEGIN_DECLS
20
21G_DECLARE_INTERFACE(FlKeyboardViewDelegate,
22 fl_keyboard_view_delegate,
23 FL,
24 KEYBOARD_VIEW_DELEGATE,
25 GObject);
26
27/**
28 * FlKeyboardViewDelegate:
29 *
30 * An interface for a class that provides `FlKeyboardManager` with
31 * platform-related features.
32 *
33 * This interface is typically implemented by `FlView`.
34 */
35
37 GTypeInterface g_iface;
38
39 void (*send_key_event)(FlKeyboardViewDelegate* delegate,
42 void* user_data);
43
44 gboolean (*text_filter_key_press)(FlKeyboardViewDelegate* delegate,
46
47 FlBinaryMessenger* (*get_messenger)(FlKeyboardViewDelegate* delegate);
48
49 void (*redispatch_event)(FlKeyboardViewDelegate* delegate,
50 std::unique_ptr<FlKeyEvent> event);
51
52 void (*subscribe_to_layout_change)(FlKeyboardViewDelegate* delegate,
53 KeyboardLayoutNotifier notifier);
54
55 guint (*lookup_key)(FlKeyboardViewDelegate* view_delegate,
56 const GdkKeymapKey* key);
57
58 GHashTable* (*get_keyboard_state)(FlKeyboardViewDelegate* delegate);
59};
60
61/**
62 * fl_keyboard_view_delegate_send_key_event:
63 *
64 * Handles `FlKeyboardManager`'s request to send a `FlutterKeyEvent` through the
65 * embedder API to the framework.
66 *
67 * The ownership of the `event` is kept by the keyboard manager, and the `event`
68 * might be immediately destroyed after this function returns.
69 *
70 * The `callback` must eventually be called exactly once with the event result
71 * and the `user_data`.
72 */
73void fl_keyboard_view_delegate_send_key_event(FlKeyboardViewDelegate* delegate,
76 void* user_data);
77
78/**
79 * fl_keyboard_view_delegate_text_filter_key_press:
80 *
81 * Handles `FlKeyboardManager`'s request to check if the GTK text input IM
82 * filter would like to handle a GDK event.
83 *
84 * The ownership of the `event` is kept by the keyboard manager.
85 */
87 FlKeyboardViewDelegate* delegate,
89
90/**
91 * fl_keyboard_view_delegate_get_messenger:
92 *
93 * Returns a binary messenger that can be used to send messages to the
94 * framework.
95 *
96 * The ownership of messenger is kept by the view delegate.
97 */
99 FlKeyboardViewDelegate* delegate);
100
101/**
102 * fl_keyboard_view_delegate_redispatch_event:
103 *
104 * Handles `FlKeyboardManager`'s request to insert a GDK event to the system for
105 * redispatching.
106 *
107 * The ownership of event will be transferred to the view delegate. The view
108 * delegate is responsible to call fl_key_event_dispose.
109 */
111 FlKeyboardViewDelegate* delegate,
112 std::unique_ptr<FlKeyEvent> event);
113
115 FlKeyboardViewDelegate* delegate,
116 KeyboardLayoutNotifier notifier);
117
118guint fl_keyboard_view_delegate_lookup_key(FlKeyboardViewDelegate* delegate,
119 const GdkKeymapKey* key);
120
121/**
122 * fl_keyboard_view_delegate_get_keyboard_state:
123 *
124 * Returns the keyboard pressed state. The hash table contains one entry per
125 * pressed keys, mapping from the logical key to the physical key.*
126 *
127 */
129 FlKeyboardViewDelegate* delegate);
130
131G_END_DECLS
132
133#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEYBOARD_VIEW_DELEGATE_H_
void(* FlutterKeyEventCallback)(bool, void *)
Definition: embedder.h:1155
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
FlKeyEvent * event
guint fl_keyboard_view_delegate_lookup_key(FlKeyboardViewDelegate *delegate, const GdkKeymapKey *key)
void fl_keyboard_view_delegate_send_key_event(FlKeyboardViewDelegate *delegate, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
void fl_keyboard_view_delegate_redispatch_event(FlKeyboardViewDelegate *delegate, std::unique_ptr< FlKeyEvent > event)
G_BEGIN_DECLS G_DECLARE_INTERFACE(FlKeyboardViewDelegate, fl_keyboard_view_delegate, FL, KEYBOARD_VIEW_DELEGATE, GObject)
FlBinaryMessenger * fl_keyboard_view_delegate_get_messenger(FlKeyboardViewDelegate *delegate)
GHashTable * fl_keyboard_view_delegate_get_keyboard_state(FlKeyboardViewDelegate *delegate)
gboolean fl_keyboard_view_delegate_text_filter_key_press(FlKeyboardViewDelegate *delegate, FlKeyEvent *event)
std::function< void()> KeyboardLayoutNotifier
void fl_keyboard_view_delegate_subscribe_to_layout_change(FlKeyboardViewDelegate *delegate, KeyboardLayoutNotifier notifier)
Dart_NativeFunction function
Definition: fuchsia.cc:51
guint(* lookup_key)(FlKeyboardViewDelegate *view_delegate, const GdkKeymapKey *key)
gboolean(* text_filter_key_press)(FlKeyboardViewDelegate *delegate, FlKeyEvent *event)
void(* subscribe_to_layout_change)(FlKeyboardViewDelegate *delegate, KeyboardLayoutNotifier notifier)
void(* send_key_event)(FlKeyboardViewDelegate *delegate, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
void(* redispatch_event)(FlKeyboardViewDelegate *delegate, std::unique_ptr< FlKeyEvent > event)
void * user_data