Flutter Engine
window.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_LIB_UI_WINDOW_WINDOW_H_
6 #define FLUTTER_LIB_UI_WINDOW_WINDOW_H_
7 
8 #include <functional>
9 #include <string>
10 #include <unordered_map>
11 #include <vector>
12 
13 #include "flutter/lib/ui/window/key_data_packet.h"
14 #include "flutter/lib/ui/window/platform_message.h"
15 #include "flutter/lib/ui/window/pointer_data_packet.h"
16 #include "flutter/lib/ui/window/viewport_metrics.h"
17 #include "third_party/skia/include/gpu/GrDirectContext.h"
19 
20 namespace flutter {
21 class Window final {
22  public:
23  Window(int64_t window_id, ViewportMetrics metrics);
24 
25  ~Window();
26 
27  int window_id() const { return window_id_; }
28 
29  const ViewportMetrics& viewport_metrics() const { return viewport_metrics_; }
30 
31  // Dispatch a packet to the framework that indicates one or a few pointer
32  // events.
33  void DispatchPointerDataPacket(const PointerDataPacket& packet);
34  // Dispatch a packet to the framework that indicates a key event.
35  //
36  // The `response_id` is used to label the response of whether the key event
37  // is handled by the framework, typically the return value of
38  // PlatformConfiguration::RegisterKeyDataResponse.
39  // It should be used later in
40  // PlatformConfiguration::CompleteKeyDataResponse.
41  void DispatchKeyDataPacket(const KeyDataPacket& packet, uint64_t response_id);
42  void UpdateWindowMetrics(const ViewportMetrics& metrics);
43 
44  private:
46  int64_t window_id_;
47  ViewportMetrics viewport_metrics_;
48 };
49 
50 } // namespace flutter
51 
52 #endif // FLUTTER_LIB_UI_WINDOW_WINDOW_H_
int window_id() const
Definition: window.h:27
Window(int64_t window_id, ViewportMetrics metrics)
Definition: window.cc:14
void DispatchKeyDataPacket(const KeyDataPacket &packet, uint64_t response_id)
Definition: window.cc:39
void DispatchPointerDataPacket(const PointerDataPacket &packet)
Definition: window.cc:22
const ViewportMetrics & viewport_metrics() const
Definition: window.h:29
void UpdateWindowMetrics(const ViewportMetrics &metrics)
Definition: window.cc:57