Chromium Code Reviews| 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..2e59bbb0f8321790fb9f76e2b3d892fa5b92395d 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::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 +70,7 @@ bool WaylandDisplay::Initialize() { |
| return false; |
| } |
| + instance_ = this; |
|
tonikitoo
2016/06/06 21:35:15
analogously, should not you set "instance_" to nul
joone
2016/06/07 22:26:59
Done.
|
| return true; |
| } |
| @@ -127,6 +134,21 @@ void WaylandDisplay::OnFileCanReadWithoutBlocking(int fd) { |
| void WaylandDisplay::OnFileCanWriteWithoutBlocking(int fd) {} |
| +void WaylandDisplay::OutputSizeChanged(int32_t name, |
| + unsigned width, |
| + unsigned height) { |
| + 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 +191,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(); |