Flutter Engine
key_event_handler.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_GLFW_KEY_EVENT_HANDLER_H_
6 #define FLUTTER_SHELL_PLATFORM_GLFW_KEY_EVENT_HANDLER_H_
7 
8 #include <memory>
9 
10 #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h"
11 #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h"
12 #include "flutter/shell/platform/glfw/keyboard_hook_handler.h"
13 #include "flutter/shell/platform/glfw/public/flutter_glfw.h"
14 #include "rapidjson/document.h"
15 
16 namespace flutter {
17 
18 // Implements a KeyboardHookHandler
19 //
20 // Handles key events and forwards them to the Flutter engine.
22  public:
23  explicit KeyEventHandler(flutter::BinaryMessenger* messenger);
24 
25  virtual ~KeyEventHandler();
26 
27  // |KeyboardHookHandler|
28  void KeyboardHook(GLFWwindow* window,
29  int key,
30  int scancode,
31  int action,
32  int mods) override;
33 
34  // |KeyboardHookHandler|
35  void CharHook(GLFWwindow* window, unsigned int code_point) override;
36 
37  private:
38  // The Flutter system channel for key event messages.
39  std::unique_ptr<flutter::BasicMessageChannel<rapidjson::Document>> channel_;
40 };
41 
42 } // namespace flutter
43 
44 #endif // FLUTTER_SHELL_PLATFORM_GLFW_KEY_EVENT_HANDLER_H_
void CharHook(GLFWwindow *window, unsigned int code_point) override
SemanticsAction action
void KeyboardHook(GLFWwindow *window, int key, int scancode, int action, int mods) override
KeyEventHandler(flutter::BinaryMessenger *messenger)