Index: ui/ozone/platform/wayland/wayland_connection.cc |
diff --git a/ui/ozone/platform/wayland/wayland_connection.cc b/ui/ozone/platform/wayland/wayland_connection.cc |
index 2e445d9f2560114fcc20043ced6dd1cb904b5fb2..b2fb1084f94ac6a7e27b5d4275e834108323d563 100644 |
--- a/ui/ozone/platform/wayland/wayland_connection.cc |
+++ b/ui/ozone/platform/wayland/wayland_connection.cc |
@@ -10,6 +10,8 @@ |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/strings/string_util.h" |
+#include "ui/ozone/platform/wayland/wayland_object.h" |
#include "ui/ozone/platform/wayland/wayland_window.h" |
static_assert(XDG_SHELL_VERSION_CURRENT == 5, "Unsupported xdg-shell version"); |
@@ -105,6 +107,12 @@ void WaylandConnection::RemoveWindow(gfx::AcceleratedWidget widget) { |
window_map_.erase(widget); |
} |
+WaylandOutput* WaylandConnection::PrimaryOutput() const { |
+ if (!output_list_.size()) |
+ return nullptr; |
+ return output_list_.front().get(); |
+} |
+ |
void WaylandConnection::OnDispatcherListChanged() { |
StartProcessingEvents(); |
} |
@@ -126,6 +134,11 @@ void WaylandConnection::OnFileCanReadWithoutBlocking(int fd) { |
void WaylandConnection::OnFileCanWriteWithoutBlocking(int fd) {} |
+const std::vector<std::unique_ptr<WaylandOutput>>& |
+WaylandConnection::GetOutputList() const { |
+ return output_list_; |
+} |
+ |
// static |
void WaylandConnection::Global(void* data, |
wl_registry* registry, |
@@ -169,6 +182,18 @@ void WaylandConnection::Global(void* data, |
connection); |
xdg_shell_use_unstable_version(connection->shell_.get(), |
XDG_SHELL_VERSION_CURRENT); |
+ } else if (base::EqualsCaseInsensitiveASCII(interface, "wl_output")) { |
+ wl::Object<wl_output> output = wl::Bind<wl_output>(registry, name, 1); |
+ if (!output) { |
+ LOG(ERROR) << "Failed to bind to wl_output global"; |
+ return; |
+ } |
+ |
+ if (!connection->output_list_.empty()) |
+ NOTIMPLEMENTED() << "Multiple screens support is not implemented"; |
+ |
+ connection->output_list_.push_back( |
+ base::WrapUnique(new WaylandOutput(output.release()))); |
} |
connection->ScheduleFlush(); |