Index: ui/wayland/wayland_screen.h |
diff --git a/ui/wayland/wayland_screen.h b/ui/wayland/wayland_screen.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..29d7b46514113c5106496557347482ed24904329 |
--- /dev/null |
+++ b/ui/wayland/wayland_screen.h |
@@ -0,0 +1,79 @@ |
+// Copyright (c) 2011 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 WAYLAND_SCREEN_H_ |
+#define WAYLAND_SCREEN_H_ |
+ |
+#include <list> |
+#include <stdint.h> |
+ |
+#include "base/basictypes.h" |
+#include "wayland_geometry_utils.h" |
+ |
+struct wl_output; |
+struct wl_output_listener; |
+ |
+class WaylandDisplay; |
+ |
+/* WaylandScreen objects keep track of the current outputs (screens/monitors) |
+that are available to the application. |
+*/ |
+class WaylandScreen { |
+ public: |
+ WaylandScreen(WaylandDisplay* display, uint32_t id); |
+ ~WaylandScreen(); |
+ |
+ /* Returns the active allocation of the screen. */ |
+ Rectangle GetAllocation() const; |
+ |
+ private: |
+ /* Used to store information regarding the available modes for the current |
+ screen. |
+ - (width, height): is the resolution of the screen |
+ - refresh: is the refresh rate of the screen under this mode |
+ - flags: contains extra information regarding the mode. The most important |
+ is the active mode flag. |
+ */ |
+ struct Mode { |
+ int32_t width, height, refresh, flags; |
+ }; |
+ |
+ /* The Wayland output this object wraps */ |
+ wl_output* output_; |
+ /* The display that the output is associated with */ |
+ WaylandDisplay* display_; |
+ /* The position of the screen. This is important in multi monitor display |
+ since it provides the position of the screen in the virtual screen. |
+ */ |
+ Point position_; |
+ |
+ /* List of supported modes */ |
+ typedef std::list<Mode> Modes; |
+ Modes modes_; |
+ |
+ static const wl_output_listener output_listener; |
+ |
+ /* 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); |
+ static void OutputHandleMode(void* data, |
+ wl_output* wl_output, |
+ uint32_t flags, |
+ int32_t width, |
+ int32_t height, |
+ int32_t refresh); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WaylandScreen); |
+}; |
+ |
+#endif |