| 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 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ | 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ |
| 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ | 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/ozone/platform/wayland/wayland_object.h" | 11 #include "ui/ozone/platform/wayland/wayland_object.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 // WaylandOutput objects keep track of the current output of display | 15 // WaylandOutput objects keep track of the current output of display |
| 16 // that are available to the application. | 16 // that are available to the application. |
| 17 class WaylandOutput { | 17 class WaylandOutput { |
| 18 public: | 18 public: |
| 19 class Observer { | 19 WaylandOutput(wl_output*, uint32_t name); |
| 20 public: | |
| 21 // Will be called when wl_output is available. | |
| 22 virtual void OnOutputReadyForUse() = 0; | |
| 23 }; | |
| 24 | |
| 25 WaylandOutput(wl_output*); | |
| 26 ~WaylandOutput(); | 20 ~WaylandOutput(); |
| 27 | 21 |
| 28 // Returns the geometry of the output. | 22 // Returns the geometry of the output. |
| 29 gfx::Rect Geometry() const { return rect_; } | 23 gfx::Rect Geometry() const { return rect_; } |
| 30 void SetObserver(Observer* observer) { observer_ = observer; } | |
| 31 Observer* observer() { return observer_; } | |
| 32 | 24 |
| 33 private: | 25 private: |
| 34 // Callback functions used for setting geometric properties of the output | 26 // Callback functions used for setting geometric properties of the output |
| 35 // and available modes. | 27 // and available modes. |
| 36 static void OutputHandleGeometry(void* data, | 28 static void OutputHandleGeometry(void* data, |
| 37 wl_output* output, | 29 wl_output* output, |
| 38 int32_t x, | 30 int32_t x, |
| 39 int32_t y, | 31 int32_t y, |
| 40 int32_t physical_width, | 32 int32_t physical_width, |
| 41 int32_t physical_height, | 33 int32_t physical_height, |
| 42 int32_t subpixel, | 34 int32_t subpixel, |
| 43 const char* make, | 35 const char* make, |
| 44 const char* model, | 36 const char* model, |
| 45 int32_t output_transform); | 37 int32_t output_transform); |
| 46 | 38 |
| 47 static void OutputHandleMode(void* data, | 39 static void OutputHandleMode(void* data, |
| 48 wl_output* wl_output, | 40 wl_output* wl_output, |
| 49 uint32_t flags, | 41 uint32_t flags, |
| 50 int32_t width, | 42 int32_t width, |
| 51 int32_t height, | 43 int32_t height, |
| 52 int32_t refresh); | 44 int32_t refresh); |
| 53 | 45 |
| 54 wl::Object<wl_output> output_; | 46 wl::Object<wl_output> output_; |
| 47 int32_t name_; |
| 55 gfx::Rect rect_; | 48 gfx::Rect rect_; |
| 56 | 49 |
| 57 Observer* observer_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(WaylandOutput); | 50 DISALLOW_COPY_AND_ASSIGN(WaylandOutput); |
| 60 }; | 51 }; |
| 61 | 52 |
| 62 } // namespace ui | 53 } // namespace ui |
| 63 | 54 |
| 64 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_SCREEN_H_ | 55 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_SCREEN_H_ |
| OLD | NEW |