Chromium Code Reviews| Index: ui/ozone/platform/wayland/wayland_output.h |
| diff --git a/ui/ozone/platform/wayland/wayland_output.h b/ui/ozone/platform/wayland/wayland_output.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7538509871475276309b15656db8e7704c843347 |
| --- /dev/null |
| +++ b/ui/ozone/platform/wayland/wayland_output.h |
| @@ -0,0 +1,72 @@ |
| +// 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. |
| + |
| +#ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ |
| +#define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "ui/gfx/geometry/rect.h" |
| +#include "ui/ozone/platform/wayland/wayland_object.h" |
| + |
| +namespace ui { |
| + |
| +// WaylandOutput objects keep track of the current output of display |
| +// that are available to the application. |
| +class WaylandOutput { |
| + public: |
| + // Runs a callback when wl_output is available. |
| + class Observer { |
| + public: |
| + explicit Observer(const base::Closure&, WaylandOutput*); |
| + ~Observer(); |
| + // Will be called when wl_output is available. |
| + void OnOutputReadyForUse(); |
| + |
| + private: |
| + const base::Closure closure_; |
|
Michael Forney
2016/07/20 21:49:00
Why the closure? Why not just make OnOutputReadyFo
joone
2016/07/20 23:23:59
Observer is used in the test case in order to wait
|
| + }; |
| + |
| + WaylandOutput(wl_output*); |
| + ~WaylandOutput(); |
| + |
| + // Returns the resolution of the screen. |
| + gfx::Rect Geometry() const { return rect_; } |
| + void SetObserver(Observer* observer) { observer_ = observer; } |
| + Observer* observer() { return observer_; } |
| + |
| + private: |
| + // Callback functions that allows the display to initialize the screen's |
| + // position and available modes. |
| + static void 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); |
| + |
| + static void OutputHandleMode(void* data, |
| + wl_output* wl_output, |
| + uint32_t flags, |
| + int32_t width, |
| + int32_t height, |
| + int32_t refresh); |
| + |
| + wl::Object<wl_output> output_; |
| + gfx::Rect rect_; |
| + |
| + Observer* observer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WaylandOutput); |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_SCREEN_H_ |