forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.h
138 lines (108 loc) · 4.42 KB
/
display.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_EXO_DISPLAY_H_
#define COMPONENTS_EXO_DISPLAY_H_
#include <stddef.h>
#include <memory>
#include <string>
#include "base/files/scoped_file.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "components/exo/seat.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_pixmap_handle.h"
namespace gfx {
class ClientNativePixmapFactory;
}
namespace exo {
class Buffer;
class ClientControlledShellSurface;
class DataDevice;
class DataDeviceDelegate;
class DataExchangeDelegate;
class InputMethodSurfaceManager;
class InputMethodSurface;
class NotificationSurface;
class NotificationSurfaceManager;
class SharedMemory;
class ShellSurface;
class SubSurface;
class Surface;
class ToastSurface;
class ToastSurfaceManager;
class XdgShellSurface;
// The core display class. This class provides functions for creating surfaces
// and is in charge of combining the contents of multiple surfaces into one
// displayable output.
class Display {
public:
Display();
Display(
std::unique_ptr<NotificationSurfaceManager> notification_surface_manager,
std::unique_ptr<InputMethodSurfaceManager> input_method_surface_manager,
std::unique_ptr<ToastSurfaceManager> toast_surface_manager,
std::unique_ptr<DataExchangeDelegate> data_exchange_delegate);
Display(const Display&) = delete;
Display& operator=(const Display&) = delete;
~Display();
void Shutdown();
// Creates a new surface.
std::unique_ptr<Surface> CreateSurface();
// Creates a shared memory segment from |shared_memory_region|. This function
// takes ownership of the region.
std::unique_ptr<SharedMemory> CreateSharedMemory(
base::UnsafeSharedMemoryRegion shared_memory_region);
// Creates a buffer for a Linux DMA-buf file descriptor.
std::unique_ptr<Buffer> CreateLinuxDMABufBuffer(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::NativePixmapHandle handle,
bool y_invert);
// Creates a shell surface for an existing surface.
std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface);
// Creates a xdg shell surface for an existing surface.
std::unique_ptr<XdgShellSurface> CreateXdgShellSurface(Surface* surface);
// Returns a remote shell surface for an existing surface using |container|.
// If the existing surface has window session id associated, the remote shell
// will be get from PropertyResolver. Or it will create a new remote shell.
std::unique_ptr<ClientControlledShellSurface>
CreateOrGetClientControlledShellSurface(Surface* surface,
int container,
double default_device_scale_factor,
bool default_scale_cancellation);
// Creates a notification surface for a surface and notification id.
std::unique_ptr<NotificationSurface> CreateNotificationSurface(
Surface* surface,
const std::string& notification_key);
// Creates a input method surface for a surface.
std::unique_ptr<InputMethodSurface> CreateInputMethodSurface(
Surface* surface,
double default_device_scale_factor,
bool default_scale_cancellation);
// Creates a toast surface for a surface.
std::unique_ptr<ToastSurface> CreateToastSurface(
Surface* surface,
double default_device_scale_factor,
bool default_scale_cancellation);
// Creates a sub-surface for an existing surface. The sub-surface will be
// a child of |parent|.
std::unique_ptr<SubSurface> CreateSubSurface(Surface* surface,
Surface* parent);
// Creates a data device for a |delegate|.
std::unique_ptr<DataDevice> CreateDataDevice(DataDeviceDelegate* delegate);
// Obtains seat instance.
Seat* seat() { return &seat_; }
InputMethodSurfaceManager* input_method_surface_manager() {
return input_method_surface_manager_.get();
}
private:
std::unique_ptr<NotificationSurfaceManager> notification_surface_manager_;
std::unique_ptr<InputMethodSurfaceManager> input_method_surface_manager_;
std::unique_ptr<ToastSurfaceManager> toast_surface_manager_;
Seat seat_;
bool shutdown_ = false;
std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_;
};
} // namespace exo
#endif // COMPONENTS_EXO_DISPLAY_H_