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
49 /* This is C code. Not C++. */
50 
55 typedef enum MirWindowAttrib
56 {
57  /* Do not specify values...code relies on 0...N ordering. */
68  /* Must be last */
71 
72 typedef enum MirWindowType
73 {
86 
87 typedef enum MirWindowState
88 {
94  /* mir_window_state_semimaximized,
95  Omitted for now, since it's functionally a subset of vertmaximized and
96  differs only in the X coordinate. */
103 
105 {
109 
111 {
115 
116 typedef enum MirLifecycleState
117 {
122 
123 typedef enum MirPowerMode
124 {
125  mir_power_mode_on, /* Display in use. */
126  mir_power_mode_standby, /* Blanked, low power. */
127  mir_power_mode_suspend, /* Blanked, lowest power. */
128  mir_power_mode_off /* Powered down. */
130 
131 typedef enum MirOutputType
132 {
133  mir_output_type_unknown = 0, /* DRM_MODE_CONNECTOR_Unknown */
134  mir_output_type_vga = 1, /* DRM_MODE_CONNECTOR_VGA */
135  mir_output_type_dvii = 2, /* DRM_MODE_CONNECTOR_DVII */
136  mir_output_type_dvid = 3, /* DRM_MODE_CONNECTOR_DVID */
137  mir_output_type_dvia = 4, /* DRM_MODE_CONNECTOR_DVIA */
138  mir_output_type_composite = 5, /* DRM_MODE_CONNECTOR_Composite */
139  mir_output_type_svideo = 6, /* DRM_MODE_CONNECTOR_SVIDEO */
140  mir_output_type_lvds = 7, /* DRM_MODE_CONNECTOR_LVDS */
141  mir_output_type_component = 8, /* DRM_MODE_CONNECTOR_Component */
142  mir_output_type_ninepindin = 9, /* DRM_MODE_CONNECTOR_9PinDIN */
143  mir_output_type_displayport = 10, /* DRM_MODE_CONNECTOR_DisplayPort */
144  mir_output_type_hdmia = 11, /* DRM_MODE_CONNECTOR_HDMIA */
145  mir_output_type_hdmib = 12, /* DRM_MODE_CONNECTOR_HDMIB */
146  mir_output_type_tv = 13, /* DRM_MODE_CONNECTOR_TV */
147  mir_output_type_edp = 14, /* DRM_MODE_CONNECTOR_eDP */
148  mir_output_type_virtual = 15, /* DRM_MODE_CONNECTOR_VIRTUAL */
149  mir_output_type_dsi = 16, /* DRM_MODE_CONNECTOR_DSI */
150  mir_output_type_dpi = 17, /* DRM_MODE_CONNECTOR_DPI */
152 
154 {
159 
178 typedef enum MirPixelFormat
179 {
190  /*
191  * TODO: Big endian support would require additional formats in order to
192  * composite software surfaces using OpenGL (GL_RGBA/GL_BGRA_EXT):
193  * mir_pixel_format_rgb[ax]_8888
194  * mir_pixel_format_bgr[ax]_8888
195  */
196  mir_pixel_formats /* Note: This is always max format + 1 */
198 
199 /* This could be improved... https://bugs.launchpad.net/mir/+bug/1236254 */
200 #define MIR_BYTES_PER_PIXEL(f) ((f) == mir_pixel_format_bgr_888 ? 3 : \
201  (f) == mir_pixel_format_rgb_888 ? 3 : \
202  (f) == mir_pixel_format_rgb_565 ? 2 : \
203  (f) == mir_pixel_format_rgba_5551 ? 2 : \
204  (f) == mir_pixel_format_rgba_4444 ? 2 : \
205  4)
206 
208 typedef enum MirOrientation
209 {
215 
217 typedef enum MirMirrorMode
218 {
223 
224 typedef enum MirOrientationMode
225 {
237 
238 typedef enum MirEdgeAttachment
239 {
245 
246 // Inspired by GdkGravity
252 {
255 
258 
261 
264 
267 
270 
273 
276 
280 
281 // Inspired by GdkAnchorHints
306 typedef enum MirPlacementHints
307 {
310 
313 
316 
319 
322 
325 
328 
331 
334 
338 
339 
346 typedef enum MirResizeEdge
347 {
358 
362 typedef enum MirFormFactor
363 {
371 
372 
379 {
387 
391 typedef enum MirShellChrome
392 {
396 
401 #pragma GCC diagnostic push
402 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
404 {
411 #pragma GCC diagnostic pop
412 
417 {
421 
429 typedef enum MirDepthLayer
430 {
438 
439 
442 #endif
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:363
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:209
MirResizeEdge
Hints for resizing a window.
Definition: common.h:347
MirPowerMode
Definition: common.h:124
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:404
MirLifecycleState
Definition: common.h:117
MirWindowType
Definition: common.h:73
MirShellChrome
Shell chrome.
Definition: common.h:392
MirWindowFocusState
Definition: common.h:105
MirWindowState
Definition: common.h:88
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:252
MirEdgeAttachment
Definition: common.h:239
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:179
MirPlacementHints
Positioning hints for aligning a window relative to a rectangle.
Definition: common.h:307
MirMirrorMode
Mirroring axis relative to the "natural" orientation of the display.
Definition: common.h:218
MirOutputType
Definition: common.h:132
MirDepthLayer
Depth layer controls Z ordering of surfaces.
Definition: common.h:430
MirWindowVisibility
Definition: common.h:111
MirWindowAttrib
Attributes of a window that the client and server/shell may wish to get or set over the wire.
Definition: common.h:56
MirPromptSessionState
Definition: common.h:154
MirSubpixelArrangement
Physical arrangement of subpixels on the physical output.
Definition: common.h:379
MirOrientationMode
Definition: common.h:225
MirOutputGammaSupported
Supports gamma correction.
Definition: common.h:417
@ mir_form_factor_unknown
Definition: common.h:364
@ mir_form_factor_projector
Definition: common.h:369
@ mir_form_factor_tablet
Definition: common.h:366
@ mir_form_factor_phone
Definition: common.h:365
@ mir_form_factor_tv
Definition: common.h:368
@ mir_form_factor_monitor
Definition: common.h:367
@ mir_orientation_right
Definition: common.h:213
@ mir_orientation_normal
Definition: common.h:210
@ mir_orientation_left
Definition: common.h:211
@ mir_orientation_inverted
Definition: common.h:212
@ mir_resize_edge_northeast
Definition: common.h:354
@ mir_resize_edge_southwest
Definition: common.h:355
@ mir_resize_edge_south
Definition: common.h:352
@ mir_resize_edge_southeast
Definition: common.h:356
@ mir_resize_edge_north
Definition: common.h:351
@ mir_resize_edge_east
Definition: common.h:350
@ mir_resize_edge_west
Definition: common.h:349
@ mir_resize_edge_none
Definition: common.h:348
@ mir_resize_edge_northwest
Definition: common.h:353
@ mir_power_mode_standby
Definition: common.h:126
@ mir_power_mode_suspend
Definition: common.h:127
@ mir_power_mode_off
Definition: common.h:128
@ mir_power_mode_on
Definition: common.h:125
@ mir_pointer_locked_oneshot
Definition: common.h:408
@ mir_pointer_unconfined
Definition: common.h:405
@ mir_pointer_locked_persistent
Definition: common.h:409
@ mir_pointer_confined_oneshot
Definition: common.h:406
@ mir_pointer_confined_persistent
Definition: common.h:407
@ mir_lifecycle_connection_lost
Definition: common.h:120
@ mir_lifecycle_state_will_suspend
Definition: common.h:118
@ mir_lifecycle_state_resumed
Definition: common.h:119
@ mir_window_type_menu
Definition: common.h:79
@ mir_window_type_satellite
AKA "toolbox"/"toolbar"
Definition: common.h:81
@ mir_window_type_decoration
Definition: common.h:83
@ mir_window_type_gloss
Definition: common.h:77
@ mir_window_type_utility
AKA "floating"
Definition: common.h:75
@ mir_window_type_dialog
Definition: common.h:76
@ mir_window_types
Definition: common.h:84
@ mir_window_type_tip
AKA "tooltip"
Definition: common.h:82
@ mir_window_type_normal
AKA "regular"
Definition: common.h:74
@ mir_window_type_inputmethod
AKA "OSK" or handwriting etc.
Definition: common.h:80
@ mir_window_type_freestyle
Definition: common.h:78
@ mir_shell_chrome_low
Definition: common.h:394
@ mir_shell_chrome_normal
Definition: common.h:393
@ mir_window_focus_state_unfocused
Definition: common.h:106
@ mir_window_focus_state_focused
Definition: common.h:107
@ mir_window_state_attached
Used for panels, notifications and other windows attached to output edges.
Definition: common.h:100
@ mir_window_state_minimized
Definition: common.h:91
@ mir_window_state_horizmaximized
Definition: common.h:98
@ mir_window_states
Definition: common.h:101
@ mir_window_state_restored
Definition: common.h:90
@ mir_window_state_fullscreen
Definition: common.h:97
@ mir_window_state_maximized
Definition: common.h:92
@ mir_window_state_unknown
Definition: common.h:89
@ mir_window_state_hidden
Definition: common.h:99
@ mir_window_state_vertmaximized
Definition: common.h:93
@ mir_placement_gravity_east
the reference point is at the middle of the right edge.
Definition: common.h:260
@ mir_placement_gravity_northwest
the reference point is at the top left corner.
Definition: common.h:269
@ mir_placement_gravity_center
the reference point is at the center.
Definition: common.h:254
@ mir_placement_gravity_west
the reference point is at the middle of the left edge.
Definition: common.h:257
@ mir_placement_gravity_northeast
the reference point is at the top right corner.
Definition: common.h:272
@ mir_placement_gravity_southeast
the reference point is at the lower right corner.
Definition: common.h:278
@ mir_placement_gravity_south
the reference point is at the middle of the lower edge.
Definition: common.h:266
@ mir_placement_gravity_north
the reference point is in the middle of the top edge.
Definition: common.h:263
@ mir_placement_gravity_southwest
the reference point is at the lower left corner.
Definition: common.h:275
@ mir_edge_attachment_horizontal
Definition: common.h:241
@ mir_edge_attachment_vertical
Definition: common.h:240
@ mir_edge_attachment_any
Definition: common.h:242
@ mir_pixel_format_xbgr_8888
Definition: common.h:182
@ mir_pixel_format_invalid
Definition: common.h:180
@ mir_pixel_format_rgb_888
Definition: common.h:186
@ mir_pixel_format_rgb_565
Definition: common.h:187
@ mir_pixel_formats
Definition: common.h:196
@ mir_pixel_format_rgba_5551
Definition: common.h:188
@ mir_pixel_format_abgr_8888
Definition: common.h:181
@ mir_pixel_format_xrgb_8888
Definition: common.h:184
@ mir_pixel_format_argb_8888
Definition: common.h:183
@ mir_pixel_format_bgr_888
Definition: common.h:185
@ mir_pixel_format_rgba_4444
Definition: common.h:189
@ mir_placement_hints_slide_any
allow sliding window on both axes
Definition: common.h:333
@ mir_placement_hints_flip_x
allow flipping anchors horizontally
Definition: common.h:309
@ mir_placement_hints_flip_any
allow flipping anchors on both axes
Definition: common.h:330
@ mir_placement_hints_resize_x
allow resizing window horizontally
Definition: common.h:321
@ mir_placement_hints_antipodes
allow flipping aux_anchor to opposite corner
Definition: common.h:327
@ mir_placement_hints_resize_any
allow resizing window on both axes
Definition: common.h:336
@ mir_placement_hints_slide_x
allow sliding window horizontally
Definition: common.h:315
@ mir_placement_hints_resize_y
allow resizing window vertically
Definition: common.h:324
@ mir_placement_hints_flip_y
allow flipping anchors vertically
Definition: common.h:312
@ mir_placement_hints_slide_y
allow sliding window vertically
Definition: common.h:318
@ mir_mirror_mode_vertical
Definition: common.h:220
@ mir_mirror_mode_none
Definition: common.h:219
@ mir_mirror_mode_horizontal
Definition: common.h:221
@ mir_output_type_svideo
Definition: common.h:139
@ mir_output_type_dpi
Definition: common.h:150
@ mir_output_type_composite
Definition: common.h:138
@ mir_output_type_hdmia
Definition: common.h:144
@ mir_output_type_vga
Definition: common.h:134
@ mir_output_type_displayport
Definition: common.h:143
@ mir_output_type_component
Definition: common.h:141
@ mir_output_type_hdmib
Definition: common.h:145
@ mir_output_type_edp
Definition: common.h:147
@ mir_output_type_ninepindin
Definition: common.h:142
@ mir_output_type_dsi
Definition: common.h:149
@ mir_output_type_tv
Definition: common.h:146
@ mir_output_type_dvii
Definition: common.h:135
@ mir_output_type_virtual
Definition: common.h:148
@ mir_output_type_dvid
Definition: common.h:136
@ mir_output_type_unknown
Definition: common.h:133
@ mir_output_type_lvds
Definition: common.h:140
@ mir_output_type_dvia
Definition: common.h:137
@ mir_depth_layer_below
For panels or other controls/decorations below normal windows.
Definition: common.h:432
@ mir_depth_layer_above
For panels or notifications that want to be above normal windows.
Definition: common.h:435
@ mir_depth_layer_overlay
For overlays such as lock screens (heighest layer)
Definition: common.h:436
@ mir_depth_layer_background
For desktop backgrounds and alike (lowest layer)
Definition: common.h:431
@ mir_depth_layer_always_on_top
For always-on-top application windows.
Definition: common.h:434
@ mir_depth_layer_application
For normal application windows.
Definition: common.h:433
@ mir_window_visibility_exposed
Definition: common.h:113
@ mir_window_visibility_occluded
Definition: common.h:112
@ mir_window_attrib_visibility
Definition: common.h:66
@ mir_window_attrib_swapinterval
Definition: common.h:60
@ mir_window_attrib_preferred_orientation
Definition: common.h:67
@ mir_window_attrib_type
Definition: common.h:58
@ mir_window_attribs
Definition: common.h:69
@ mir_window_attrib_state
Definition: common.h:59
@ mir_window_attrib_focus
Definition: common.h:64
@ mir_window_attrib_dpi
Definition: common.h:65
@ mir_prompt_session_state_suspended
Definition: common.h:157
@ mir_prompt_session_state_stopped
Definition: common.h:155
@ mir_prompt_session_state_started
Definition: common.h:156
@ mir_subpixel_arrangement_horizontal_rgb
Subpixels are arranged horizontally, R, G, B from left to right.
Definition: common.h:381
@ mir_subpixel_arrangement_horizontal_bgr
Subpixels are arranged horizontally, B, G, R from left to right.
Definition: common.h:382
@ mir_subpixel_arrangement_unknown
Arrangement of subpixels cannot be determined.
Definition: common.h:380
@ mir_subpixel_arrangement_vertical_rgb
Subpixels are arranged vertically, R, G, B from top to bottom.
Definition: common.h:383
@ mir_subpixel_arrangement_vertical_bgr
Subpixels are arranged vertically, B, G, R from top to bottom.
Definition: common.h:384
@ mir_subpixel_arrangement_none
Device does not have regular subpixels.
Definition: common.h:385
@ mir_orientation_mode_landscape_any
Definition: common.h:232
@ mir_orientation_mode_portrait
Definition: common.h:226
@ mir_orientation_mode_any
Definition: common.h:234
@ mir_orientation_mode_landscape
Definition: common.h:227
@ mir_orientation_mode_portrait_any
Definition: common.h:230
@ mir_orientation_mode_portrait_inverted
Definition: common.h:228
@ mir_orientation_mode_landscape_inverted
Definition: common.h:229
@ mir_output_gamma_unsupported
Definition: common.h:418
@ mir_output_gamma_supported
Definition: common.h:419

Copyright © 2012-2021 Canonical Ltd.
Generated on Thu Jun 17 07:34:44 UTC 2021
This documentation is licensed under the GPL version 2 or 3.