Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: ui/ozone/platform/wayland/wayland_connection.cc

Issue 2042503002: ozone/platform/wayland: Add support for wl_output_interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698