2
* Copyright © 2016 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
19
#ifndef MIRAL_MIR_FORWARD_COMPATIBILITY_H
20
#define MIRAL_MIR_FORWARD_COMPATIBILITY_H
22
#include <mir_toolkit/version.h>
23
#include <mir_toolkit/common.h>
24
#include <mir/client/detail/mir_features.h>
26
#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 5, 0)
27
using MirWindowAttrib = MirSurfaceAttrib;
28
auto const mir_window_attrib_type = mir_surface_attrib_type;
29
auto const mir_window_attrib_state = mir_surface_attrib_state;
30
auto const mir_window_attrib_swapinterval = mir_surface_attrib_swapinterval;
31
auto const mir_window_attrib_focus = mir_surface_attrib_focus;
32
auto const mir_window_attrib_dpi = mir_surface_attrib_dpi;
33
auto const mir_window_attrib_visibility = mir_surface_attrib_visibility;
34
auto const mir_window_attrib_preferred_orientation = mir_surface_attrib_preferred_orientation;
35
auto const mir_window_attribs = mir_surface_attribs;
37
using MirWindowType = MirSurfaceType;
38
auto const mir_window_type_normal = mir_surface_type_normal;
39
auto const mir_window_type_utility = mir_surface_type_utility;
40
auto const mir_window_type_dialog = mir_surface_type_dialog;
41
auto const mir_window_type_gloss = mir_surface_type_gloss;
42
auto const mir_window_type_freestyle = mir_surface_type_freestyle;
43
auto const mir_window_type_menu = mir_surface_type_menu;
44
auto const mir_window_type_inputmethod = mir_surface_type_inputmethod;
45
auto const mir_window_type_satellite = mir_surface_type_satellite;
46
auto const mir_window_type_tip = mir_surface_type_tip;
47
auto const mir_window_types = mir_surface_types;
49
using MirWindowState = MirSurfaceState;
50
auto const mir_window_state_unknown = mir_surface_state_unknown;
51
auto const mir_window_state_restored = mir_surface_state_restored;
52
auto const mir_window_state_minimized = mir_surface_state_minimized;
53
auto const mir_window_state_maximized = mir_surface_state_maximized;
54
auto const mir_window_state_vertmaximized = mir_surface_state_vertmaximized;
55
auto const mir_window_state_fullscreen = mir_surface_state_fullscreen;
56
auto const mir_window_state_horizmaximized = mir_surface_state_horizmaximized;
57
auto const mir_window_state_hidden = mir_surface_state_hidden;
58
auto const mir_window_states = mir_surface_states;
60
typedef struct MirSurface MirWindow;
61
typedef struct MirSurfaceParameters MirWindowParameters;
62
typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent;
63
typedef struct MirSurfaceSpec MirWindowSpec;
67
// Types that don't exist in earlier versions of Mir's client
68
#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0)
70
// Inspired by GdkGravity
72
* Reference point for aligning a surface relative to a rectangle.
73
* Each element (surface and rectangle) has a MirPlacementGravity assigned.
75
typedef enum MirPlacementGravity
77
/// the reference point is at the center.
78
mir_placement_gravity_center = 0,
80
/// the reference point is at the middle of the left edge.
81
mir_placement_gravity_west = 1 << 0,
83
/// the reference point is at the middle of the right edge.
84
mir_placement_gravity_east = 1 << 1,
86
/// the reference point is in the middle of the top edge.
87
mir_placement_gravity_north = 1 << 2,
89
/// the reference point is at the middle of the lower edge.
90
mir_placement_gravity_south = 1 << 3,
92
/// the reference point is at the top left corner.
93
mir_placement_gravity_northwest = mir_placement_gravity_north | mir_placement_gravity_west,
95
/// the reference point is at the top right corner.
96
mir_placement_gravity_northeast = mir_placement_gravity_north | mir_placement_gravity_east,
98
/// the reference point is at the lower left corner.
99
mir_placement_gravity_southwest = mir_placement_gravity_south | mir_placement_gravity_west,
101
/// the reference point is at the lower right corner.
102
mir_placement_gravity_southeast = mir_placement_gravity_south | mir_placement_gravity_east
103
} MirPlacementGravity;
105
// Inspired by GdkAnchorHints
107
* Positioning hints for aligning a window relative to a rectangle.
109
* These hints determine how the window should be positioned in the case that
110
* the surface would fall off-screen if placed in its ideal position.
112
* For example, \p mir_placement_hints_flip_x will invert the x component of
113
* \p aux_rect_placement_offset and replace \p mir_placement_gravity_northwest
114
* with \p mir_placement_gravity_northeast and vice versa if the window extends
115
* beyond the left or right edges of the monitor.
117
* If \p mir_placement_hints_slide_x is set, the window can be shifted
118
* horizontally to fit on-screen.
120
* If \p mir_placement_hints_resize_x is set, the window can be shrunken
121
* horizontally to fit.
123
* If \p mir_placement_hints_antipodes is set then the rect gravity may be
124
* substituted with the opposite corner (e.g. \p mir_placement_gravity_northeast
125
* to \p mir_placement_gravity_southwest) in combination with other options.
127
* When multiple flags are set, flipping should take precedence over sliding,
128
* which should take precedence over resizing.
130
typedef enum MirPlacementHints
132
/// allow flipping anchors horizontally
133
mir_placement_hints_flip_x = 1 << 0,
135
/// allow flipping anchors vertically
136
mir_placement_hints_flip_y = 1 << 1,
138
/// allow sliding window horizontally
139
mir_placement_hints_slide_x = 1 << 2,
141
/// allow sliding window vertically
142
mir_placement_hints_slide_y = 1 << 3,
144
/// allow resizing window horizontally
145
mir_placement_hints_resize_x = 1 << 4,
147
/// allow resizing window vertically
148
mir_placement_hints_resize_y = 1 << 5,
150
/// allow flipping aux_anchor to opposite corner
151
mir_placement_hints_antipodes= 1 << 6,
153
/// allow flipping anchors on both axes
154
mir_placement_hints_flip_any = mir_placement_hints_flip_x|mir_placement_hints_flip_y,
156
/// allow sliding window on both axes
157
mir_placement_hints_slide_any = mir_placement_hints_slide_x|mir_placement_hints_slide_y,
159
/// allow resizing window on both axes
160
mir_placement_hints_resize_any = mir_placement_hints_resize_x|mir_placement_hints_resize_y,
164
#if !MIRAL_MIR_DEFINES_POINTER_CONFINEMENT
165
typedef enum MirPointerConfinementState
167
mir_pointer_unconfined,
168
mir_pointer_confined_to_surface,
169
} MirPointerConfinementState;
172
#endif //MIRAL_MIR_FORWARD_COMPATIBILITY_H