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