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..54efedbfc1f66682fc608a1156af6a05c7f6d009 100644 |
--- a/ui/ozone/platform/wayland/wayland_display.cc |
+++ b/ui/ozone/platform/wayland/wayland_display.cc |
@@ -23,9 +23,15 @@ const uint32_t kMaxShmVersion = 1; |
const uint32_t kMaxXdgShellVersion = 1; |
} // namespace |
-WaylandDisplay::WaylandDisplay() {} |
+WaylandDisplay* WaylandDisplay::instance_ = nullptr; |
-WaylandDisplay::~WaylandDisplay() {} |
+WaylandDisplay::WaylandDisplay() : desktop_platform_screen_delegate_(nullptr) {} |
+ |
+WaylandDisplay::~WaylandDisplay() { |
+ for (WaylandScreen* screen : screen_list_) |
+ delete screen; |
+ screen_list_.clear(); |
+} |
bool WaylandDisplay::Initialize() { |
static const wl_registry_listener registry_listener = { |
@@ -64,6 +70,7 @@ bool WaylandDisplay::Initialize() { |
return false; |
} |
+ instance_ = this; |
return true; |
} |
@@ -127,6 +134,22 @@ void WaylandDisplay::OnFileCanReadWithoutBlocking(int fd) { |
void WaylandDisplay::OnFileCanWriteWithoutBlocking(int fd) {} |
+void WaylandDisplay::OutputSizeChanged(int32_t name, |
+ unsigned width, |
+ unsigned height) { |
+ if (desktop_platform_screen_delegate_) |
+ desktop_platform_screen_delegate_->OnOutputSizeChanged(name, width, height); |
+} |
+ |
+const std::vector<WaylandScreen*>& WaylandDisplay::GetScreenList() const { |
+ return screen_list_; |
+} |
+ |
+void WaylandDisplay::SetDesktopScreenDelegate( |
+ DesktopPlatformScreenDelegate* delegate) { |
+ desktop_platform_screen_delegate_ = delegate; |
+} |
+ |
// static |
void WaylandDisplay::Global(void* data, |
wl_registry* registry, |
@@ -169,6 +192,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(); |