Flutter Engine
The Flutter Engine
fl_key_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_RESPONDER_H_
6#define FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_RESPONDER_H_
7
8#include <gdk/gdk.h>
9#include <cinttypes>
10
11#include "flutter/shell/platform/linux/fl_key_event.h"
12#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
13#include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h"
14
15G_BEGIN_DECLS
16
18
19/**
20 * FlKeyResponderAsyncCallback:
21 * @event: whether the event has been handled.
22 * @user_data: the same value as user_data sent by
23 * #fl_key_responder_handle_event.
24 *
25 * The signature for a callback with which a #FlKeyResponder asynchronously
26 * reports whether the responder handles the event.
27 **/
28typedef void (*FlKeyResponderAsyncCallback)(bool handled, gpointer user_data);
29
30#define FL_TYPE_KEY_RESPONDER fl_key_responder_get_type()
31G_DECLARE_INTERFACE(FlKeyResponder,
32 fl_key_responder,
33 FL,
34 KEY_RESPONDER,
35 GObject);
36
37/**
38 * FlKeyResponder:
39 *
40 * An interface for a responder that can process a key event and decides
41 * asynchronously whether to handle an event.
42 *
43 * To use this class, add it with #fl_keyboard_manager_add_responder.
44 */
45
47 GTypeInterface g_iface;
48
49 /**
50 * FlKeyResponder::handle_event:
51 *
52 * The implementation of #fl_key_responder_handle_event.
53 */
54 void (*handle_event)(FlKeyResponder* responder,
56 uint64_t specified_logical_key,
58 gpointer user_data);
59};
60
61/**
62 * fl_key_responder_handle_event:
63 * @responder: the #FlKeyResponder self.
64 * @event: the event to be handled. Must not be null. The object is managed
65 * by callee and must not be assumed available after this function.
66 * @callback: the callback to report the result. It should be called exactly
67 * once. Must not be null.
68 * @user_data: a value that will be sent back in the callback. Can be null.
69 *
70 * Let the responder handle an event, expecting the responder to report
71 * whether to handle the event. The result will be reported by invoking
72 * `callback` exactly once, which might happen after
73 * `fl_key_responder_handle_event` or during it.
74 */
75void fl_key_responder_handle_event(FlKeyResponder* responder,
78 gpointer user_data,
79 uint64_t specified_logical_key = 0);
80
81G_END_DECLS
82
83#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_KEY_RESPONDER_H_
FlKeyEvent uint64_t specified_logical_key
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
FlKeyEvent * event
G_DECLARE_INTERFACE(FlKeyResponder, fl_key_responder, FL, KEY_RESPONDER, GObject)
void(* FlKeyResponderAsyncCallback)(bool handled, gpointer user_data)
typedefG_BEGIN_DECLS struct _FlKeyboardManager FlKeyboardManager
void fl_key_responder_handle_event(FlKeyResponder *responder, FlKeyEvent *event, FlKeyResponderAsyncCallback callback, gpointer user_data, uint64_t specified_logical_key=0)
void(* handle_event)(FlKeyResponder *responder, FlKeyEvent *event, uint64_t specified_logical_key, FlKeyResponderAsyncCallback callback, gpointer user_data)
void * user_data