OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #ifndef UI_WAYLAND_WAYLAND_SCREEN_H_ |
| 6 #define UI_WAYLAND_WAYLAND_SCREEN_H_ |
| 7 |
| 8 #include <list> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "ui/gfx/point.h" |
| 13 #include "ui/gfx/rect.h" |
| 14 |
| 15 struct wl_output; |
| 16 |
| 17 namespace ui { |
| 18 |
| 19 class WaylandDisplay; |
| 20 |
| 21 // WaylandScreen objects keep track of the current outputs (screens/monitors) |
| 22 // that are available to the application. |
| 23 class WaylandScreen { |
| 24 public: |
| 25 WaylandScreen(WaylandDisplay* display, uint32_t id); |
| 26 ~WaylandScreen(); |
| 27 |
| 28 // Returns the active allocation of the screen. |
| 29 gfx::Rect GetAllocation() const; |
| 30 |
| 31 private: |
| 32 // Used to store information regarding the available modes for the current |
| 33 // screen. |
| 34 // - (width, height): is the resolution of the screen |
| 35 // - refresh: is the refresh rate of the screen under this mode |
| 36 // - flags: contains extra information regarding the mode. The most important |
| 37 // is the active mode flag. |
| 38 struct Mode { |
| 39 int32_t width, height, refresh, flags; |
| 40 }; |
| 41 typedef std::list<Mode> Modes; |
| 42 |
| 43 // Callback functions that allows the display to initialize the screen's |
| 44 // position and available modes. |
| 45 static void OutputHandleGeometry(void* data, |
| 46 wl_output* output, |
| 47 int32_t x, |
| 48 int32_t y, |
| 49 int32_t physical_width, |
| 50 int32_t physical_height, |
| 51 int32_t subpixel, |
| 52 const char* make, |
| 53 const char* model); |
| 54 static void OutputHandleMode(void* data, |
| 55 wl_output* wl_output, |
| 56 uint32_t flags, |
| 57 int32_t width, |
| 58 int32_t height, |
| 59 int32_t refresh); |
| 60 |
| 61 // The Wayland output this object wraps |
| 62 wl_output* output_; |
| 63 // The display that the output is associated with |
| 64 WaylandDisplay* display_; |
| 65 // The position of the screen. This is important in multi monitor display |
| 66 // since it provides the position of the screen in the virtual screen. |
| 67 gfx::Point position_; |
| 68 |
| 69 // List of supported modes |
| 70 Modes modes_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(WaylandScreen); |
| 73 }; |
| 74 |
| 75 } // namespace ui |
| 76 |
| 77 #endif // UI_WAYLAND_WAYLAND_SCREEN_H_ |
OLD | NEW |