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

Unified Diff: ui/ozone/platform/wayland/wayland_output.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: [For landding] update comments Created 4 years, 3 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
« no previous file with comments | « ui/ozone/platform/wayland/wayland_output.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/wayland/wayland_output.cc
diff --git a/ui/ozone/platform/wayland/wayland_output.cc b/ui/ozone/platform/wayland/wayland_output.cc
new file mode 100644
index 0000000000000000000000000000000000000000..39bdfd98f9dcd54317128f8e9b092d382a9d4cf9
--- /dev/null
+++ b/ui/ozone/platform/wayland/wayland_output.cc
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/wayland/wayland_output.h"
+
+#include <wayland-client.h>
+
+#include "ui/ozone/platform/wayland/wayland_connection.h"
+
+namespace ui {
+
+WaylandOutput::WaylandOutput(wl_output* output)
+ : output_(output), rect_(0, 0, 0, 0), observer_(nullptr) {
+ static const wl_output_listener output_listener = {
+ &WaylandOutput::OutputHandleGeometry, &WaylandOutput::OutputHandleMode,
+ };
+ wl_output_add_listener(output, &output_listener, this);
+}
+
+WaylandOutput::~WaylandOutput() {}
+
+// static
+void WaylandOutput::OutputHandleGeometry(void* data,
+ wl_output* output,
+ int32_t x,
+ int32_t y,
+ int32_t physical_width,
+ int32_t physical_height,
+ int32_t subpixel,
+ const char* make,
+ const char* model,
+ int32_t output_transform) {
+ WaylandOutput* wayland_output = static_cast<WaylandOutput*>(data);
+ wayland_output->rect_.set_origin(gfx::Point(x, y));
+}
+
+// static
+void WaylandOutput::OutputHandleMode(void* data,
+ wl_output* wl_output,
+ uint32_t flags,
+ int32_t width,
+ int32_t height,
+ int32_t refresh) {
+ WaylandOutput* output = static_cast<WaylandOutput*>(data);
+
+ if (flags & WL_OUTPUT_MODE_CURRENT) {
+ output->rect_.set_width(width);
+ output->rect_.set_height(height);
+
+ if (output->observer())
+ output->observer()->OnOutputReadyForUse();
+ }
+}
+
+} // namespace ui
« no previous file with comments | « ui/ozone/platform/wayland/wayland_output.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698