4 * Copyright (C) 2011-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
24 #include <boost/noncopyable.hpp>
26 #include <wayland-client.h>
28 class IDllWaylandClient;
39 Output(IDllWaylandClient &,
50 struct PhysicalGeometry
54 int32_t physicalWidth;
55 int32_t physicalHeight;
56 enum wl_output_subpixel subpixelArrangement;
57 enum wl_output_transform outputTransformation;
60 struct wl_output * GetWlOutput();
62 /* It is a precondition violation to use the following four
63 * functions when the first modes have not yet been received.
65 * Use a synchronization point after creating this object
66 * (eg, WaitForSynchronize() to ensure that the initial modes
69 /* The "current" mode is the mode that the display is currently
71 const ModeGeometry & CurrentMode();
73 /* The "preferred" mode is the mode most optimal to this output.
75 * This is usually the maximum possible mode that this output
76 * supports. All fullscreen windows should generally have a buffer
77 * of this size in order to avoid scaling. */
78 const ModeGeometry & PreferredMode();
80 const std::vector <ModeGeometry> & AllModes();
82 /* The geometry represents the physical geometry of this monitor */
83 const PhysicalGeometry & Geometry();
85 /* The scale factor of this output is an integer value representing
86 * the number of output pixels per hardware pixel. For instance,
87 * if UI elements were scaled up to 1680x1050 and the monitor was
88 * displaying at a native resolution of 3360x2100 when this would be
89 * "2". This is useful for supporting HiDPI display modes where,
90 * for instance we allocate a 3360x2100 buffer but display our UI
91 * elements at 1680x1050 */
92 uint32_t ScaleFactor();
94 static void GeometryCallback(void *,
104 static void ModeCallback(void *,
110 static void ScaleCallback(void *,
113 static void DoneCallback(void *,
118 static const wl_output_listener m_listener;
120 void Geometry(int32_t x,
122 int32_t physicalWidth,
123 int32_t physicalHeight,
128 void Mode(uint32_t flags,
135 IDllWaylandClient &m_clientLibrary;
137 struct wl_output *m_output;
139 PhysicalGeometry m_geometry;
140 std::vector<ModeGeometry> m_modes;
142 uint32_t m_scaleFactor;
144 /* Only one mode at a time can have the current or preferred
145 * flags set, so only one pointer is set here */
146 ModeGeometry *m_current;
147 ModeGeometry *m_preferred;