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 338927c3205930d955bf590ea4bc5f4b8fabb642..074f6ec92c03ec7fb32905f93973b72b6c6b9fa5 100644 |
--- a/ui/ozone/platform/wayland/wayland_connection.cc |
+++ b/ui/ozone/platform/wayland/wayland_connection.cc |
@@ -10,6 +10,7 @@ |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.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"); |
@@ -24,7 +25,11 @@ const uint32_t kMaxXdgShellVersion = 1; |
WaylandConnection::WaylandConnection() {} |
-WaylandConnection::~WaylandConnection() {} |
+WaylandConnection::~WaylandConnection() { |
+ for (WaylandOutput* output : output_list_) |
+ delete output; |
rjkroege
2016/07/25 23:45:46
Keep WaylandOutput in a self-deleting type like st
joone
2016/09/21 21:21:22
Done.
|
+ output_list_.clear(); |
rjkroege
2016/07/25 23:45:46
redundant I would think.
joone
2016/09/21 21:21:22
Done.
|
+} |
bool WaylandConnection::Initialize() { |
static const wl_registry_listener registry_listener = { |
@@ -105,6 +110,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(); |
+} |
+ |
void WaylandConnection::OnDispatcherListChanged() { |
StartProcessingEvents(); |
} |
@@ -126,6 +137,10 @@ void WaylandConnection::OnFileCanReadWithoutBlocking(int fd) { |
void WaylandConnection::OnFileCanWriteWithoutBlocking(int fd) {} |
+const std::vector<WaylandOutput*>& WaylandConnection::GetOutputList() const { |
+ return output_list_; |
+} |
+ |
// static |
void WaylandConnection::Global(void* data, |
wl_registry* registry, |
@@ -169,6 +184,18 @@ void WaylandConnection::Global(void* data, |
connection); |
xdg_shell_use_unstable_version(connection->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"; |
+ return; |
+ } |
+ |
+ WaylandOutput* wayland_output = new WaylandOutput(output.release()); |
+ if (!connection->output_list_.empty()) |
+ NOTIMPLEMENTED() << "Multiple screens support is not implemented"; |
+ |
+ connection->output_list_.push_back(wayland_output); |
} |
connection->ScheduleFlush(); |