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 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 
24 //for clang
25 #ifndef __has_feature
26  #define __has_feature(x) 0 // Compatibility with non-clang
27 #endif
28 
29 //for clang
30 #ifndef __has_extension
31  #define __has_extension __has_feature // Compatibility with pre-3.0
32 #endif
33 
34 #if __GNUC__ >= 6 || \
35  (__has_extension(attribute_deprecated_with_message) && \
36  __has_extension(enumerator_attributes))
37  #define MIR_DEPRECATED_ENUM(ENUM, INSTEAD) \
38  ENUM __attribute__ ((deprecated("Use " #INSTEAD " instead")))
39 #else
40  #define MIR_DEPRECATED_ENUM(ENUM, INSTEAD) \
41  ENUM
42 #endif
43 
47 /* This is C code. Not C++. */
48 
53 typedef enum MirSurfaceAttrib
54 {
55  /* Do not specify values...code relies on 0...N ordering. */
66  /* Must be last */
68 } MirSurfaceAttrib __attribute__ ((deprecated("use MirWindowAttrib")));
69 
74 typedef enum MirWindowAttrib
75 {
76  /* Do not specify values...code relies on 0...N ordering. */
87  /* Must be last */
90 
91 typedef enum MirSurfaceType
92 {
105 } MirSurfaceType __attribute__ ((deprecated("use MirWindowType")));
106 
107 typedef enum MirWindowType
108 {
119 } MirWindowType;
120 
121 typedef enum MirSurfaceState
122 {
128  /* mir_surface_state_semimaximized,
129  Omitted for now, since it's functionally a subset of vertmaximized and
130  differs only in the X coordinate. */
135 } MirSurfaceState __attribute__ ((deprecated("use MirWindowState")));
136 
137 typedef enum MirWindowState
138 {
144  /* mir_window_state_semimaximized,
145  Omitted for now, since it's functionally a subset of vertmaximized and
146  differs only in the X coordinate. */
152 
154 {
157 } MirSurfaceFocusState __attribute__ ((deprecated("use MirWindowFocusState")));
158 
160 {
164 
166 {
169 } MirSurfaceVisibility __attribute__ ((deprecated("use MirWindowFocusState")));
170 
172 {
176 
177 typedef enum MirLifecycleState
178 {
183 
184 typedef enum MirPowerMode
185 {
186  mir_power_mode_on, /* Display in use. */
187  mir_power_mode_standby, /* Blanked, low power. */
188  mir_power_mode_suspend, /* Blanked, lowest power. */
189  mir_power_mode_off /* Powered down. */
190 } MirPowerMode;
191 
192 typedef enum MirOutputType
193 {
194  mir_output_type_unknown = 0, /* DRM_MODE_CONNECTOR_Unknown */
195  mir_output_type_vga = 1, /* DRM_MODE_CONNECTOR_VGA */
196  mir_output_type_dvii = 2, /* DRM_MODE_CONNECTOR_DVII */
197  mir_output_type_dvid = 3, /* DRM_MODE_CONNECTOR_DVID */
198  mir_output_type_dvia = 4, /* DRM_MODE_CONNECTOR_DVIA */
199  mir_output_type_composite = 5, /* DRM_MODE_CONNECTOR_Composite */
200  mir_output_type_svideo = 6, /* DRM_MODE_CONNECTOR_SVIDEO */
201  mir_output_type_lvds = 7, /* DRM_MODE_CONNECTOR_LVDS */
202  mir_output_type_component = 8, /* DRM_MODE_CONNECTOR_Component */
203  mir_output_type_ninepindin = 9, /* DRM_MODE_CONNECTOR_9PinDIN */
204  mir_output_type_displayport = 10, /* DRM_MODE_CONNECTOR_DisplayPort */
205  mir_output_type_hdmia = 11, /* DRM_MODE_CONNECTOR_HDMIA */
206  mir_output_type_hdmib = 12, /* DRM_MODE_CONNECTOR_HDMIB */
207  mir_output_type_tv = 13, /* DRM_MODE_CONNECTOR_TV */
208  mir_output_type_edp = 14, /* DRM_MODE_CONNECTOR_eDP */
209  mir_output_type_virtual = 15, /* DRM_MODE_CONNECTOR_VIRTUAL */
210  mir_output_type_dsi = 16, /* DRM_MODE_CONNECTOR_DSI */
211  mir_output_type_dpi = 17, /* DRM_MODE_CONNECTOR_DPI */
212 } MirOutputType;
213 
215 {
220 
239 typedef enum MirPixelFormat
240 {
251  /*
252  * TODO: Big endian support would require additional formats in order to
253  * composite software surfaces using OpenGL (GL_RGBA/GL_BGRA_EXT):
254  * mir_pixel_format_rgb[ax]_8888
255  * mir_pixel_format_bgr[ax]_8888
256  */
257  mir_pixel_formats /* Note: This is always max format + 1 */
259 
260 /* This could be improved... https://bugs.launchpad.net/mir/+bug/1236254 */
261 #define MIR_BYTES_PER_PIXEL(f) ((f) == mir_pixel_format_bgr_888 ? 3 : \
262  (f) == mir_pixel_format_rgb_888 ? 3 : \
263  (f) == mir_pixel_format_rgb_565 ? 2 : \
264  (f) == mir_pixel_format_rgba_5551 ? 2 : \
265  (f) == mir_pixel_format_rgba_4444 ? 2 : \
266  4)
267 
269 typedef enum MirOrientation
270 {
276 
278 typedef enum MirMirrorMode
279 {
283 } MirMirrorMode;
284 
285 typedef enum MirOrientationMode
286 {
298 
299 typedef enum MirEdgeAttachment
300 {
306 
307 // Inspired by GdkGravity
313 {
316 
319 
322 
325 
328 
331 
334 
337 
341 
342 // Inspired by GdkAnchorHints
367 typedef enum MirPlacementHints
368 {
371 
374 
377 
380 
383 
386 
389 
392 
395 
399 
403 typedef enum MirFormFactor
404 {
411 } MirFormFactor;
412 
413 
420 {
428 
432 typedef enum MirShellChrome
433 {
437 
442 #pragma GCC diagnostic push
443 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
445 {
447  MIR_DEPRECATED_ENUM(mir_pointer_confined_to_surface, "mir_pointer_confined_to_window"),
448  mir_pointer_confined_to_window = mir_pointer_confined_to_surface,
450 #pragma GCC diagnostic pop
451 
456 {
460 
463 #endif
mir_surface_type_satellite
AKA "toolbox"/"toolbar".
Definition: common.h:80
Definition: common.h:84
the reference point is at the middle of the left edge.
Definition: common.h:318
Arrangement of subpixels cannot be determined.
Definition: common.h:421
Definition: common.h:448
allow resizing window on both axes
Definition: common.h:397
mir_surface_attrib_type
Definition: common.h:74
Definition: common.h:434
mir_surface_attribs
Definition: common.h:74
the reference point is at the lower left corner.
Definition: common.h:336
mir_surface_type_normal
AKA "regular".
Definition: common.h:73
allow sliding window horizontally
Definition: common.h:376
Definition: common.h:88
mir_surface_type_utility
AKA "floating".
Definition: common.h:73
#define MIR_DEPRECATED_ENUM(ENUM, INSTEAD)
Definition: common.h:40
Definition: common.h:173
Definition: common.h:199
Definition: common.h:148
Definition: common.h:83
Definition: common.h:457
mir_surface_type_popover
Definition: common.h:77
mir_surface_state_hidden
Definition: common.h:73
Definition: common.h:208
allow sliding window vertically
Definition: common.h:379
allow resizing window horizontally
Definition: common.h:382
Definition: common.h:211
mir_surface_type_tip
AKA "tooltip".
Definition: common.h:80
enum MirSurfaceAttrib __attribute__((deprecated("use MirWindowAttrib")))
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:407
allow flipping aux_anchor to opposite corner
Definition: common.h:388
the reference point is at the center.
Definition: common.h:315
MirPlacementHints
Positioning hints for aligning a window relative to a rectangle.
Definition: common.h:367
Definition: common.h:458
MirPromptSessionState
Definition: common.h:214
Definition: common.h:218
MirWindowAttrib
Attributes of a window that the client and server/shell may wish to get or set over the wire...
Definition: common.h:74
Definition: common.h:446
Definition: common.h:78
mir_surface_visibility_exposed
Definition: common.h:73
Definition: common.h:162
Definition: common.h:207
Definition: common.h:247
Definition: common.h:194
Definition: common.h:181
mir_surface_type_inputmethod
AKA "OSK" or handwriting etc.
Definition: common.h:80
Definition: common.h:195
AKA "floating".
Definition: common.h:110
Definition: common.h:180
MirWindowFocusState
Definition: common.h:159
Definition: common.h:139
Definition: common.h:111
Definition: common.h:179
mir_surface_type_gloss
Definition: common.h:77
MirWindowVisibility
Definition: common.h:171
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:444
Definition: common.h:198
mir_surface_attrib_focus
Definition: common.h:74
AKA "regular".
Definition: common.h:109
Definition: common.h:189
Definition: common.h:216
mir_surface_type_overlay
Definition: common.h:73
mir_surface_state_vertmaximized
Definition: common.h:73
Definition: common.h:241
Definition: common.h:202
Definition: common.h:150
mir_surface_state_horizmaximized
Definition: common.h:73
Definition: common.h:301
Definition: common.h:271
AKA "OSK" or handwriting etc.
Definition: common.h:115
Definition: common.h:203
Definition: common.h:245
Definition: common.h:288
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:269
Definition: common.h:291
Definition: common.h:243
the reference point is at the middle of the lower edge.
Definition: common.h:327
MirSubpixelArrangement
Physical arrangement of subpixels on the physical output.
Definition: common.h:419
Definition: common.h:273
mir_surface_attrib_state
Definition: common.h:74
Definition: common.h:287
Definition: common.h:217
Definition: common.h:280
mir_surface_attrib_dpi
Definition: common.h:74
Subpixels are arranged vertically, R, G, B from top to bottom.
Definition: common.h:424
the reference point is in the middle of the top edge.
Definition: common.h:324
mir_surface_state_restored
Definition: common.h:73
Definition: common.h:274
Definition: common.h:188
Definition: common.h:435
Definition: common.h:250
MirSurfaceState
Definition: common.h:121
mir_surface_attrib_visibility
Definition: common.h:74
Definition: common.h:142
Definition: common.h:272
Definition: common.h:281
allow resizing window vertically
Definition: common.h:385
Definition: common.h:113
Definition: common.h:246
mir_surface_state_unknown
Definition: common.h:73
mir_surface_types
Definition: common.h:80
MirOutputGammaSupported
Supports gamma correction.
Definition: common.h:455
mir_surface_attrib_preferred_orientation
Definition: common.h:74
the reference point is at the top right corner.
Definition: common.h:333
Definition: common.h:257
Definition: common.h:409
Definition: common.h:143
Definition: common.h:85
Definition: common.h:77
MirWindowType
Definition: common.h:107
MirMirrorMode
Mirroring axis relative to the "natural" orientation of the display.
Definition: common.h:278
Definition: common.h:249
MirPowerMode
Definition: common.h:184
Definition: common.h:140
the reference point is at the top left corner.
Definition: common.h:330
the reference point is at the lower right corner.
Definition: common.h:339
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:53
mir_surface_states
Definition: common.h:73
Definition: common.h:201
MirSurfaceType
Definition: common.h:91
mir_surface_type_menu
Definition: common.h:80
Definition: common.h:244
Definition: common.h:187
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:403
Definition: common.h:410
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:239
MirLifecycleState
Definition: common.h:177
Definition: common.h:282
MirSurfaceFocusState
Definition: common.h:153
MirSurfaceVisibility
Definition: common.h:165
Definition: common.h:197
allow flipping anchors horizontally
Definition: common.h:370
Definition: common.h:161
Definition: common.h:405
MirShellChrome
Shell chrome.
Definition: common.h:432
mir_surface_unfocused
Definition: common.h:73
Definition: common.h:408
Definition: common.h:141
Definition: common.h:242
Definition: common.h:293
Device does not have regular subpixels.
Definition: common.h:426
mir_surface_type_freestyle
Definition: common.h:77
mir_surface_state_maximized
Definition: common.h:73
Definition: common.h:112
Definition: common.h:200
Definition: common.h:118
allow sliding window on both axes
Definition: common.h:394
Definition: common.h:196
Definition: common.h:204
Definition: common.h:302
mir_surface_type_dialog
Definition: common.h:73
Definition: common.h:248
Definition: common.h:295
allow flipping anchors vertically
Definition: common.h:373
Definition: common.h:205
mir_surface_focused
Definition: common.h:73
AKA "tooltip".
Definition: common.h:117
MirOrientationMode
Definition: common.h:285
Definition: common.h:186
MirWindowState
Definition: common.h:137
MirOutputType
Definition: common.h:192
Definition: common.h:147
the reference point is at the middle of the right edge.
Definition: common.h:321
Definition: common.h:206
Definition: common.h:174
Definition: common.h:210
Definition: common.h:149
AKA "toolbox"/"toolbar".
Definition: common.h:116
Definition: common.h:406
Definition: common.h:79
Subpixels are arranged vertically, B, G, R from top to bottom.
Definition: common.h:425
mir_surface_attrib_swapinterval
Definition: common.h:74
mir_surface_visibility_occluded
Definition: common.h:73
Definition: common.h:303
allow flipping anchors on both axes
Definition: common.h:391
Definition: common.h:209
mir_surface_state_fullscreen
Definition: common.h:73
Subpixels are arranged horizontally, R, G, B from left to right.
Definition: common.h:422
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:312
Definition: common.h:114
Subpixels are arranged horizontally, B, G, R from left to right.
Definition: common.h:423
MirEdgeAttachment
Definition: common.h:299
mir_surface_state_minimized
Definition: common.h:73

Copyright © 2012-2016 Canonical Ltd.
Generated on Mon Mar 27 12:06:55 UTC 2017