Flutter Engine
The Flutter Engine
Classes | Typedefs | Functions
fl_keyboard_view_delegate.h File Reference
#include <gdk/gdk.h>
#include <cinttypes>
#include <functional>
#include <memory>
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/linux/fl_key_event.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"

Go to the source code of this file.

Classes

struct  _FlKeyboardViewDelegateInterface
 

Typedefs

typedef std::function< void()> KeyboardLayoutNotifier
 

Functions

G_BEGIN_DECLS G_DECLARE_INTERFACE (FlKeyboardViewDelegate, fl_keyboard_view_delegate, FL, KEYBOARD_VIEW_DELEGATE, GObject)
 
void fl_keyboard_view_delegate_send_key_event (FlKeyboardViewDelegate *delegate, const FlutterKeyEvent *event, FlutterKeyEventCallback callback, void *user_data)
 
gboolean fl_keyboard_view_delegate_text_filter_key_press (FlKeyboardViewDelegate *delegate, FlKeyEvent *event)
 
FlBinaryMessenger * fl_keyboard_view_delegate_get_messenger (FlKeyboardViewDelegate *delegate)
 
void fl_keyboard_view_delegate_redispatch_event (FlKeyboardViewDelegate *delegate, std::unique_ptr< FlKeyEvent > event)
 
void fl_keyboard_view_delegate_subscribe_to_layout_change (FlKeyboardViewDelegate *delegate, KeyboardLayoutNotifier notifier)
 
guint fl_keyboard_view_delegate_lookup_key (FlKeyboardViewDelegate *delegate, const GdkKeymapKey *key)
 
GHashTable * fl_keyboard_view_delegate_get_keyboard_state (FlKeyboardViewDelegate *delegate)
 

Typedef Documentation

◆ KeyboardLayoutNotifier

Definition at line 17 of file fl_keyboard_view_delegate.h.

Function Documentation

◆ fl_keyboard_view_delegate_get_keyboard_state()

GHashTable * fl_keyboard_view_delegate_get_keyboard_state ( FlKeyboardViewDelegate *  delegate)

fl_keyboard_view_delegate_get_keyboard_state:

Returns the keyboard pressed state. The hash table contains one entry per pressed keys, mapping from the logical key to the physical key.*

Definition at line 68 of file fl_keyboard_view_delegate.cc.

69 {
70 g_return_val_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self), nullptr);
71
72 return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->get_keyboard_state(self);
73}

◆ fl_keyboard_view_delegate_get_messenger()

FlBinaryMessenger * fl_keyboard_view_delegate_get_messenger ( FlKeyboardViewDelegate *  delegate)

fl_keyboard_view_delegate_get_messenger:

Returns a binary messenger that can be used to send messages to the framework.

The ownership of messenger is kept by the view delegate.

Definition at line 35 of file fl_keyboard_view_delegate.cc.

36 {
37 g_return_val_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self), nullptr);
38
39 return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->get_messenger(self);
40}

◆ fl_keyboard_view_delegate_lookup_key()

guint fl_keyboard_view_delegate_lookup_key ( FlKeyboardViewDelegate *  delegate,
const GdkKeymapKey *  key 
)

Definition at line 61 of file fl_keyboard_view_delegate.cc.

62 {
63 g_return_val_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self), 0);
64
65 return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->lookup_key(self, key);
66}

◆ fl_keyboard_view_delegate_redispatch_event()

void fl_keyboard_view_delegate_redispatch_event ( FlKeyboardViewDelegate *  delegate,
std::unique_ptr< FlKeyEvent event 
)

fl_keyboard_view_delegate_redispatch_event:

Handles FlKeyboardManager's request to insert a GDK event to the system for redispatching.

The ownership of event will be transferred to the view delegate. The view delegate is responsible to call fl_key_event_dispose.

Definition at line 42 of file fl_keyboard_view_delegate.cc.

44 {
45 g_return_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self));
46 g_return_if_fail(event != nullptr);
47
48 return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->redispatch_event(
49 self, std::move(event));
50}
FlKeyEvent * event

◆ fl_keyboard_view_delegate_send_key_event()

void fl_keyboard_view_delegate_send_key_event ( FlKeyboardViewDelegate *  delegate,
const FlutterKeyEvent event,
FlutterKeyEventCallback  callback,
void *  user_data 
)

fl_keyboard_view_delegate_send_key_event:

Handles FlKeyboardManager's request to send a FlutterKeyEvent through the embedder API to the framework.

The ownership of the event is kept by the keyboard manager, and the event might be immediately destroyed after this function returns.

The callback must eventually be called exactly once with the event result and the user_data.

Definition at line 14 of file fl_keyboard_view_delegate.cc.

17 {
18 g_return_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self));
19 g_return_if_fail(event != nullptr);
20
21 FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->send_key_event(
23}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
void * user_data

◆ fl_keyboard_view_delegate_subscribe_to_layout_change()

void fl_keyboard_view_delegate_subscribe_to_layout_change ( FlKeyboardViewDelegate *  delegate,
KeyboardLayoutNotifier  notifier 
)

Definition at line 52 of file fl_keyboard_view_delegate.cc.

54 {
55 g_return_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self));
56
57 return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->subscribe_to_layout_change(
58 self, std::move(notifier));
59}

◆ fl_keyboard_view_delegate_text_filter_key_press()

gboolean fl_keyboard_view_delegate_text_filter_key_press ( FlKeyboardViewDelegate *  delegate,
FlKeyEvent event 
)

fl_keyboard_view_delegate_text_filter_key_press:

Handles FlKeyboardManager's request to check if the GTK text input IM filter would like to handle a GDK event.

The ownership of the event is kept by the keyboard manager.

Definition at line 25 of file fl_keyboard_view_delegate.cc.

27 {
28 g_return_val_if_fail(FL_IS_KEYBOARD_VIEW_DELEGATE(self), false);
29 g_return_val_if_fail(event != nullptr, false);
30
31 return FL_KEYBOARD_VIEW_DELEGATE_GET_IFACE(self)->text_filter_key_press(
32 self, event);
33}

◆ G_DECLARE_INTERFACE()

G_BEGIN_DECLS G_DECLARE_INTERFACE ( FlKeyboardViewDelegate  ,
fl_keyboard_view_delegate  ,
FL  ,
KEYBOARD_VIEW_DELEGATE  ,
GObject   
)