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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/wayland/wayland_output.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/wayland/wayland_output.h"
6
7 #include <wayland-client.h>
8
9 #include "ui/ozone/platform/wayland/wayland_connection.h"
10
11 namespace ui {
12
13 WaylandOutput::WaylandOutput(wl_output* output)
14 : output_(output), rect_(0, 0, 0, 0), observer_(nullptr) {
15 static const wl_output_listener output_listener = {
16 &WaylandOutput::OutputHandleGeometry, &WaylandOutput::OutputHandleMode,
17 };
18 wl_output_add_listener(output, &output_listener, this);
19 }
20
21 WaylandOutput::~WaylandOutput() {}
22
23 // static
24 void WaylandOutput::OutputHandleGeometry(void* data,
25 wl_output* output,
26 int32_t x,
27 int32_t y,
28 int32_t physical_width,
29 int32_t physical_height,
30 int32_t subpixel,
31 const char* make,
32 const char* model,
33 int32_t output_transform) {
34 WaylandOutput* wayland_output = static_cast<WaylandOutput*>(data);
35 wayland_output->rect_.set_origin(gfx::Point(x, y));
36 }
37
38 // static
39 void WaylandOutput::OutputHandleMode(void* data,
40 wl_output* wl_output,
41 uint32_t flags,
42 int32_t width,
43 int32_t height,
44 int32_t refresh) {
45 WaylandOutput* output = static_cast<WaylandOutput*>(data);
46
47 if (flags & WL_OUTPUT_MODE_CURRENT) {
48 output->rect_.set_width(width);
49 output->rect_.set_height(height);
50
51 if (output->observer())
52 output->observer()->OnOutputReadyForUse();
53 }
54 }
55
56 } // namespace ui
OLDNEW
« 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