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

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: remove WaylandDisplay::instance 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/display/screen.h"
10 #include "ui/ozone/platform/wayland/wayland_display.h"
11
12 namespace ui {
13
14 WaylandScreen::WaylandScreen(wl_registry* registry,
15 uint32_t name,
16 wl_output* output)
17 : output_(output), name_(name), refresh_(0), rect_(0, 0, 0, 0) {
18 static const wl_output_listener output_listener = {
19 &WaylandScreen::OutputHandleGeometry, &WaylandScreen::OutputHandleMode,
20 };
21 wl_output_add_listener(output, &output_listener, this);
22 }
23
24 WaylandScreen::~WaylandScreen() {}
25
26 void WaylandScreen::SetOutputCompleteClosure(const base::Closure& closure) {
Michael Forney 2016/06/14 00:55:18 Where do you expect this to be used? Perhaps some
not to use - tonikitoo 2016/06/14 15:53:33 +1
joone 2016/06/14 22:10:28 I removed this method by hiding the use of base::C
27 output_complete_closure_ = closure;
28 }
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;
not to use - tonikitoo 2016/06/14 15:53:33 In order to keep it simple, can we not have refres
joone 2016/06/14 22:10:28 Done.
58
59 if (display::Screen::GetScreen())
60 display::Screen::GetScreen()->OnOutputGeometryChanged(screen->name_,
not to use - tonikitoo 2016/06/14 15:53:33 I like this. We eliminate the need for some screen
joone 2016/06/14 22:10:28 Yes!
61 screen->rect_);
62 if (!screen->output_complete_closure_.is_null())
63 screen->output_complete_closure_.Run();
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