OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/wayland/wayland_output.h" | 5 #include "ui/ozone/platform/wayland/wayland_output.h" |
6 | 6 |
7 #include <wayland-client.h> | 7 #include <wayland-client.h> |
8 | 8 |
9 #include "ui/ozone/platform/wayland/wayland_connection.h" | 9 #include "ui/ozone/platform/wayland/wayland_connection.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 WaylandOutput::WaylandOutput(wl_output* output) | 13 WaylandOutput::WaylandOutput(wl_output* output, uint32_t name) |
14 : output_(output), rect_(0, 0, 0, 0), observer_(nullptr) { | 14 : output_(output), name_(name), rect_(0, 0, 0, 0) { |
15 static const wl_output_listener output_listener = { | 15 static const wl_output_listener output_listener = { |
16 &WaylandOutput::OutputHandleGeometry, &WaylandOutput::OutputHandleMode, | 16 &WaylandOutput::OutputHandleGeometry, &WaylandOutput::OutputHandleMode, |
17 }; | 17 }; |
18 wl_output_add_listener(output, &output_listener, this); | 18 wl_output_add_listener(output, &output_listener, this); |
19 } | 19 } |
20 | 20 |
21 WaylandOutput::~WaylandOutput() {} | 21 WaylandOutput::~WaylandOutput() {} |
22 | 22 |
23 // static | 23 // static |
24 void WaylandOutput::OutputHandleGeometry(void* data, | 24 void WaylandOutput::OutputHandleGeometry(void* data, |
(...skipping 16 matching lines...) Expand all Loading... |
41 uint32_t flags, | 41 uint32_t flags, |
42 int32_t width, | 42 int32_t width, |
43 int32_t height, | 43 int32_t height, |
44 int32_t refresh) { | 44 int32_t refresh) { |
45 WaylandOutput* output = static_cast<WaylandOutput*>(data); | 45 WaylandOutput* output = static_cast<WaylandOutput*>(data); |
46 | 46 |
47 if (flags & WL_OUTPUT_MODE_CURRENT) { | 47 if (flags & WL_OUTPUT_MODE_CURRENT) { |
48 output->rect_.set_width(width); | 48 output->rect_.set_width(width); |
49 output->rect_.set_height(height); | 49 output->rect_.set_height(height); |
50 | 50 |
51 if (output->observer()) | 51 if (!WaylandConnection::GetInstance()) |
52 output->observer()->OnOutputReadyForUse(); | 52 return; |
| 53 |
| 54 WaylandConnection::GetInstance()->OnOutputGeometryChanged(output->name_, |
| 55 output->rect_); |
53 } | 56 } |
54 } | 57 } |
55 | 58 |
56 } // namespace ui | 59 } // namespace ui |
OLD | NEW |