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