Index: ui/ozone/platform/wayland/wayland_display.cc |
diff --git a/ui/ozone/platform/wayland/wayland_display.cc b/ui/ozone/platform/wayland/wayland_display.cc |
index 4feb9d7d103496d9977783dd22bd4da09c47a83f..6b5c35ed1ae118c1cd4535a985e5c1a3ed60e1cc 100644 |
--- a/ui/ozone/platform/wayland/wayland_display.cc |
+++ b/ui/ozone/platform/wayland/wayland_display.cc |
@@ -10,7 +10,9 @@ |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
+#include "ui/display/screen.h" |
#include "ui/ozone/platform/wayland/wayland_object.h" |
+#include "ui/ozone/platform/wayland/wayland_screen.h" |
#include "ui/ozone/platform/wayland/wayland_window.h" |
static_assert(XDG_SHELL_VERSION_CURRENT == 5, "Unsupported xdg-shell version"); |
@@ -23,9 +25,15 @@ const uint32_t kMaxShmVersion = 1; |
const uint32_t kMaxXdgShellVersion = 1; |
} // namespace |
+WaylandDisplay* WaylandDisplay::instance_ = nullptr; |
+ |
WaylandDisplay::WaylandDisplay() {} |
-WaylandDisplay::~WaylandDisplay() {} |
+WaylandDisplay::~WaylandDisplay() { |
+ for (WaylandScreen* screen : screen_list_) |
+ delete screen; |
+ screen_list_.clear(); |
+} |
bool WaylandDisplay::Initialize() { |
static const wl_registry_listener registry_listener = { |
@@ -64,6 +72,7 @@ bool WaylandDisplay::Initialize() { |
return false; |
} |
+ instance_ = this; |
return true; |
} |
@@ -127,6 +136,21 @@ void WaylandDisplay::OnFileCanReadWithoutBlocking(int fd) { |
void WaylandDisplay::OnFileCanWriteWithoutBlocking(int fd) {} |
+void WaylandDisplay::OnOutputGeometryChanged(int32_t name, |
+ const gfx::Rect& rect) { |
+ display::Screen::GetScreen()->OnOutputGeometryChanged(name, rect); |
+ if (!output_complete_closure_.is_null()) |
+ output_complete_closure_.Run(); |
+} |
+ |
+void WaylandDisplay::SetOutputCompleteClosure(const base::Closure& closure) { |
+ output_complete_closure_ = closure; |
+} |
+ |
+const std::vector<WaylandScreen*>& WaylandDisplay::GetScreenList() const { |
+ return screen_list_; |
+} |
+ |
// static |
void WaylandDisplay::Global(void* data, |
wl_registry* registry, |
@@ -169,6 +193,13 @@ void WaylandDisplay::Global(void* data, |
xdg_shell_add_listener(display->shell_.get(), &shell_listener, display); |
xdg_shell_use_unstable_version(display->shell_.get(), |
XDG_SHELL_VERSION_CURRENT); |
+ } else if (strcmp(interface, "wl_output") == 0) { |
+ WaylandScreen* screen = new WaylandScreen(registry, name); |
+ if (!display->screen_list_.empty()) |
+ NOTIMPLEMENTED() << "Multiple screens support is not implemented"; |
+ |
+ display->screen_list_.push_back(screen); |
+ display->primary_screen_ = display->screen_list_.front(); |
} |
display->ScheduleFlush(); |