 Chromium Code Reviews
 Chromium Code Reviews Issue 2042503002:
  ozone/platform/wayland: Add support for wl_output_interface  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2042503002:
  ozone/platform/wayland: Add support for wl_output_interface  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: ui/ozone/platform/wayland/wayland_screen.cc | 
| diff --git a/ui/ozone/platform/wayland/wayland_screen.cc b/ui/ozone/platform/wayland/wayland_screen.cc | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..d7128a68a17aa7581fa654118028289b5b16e201 | 
| --- /dev/null | 
| +++ b/ui/ozone/platform/wayland/wayland_screen.cc | 
| @@ -0,0 +1,67 @@ | 
| +// 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_screen.h" | 
| + | 
| +#include <wayland-client.h> | 
| + | 
| +#include "ui/display/screen.h" | 
| +#include "ui/ozone/platform/wayland/wayland_display.h" | 
| + | 
| +namespace ui { | 
| + | 
| +WaylandScreen::WaylandScreen(wl_registry* registry, | 
| + uint32_t name, | 
| + wl_output* output) | 
| + : output_(output), name_(name), refresh_(0), rect_(0, 0, 0, 0) { | 
| + static const wl_output_listener output_listener = { | 
| + &WaylandScreen::OutputHandleGeometry, &WaylandScreen::OutputHandleMode, | 
| + }; | 
| + wl_output_add_listener(output, &output_listener, this); | 
| +} | 
| + | 
| +WaylandScreen::~WaylandScreen() {} | 
| + | 
| +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
 | 
| + output_complete_closure_ = closure; | 
| +} | 
| + | 
| +// static | 
| +void WaylandScreen::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) { | 
| + WaylandScreen* screen = static_cast<WaylandScreen*>(data); | 
| + screen->rect_.set_origin(gfx::Point(x, y)); | 
| +} | 
| + | 
| +// static | 
| +void WaylandScreen::OutputHandleMode(void* data, | 
| + wl_output* wl_output, | 
| + uint32_t flags, | 
| + int32_t width, | 
| + int32_t height, | 
| + int32_t refresh) { | 
| + WaylandScreen* screen = static_cast<WaylandScreen*>(data); | 
| + | 
| + if (flags & WL_OUTPUT_MODE_CURRENT) { | 
| + screen->rect_.set_width(width); | 
| + screen->rect_.set_height(height); | 
| + 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.
 | 
| + | 
| + if (display::Screen::GetScreen()) | 
| + 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!
 | 
| + screen->rect_); | 
| + if (!screen->output_complete_closure_.is_null()) | 
| + screen->output_complete_closure_.Run(); | 
| + } | 
| +} | 
| + | 
| +} // namespace ui |