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