Flutter Linux Embedder
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

typedef std::function<void()> 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 }

Referenced by get_keyboard_state().

◆ 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 }

Referenced by fl_keyboard_manager_new().

◆ 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 }

Referenced by convert_key_to_char().

◆ 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 }

References event.

Referenced by responder_handle_event_callback().

◆ 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(
22  self, event, callback, user_data);
23 }

References callback, event, and user_data.

Referenced by fl_keyboard_manager_new().

◆ 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 }

Referenced by fl_keyboard_manager_dispose(), and fl_keyboard_manager_new().

◆ 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 }

References event.

Referenced by responder_handle_event_callback().

◆ G_DECLARE_INTERFACE()

G_BEGIN_DECLS G_DECLARE_INTERFACE ( FlKeyboardViewDelegate  ,
fl_keyboard_view_delegate  ,
FL  ,
KEYBOARD_VIEW_DELEGATE  ,
GObject   
)
event
FlKeyEvent * event
Definition: fl_key_channel_responder.cc:118
user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: fl_key_channel_responder.cc:120