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

Side by Side Diff: ui/ozone/platform/wayland/wayland_screen.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: Applied review comments Created 4 years, 6 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
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_screen.h"
6
7 #include <wayland-client.h>
8
9 #include "ui/ozone/platform/wayland/wayland_display.h"
10
11 namespace ui {
12
13 WaylandScreen::WaylandScreen(wl_registry* registry, uint32_t name)
14 : output_(nullptr), name_(name), refresh_(0), rect_(0, 0, 0, 0) {
15 static const wl_output_listener output_listener = {
16 &WaylandScreen::OutputHandleGeometry, &WaylandScreen::OutputHandleMode,
17 };
18
19 output_ = wl::Bind<wl_output>(registry, name, 1);
Michael Forney 2016/06/10 18:12:21 I think you should bind the object in wayland_disp
joone 2016/06/14 00:04:43 Done.
20 if (!output_) {
21 LOG(ERROR) << "Failed to bind to wl_output global";
22 return;
23 }
24
25 wl_output_add_listener(output_.get(), &output_listener, this);
26 }
27
28 WaylandScreen::~WaylandScreen() {}
29
30 // static
31 void WaylandScreen::OutputHandleGeometry(void* data,
32 wl_output* output,
33 int32_t x,
34 int32_t y,
35 int32_t physical_width,
36 int32_t physical_height,
37 int32_t subpixel,
38 const char* make,
39 const char* model,
40 int32_t output_transform) {
41 WaylandScreen* screen = static_cast<WaylandScreen*>(data);
42 screen->rect_.set_origin(gfx::Point(x, y));
43 }
44
45 // static
46 void WaylandScreen::OutputHandleMode(void* data,
47 wl_output* wl_output,
48 uint32_t flags,
49 int32_t width,
50 int32_t height,
51 int32_t refresh) {
52 WaylandScreen* screen = static_cast<WaylandScreen*>(data);
53
54 if (flags & WL_OUTPUT_MODE_CURRENT) {
55 screen->rect_.set_width(width);
56 screen->rect_.set_height(height);
57 screen->refresh_ = refresh;
58
59 if (!WaylandDisplay::GetInstance())
60 return;
61
62 WaylandDisplay::GetInstance()->OnOutputGeometryChanged(screen->name_,
63 screen->rect_);
64 }
65 }
66
67 } // namespace ui
OLDNEW
« ui/ozone/platform/wayland/wayland_display.cc ('K') | « ui/ozone/platform/wayland/wayland_screen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698