Mir
common.h
Go to the documentation of this file.
1 /*
2  * Simple definitions common to client and server.
3  *
4  * Copyright © 2013-2016 Canonical Ltd.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License version 2 or 3 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
19  */
20 
21 #ifndef MIR_COMMON_H_
22 #define MIR_COMMON_H_
23 
25 
26 //for clang
27 #ifndef __has_feature
28  #define __has_feature(x) 0 // Compatibility with non-clang
29 #endif
30 
31 //for clang
32 #ifndef __has_extension
33  #define __has_extension __has_feature // Compatibility with pre-3.0
34 #endif
35 
36 #if __GNUC__ >= 6 || \
37  (__has_extension(attribute_deprecated_with_message) && \
38  __has_extension(enumerator_attributes))
39  #define MIR_DEPRECATED_ENUM(ENUM, INSTEAD) \
40  ENUM MIR_FOR_REMOVAL_IN_VERSION_1("Use " #INSTEAD " instead")
41 #else
42  #define MIR_DEPRECATED_ENUM(ENUM, INSTEAD) \
43  ENUM
44 #endif
45 
49 /* This is C code. Not C++. */
50 
55 typedef enum MirSurfaceAttrib
56 {
57  /* Do not specify values...code relies on 0...N ordering. */
68  /* Must be last */
70 } MirSurfaceAttrib MIR_FOR_REMOVAL_IN_VERSION_1("use MirWindowAttrib");
71 
76 typedef enum MirWindowAttrib
77 {
78  /* Do not specify values...code relies on 0...N ordering. */
89  /* Must be last */
92 
93 typedef enum MirSurfaceType
94 {
107 } MirSurfaceType MIR_FOR_REMOVAL_IN_VERSION_1("use MirWindowType");
108 
109 typedef enum MirWindowType
110 {
121 } MirWindowType;
122 
123 typedef enum MirSurfaceState
124 {
130  /* mir_surface_state_semimaximized,
131  Omitted for now, since it's functionally a subset of vertmaximized and
132  differs only in the X coordinate. */
137 } MirSurfaceState MIR_FOR_REMOVAL_IN_VERSION_1("use MirWindowState");
138 
139 typedef enum MirWindowState
140 {
146  /* mir_window_state_semimaximized,
147  Omitted for now, since it's functionally a subset of vertmaximized and
148  differs only in the X coordinate. */
154 
156 {
159 } MirSurfaceFocusState MIR_FOR_REMOVAL_IN_VERSION_1("use MirWindowFocusState");
160 
162 {
166 
168 {
171 } MirSurfaceVisibility MIR_FOR_REMOVAL_IN_VERSION_1("use MirWindowFocusState");
172 
174 {
178 
179 typedef enum MirLifecycleState
180 {
185 
186 typedef enum MirPowerMode
187 {
188  mir_power_mode_on, /* Display in use. */
189  mir_power_mode_standby, /* Blanked, low power. */
190  mir_power_mode_suspend, /* Blanked, lowest power. */
191  mir_power_mode_off /* Powered down. */
192 } MirPowerMode;
193 
194 typedef enum MirOutputType
195 {
196  mir_output_type_unknown = 0, /* DRM_MODE_CONNECTOR_Unknown */
197  mir_output_type_vga = 1, /* DRM_MODE_CONNECTOR_VGA */
198  mir_output_type_dvii = 2, /* DRM_MODE_CONNECTOR_DVII */
199  mir_output_type_dvid = 3, /* DRM_MODE_CONNECTOR_DVID */
200  mir_output_type_dvia = 4, /* DRM_MODE_CONNECTOR_DVIA */
201  mir_output_type_composite = 5, /* DRM_MODE_CONNECTOR_Composite */
202  mir_output_type_svideo = 6, /* DRM_MODE_CONNECTOR_SVIDEO */
203  mir_output_type_lvds = 7, /* DRM_MODE_CONNECTOR_LVDS */
204  mir_output_type_component = 8, /* DRM_MODE_CONNECTOR_Component */
205  mir_output_type_ninepindin = 9, /* DRM_MODE_CONNECTOR_9PinDIN */
206  mir_output_type_displayport = 10, /* DRM_MODE_CONNECTOR_DisplayPort */
207  mir_output_type_hdmia = 11, /* DRM_MODE_CONNECTOR_HDMIA */
208  mir_output_type_hdmib = 12, /* DRM_MODE_CONNECTOR_HDMIB */
209  mir_output_type_tv = 13, /* DRM_MODE_CONNECTOR_TV */
210  mir_output_type_edp = 14, /* DRM_MODE_CONNECTOR_eDP */
211  mir_output_type_virtual = 15, /* DRM_MODE_CONNECTOR_VIRTUAL */
212  mir_output_type_dsi = 16, /* DRM_MODE_CONNECTOR_DSI */
213  mir_output_type_dpi = 17, /* DRM_MODE_CONNECTOR_DPI */
214 } MirOutputType;
215 
217 {
222 
241 typedef enum MirPixelFormat
242 {
253  /*
254  * TODO: Big endian support would require additional formats in order to
255  * composite software surfaces using OpenGL (GL_RGBA/GL_BGRA_EXT):
256  * mir_pixel_format_rgb[ax]_8888
257  * mir_pixel_format_bgr[ax]_8888
258  */
259  mir_pixel_formats /* Note: This is always max format + 1 */
261 
262 /* This could be improved... https://bugs.launchpad.net/mir/+bug/1236254 */
263 #define MIR_BYTES_PER_PIXEL(f) ((f) == mir_pixel_format_bgr_888 ? 3 : \
264  (f) == mir_pixel_format_rgb_888 ? 3 : \
265  (f) == mir_pixel_format_rgb_565 ? 2 : \
266  (f) == mir_pixel_format_rgba_5551 ? 2 : \
267  (f) == mir_pixel_format_rgba_4444 ? 2 : \
268  4)
269 
271 typedef enum MirOrientation
272 {
278 
280 typedef enum MirMirrorMode
281 {
285 } MirMirrorMode;
286 
287 typedef enum MirOrientationMode
288 {
300 
301 typedef enum MirEdgeAttachment
302 {
308 
309 // Inspired by GdkGravity
315 {
318 
321 
324 
327 
330 
333 
336 
339 
343 
344 // Inspired by GdkAnchorHints
369 typedef enum MirPlacementHints
370 {
373 
376 
379 
382 
385 
388 
391 
394 
397 
401 
405 typedef enum MirFormFactor
406 {
413 } MirFormFactor;
414 
415 
422 {
430 
434 typedef enum MirShellChrome
435 {
439 
444 #pragma GCC diagnostic push
445 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
447 {
449  MIR_DEPRECATED_ENUM(mir_pointer_confined_to_surface, "mir_pointer_confined_to_window"),
450  mir_pointer_confined_to_window = mir_pointer_confined_to_surface,
452 #pragma GCC diagnostic pop
453 
458 {
462 
465 #endif
mir_surface_type_satellite
AKA "toolbox"/"toolbar".
Definition: common.h:47
Definition: common.h:86
the reference point is at the middle of the left edge.
Definition: common.h:320
Arrangement of subpixels cannot be determined.
Definition: common.h:423
Definition: common.h:450
allow resizing window on both axes
Definition: common.h:399
mir_surface_attrib_type
Definition: common.h:41
Definition: common.h:436
mir_surface_attribs
Definition: common.h:41
the reference point is at the lower left corner.
Definition: common.h:338
mir_surface_type_normal
AKA "regular".
Definition: common.h:40
allow sliding window horizontally
Definition: common.h:378
Definition: common.h:90
mir_surface_type_utility
AKA "floating".
Definition: common.h:40
#define MIR_DEPRECATED_ENUM(ENUM, INSTEAD)
Definition: common.h:42
Definition: common.h:175
Definition: common.h:201
Definition: common.h:150
Definition: common.h:85
Definition: common.h:459
mir_surface_type_popover
Definition: common.h:44
mir_surface_state_hidden
Definition: common.h:40
Definition: common.h:210
allow sliding window vertically
Definition: common.h:381
allow resizing window horizontally
Definition: common.h:384
Definition: common.h:213
mir_surface_type_tip
AKA "tooltip".
Definition: common.h:47
Definition: common.h:409
allow flipping aux_anchor to opposite corner
Definition: common.h:390
the reference point is at the center.
Definition: common.h:317
MirPlacementHints
Positioning hints for aligning a window relative to a rectangle.
Definition: common.h:369
Definition: common.h:460
MirPromptSessionState
Definition: common.h:216
Definition: common.h:220
MirWindowAttrib
Attributes of a window that the client and server/shell may wish to get or set over the wire...
Definition: common.h:76
Definition: common.h:448
Definition: common.h:80
mir_surface_visibility_exposed
Definition: common.h:40
Definition: common.h:164
Definition: common.h:209
Definition: common.h:249
Definition: common.h:196
Definition: common.h:183
mir_surface_type_inputmethod
AKA "OSK" or handwriting etc.
Definition: common.h:47
Definition: common.h:197
AKA "floating".
Definition: common.h:112
Definition: common.h:182
MirWindowFocusState
Definition: common.h:161
Definition: common.h:141
Definition: common.h:113
Definition: common.h:181
mir_surface_type_gloss
Definition: common.h:44
MirWindowVisibility
Definition: common.h:173
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:446
Definition: common.h:200
mir_surface_attrib_focus
Definition: common.h:41
AKA "regular".
Definition: common.h:111
Definition: common.h:191
Definition: common.h:218
mir_surface_type_overlay
Definition: common.h:40
mir_surface_state_vertmaximized
Definition: common.h:40
enum MirSurfaceAttrib MIR_FOR_REMOVAL_IN_VERSION_1("use MirWindowAttrib")
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:243
Definition: common.h:204
Definition: common.h:152
mir_surface_state_horizmaximized
Definition: common.h:40
Definition: common.h:303
Definition: common.h:273
AKA "OSK" or handwriting etc.
Definition: common.h:117
Definition: common.h:205
Definition: common.h:247
Definition: common.h:290
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:271
Definition: common.h:293
Definition: common.h:245
the reference point is at the middle of the lower edge.
Definition: common.h:329
MirSubpixelArrangement
Physical arrangement of subpixels on the physical output.
Definition: common.h:421
Definition: common.h:275
mir_surface_attrib_state
Definition: common.h:41
Definition: common.h:289
Definition: common.h:219
Definition: common.h:282
mir_surface_attrib_dpi
Definition: common.h:41
Subpixels are arranged vertically, R, G, B from top to bottom.
Definition: common.h:426
the reference point is in the middle of the top edge.
Definition: common.h:326
mir_surface_state_restored
Definition: common.h:40
Definition: common.h:276
Definition: common.h:190
Definition: common.h:437
Definition: common.h:252
MirSurfaceState
Definition: common.h:123
mir_surface_attrib_visibility
Definition: common.h:41
Definition: common.h:144
Definition: common.h:274
Definition: common.h:283
allow resizing window vertically
Definition: common.h:387
Definition: common.h:115
Definition: common.h:248
mir_surface_state_unknown
Definition: common.h:40
mir_surface_types
Definition: common.h:47
MirOutputGammaSupported
Supports gamma correction.
Definition: common.h:457
mir_surface_attrib_preferred_orientation
Definition: common.h:41
the reference point is at the top right corner.
Definition: common.h:335
Definition: common.h:259
Definition: common.h:411
Definition: common.h:145
Definition: common.h:87
Definition: common.h:79
MirWindowType
Definition: common.h:109
MirMirrorMode
Mirroring axis relative to the "natural" orientation of the display.
Definition: common.h:280
Definition: common.h:251
MirPowerMode
Definition: common.h:186
Definition: common.h:142
the reference point is at the top left corner.
Definition: common.h:332
the reference point is at the lower right corner.
Definition: common.h:341
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:55
mir_surface_states
Definition: common.h:40
Definition: common.h:203
MirSurfaceType
Definition: common.h:93
mir_surface_type_menu
Definition: common.h:47
Definition: common.h:246
Definition: common.h:189
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:405
Definition: common.h:412
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:241
MirLifecycleState
Definition: common.h:179
Definition: common.h:284
MirSurfaceFocusState
Definition: common.h:155
MirSurfaceVisibility
Definition: common.h:167
Definition: common.h:199
allow flipping anchors horizontally
Definition: common.h:372
Definition: common.h:163
Definition: common.h:407
MirShellChrome
Shell chrome.
Definition: common.h:434
mir_surface_unfocused
Definition: common.h:40
Definition: common.h:410
Definition: common.h:143
Definition: common.h:244
Definition: common.h:295
Device does not have regular subpixels.
Definition: common.h:428
mir_surface_type_freestyle
Definition: common.h:44
mir_surface_state_maximized
Definition: common.h:40
Definition: common.h:114
Definition: common.h:202
Definition: common.h:120
allow sliding window on both axes
Definition: common.h:396
Definition: common.h:198
Definition: common.h:206
Definition: common.h:304
mir_surface_type_dialog
Definition: common.h:40
Definition: common.h:250
Definition: common.h:297
allow flipping anchors vertically
Definition: common.h:375
Definition: common.h:207
mir_surface_focused
Definition: common.h:40
AKA "tooltip".
Definition: common.h:119
MirOrientationMode
Definition: common.h:287
Definition: common.h:188
MirWindowState
Definition: common.h:139
MirOutputType
Definition: common.h:194
Definition: common.h:149
the reference point is at the middle of the right edge.
Definition: common.h:323
Definition: common.h:208
Definition: common.h:176
Definition: common.h:212
Definition: common.h:151
AKA "toolbox"/"toolbar".
Definition: common.h:118
Definition: common.h:408
Definition: common.h:81
Subpixels are arranged vertically, B, G, R from top to bottom.
Definition: common.h:427
mir_surface_attrib_swapinterval
Definition: common.h:41
mir_surface_visibility_occluded
Definition: common.h:40
Definition: common.h:305
allow flipping anchors on both axes
Definition: common.h:393
Definition: common.h:211
mir_surface_state_fullscreen
Definition: common.h:40
Subpixels are arranged horizontally, R, G, B from left to right.
Definition: common.h:424
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:314
Definition: common.h:116
Subpixels are arranged horizontally, B, G, R from left to right.
Definition: common.h:425
MirEdgeAttachment
Definition: common.h:301
mir_surface_state_minimized
Definition: common.h:40

Copyright © 2012-2018 Canonical Ltd.
Generated on Mon Feb 19 14:05:11 UTC 2018