OLD | NEW |
(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 |
OLD | NEW |