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..212ca9649de53a660183953b5f241af469d6c265 100644 |
--- a/ui/ozone/platform/wayland/wayland_display.cc |
+++ b/ui/ozone/platform/wayland/wayland_display.cc |
@@ -25,7 +25,11 @@ const uint32_t kMaxXdgShellVersion = 1; |
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 = { |
@@ -106,6 +110,12 @@ void WaylandDisplay::RemoveWindow(gfx::AcceleratedWidget widget) { |
window_map_.erase(widget); |
} |
+WaylandScreen* WaylandDisplay::PrimaryScreen() const { |
+ if (!screen_list_.size()) |
+ return nullptr; |
+ return screen_list_.front(); |
+} |
+ |
void WaylandDisplay::OnDispatcherListChanged() { |
StartProcessingEvents(); |
} |
@@ -127,6 +137,10 @@ void WaylandDisplay::OnFileCanReadWithoutBlocking(int fd) { |
void WaylandDisplay::OnFileCanWriteWithoutBlocking(int fd) {} |
+const std::vector<WaylandScreen*>& WaylandDisplay::GetScreenList() const { |
+ return screen_list_; |
+} |
+ |
// static |
void WaylandDisplay::Global(void* data, |
wl_registry* registry, |
@@ -169,6 +183,18 @@ 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) { |
+ wl::Object<wl_output> output = wl::Bind<wl_output>(registry, name, 1); |
+ if (!output) { |
+ LOG(ERROR) << "Failed to bind to wl_output global"; |
Michael Forney
2016/06/14 00:55:18
Looks like I have a typo double-space, which has p
joone
2016/06/14 22:10:28
Done.
|
+ return; |
+ } |
+ |
+ WaylandScreen* screen = new WaylandScreen(registry, name, output.release()); |
+ if (!display->screen_list_.empty()) |
+ NOTIMPLEMENTED() << "Multiple screens support is not implemented"; |
+ |
+ display->screen_list_.push_back(screen); |
} |
display->ScheduleFlush(); |