~mir-team/miral/release

« back to all changes in this revision

Viewing changes to include/mir/client/detail/mir_forward_compatibility.h

  • Committer: Bileto Bot
  • Date: 2017-06-21 08:34:34 UTC
  • mfrom: (360.1.1 miral-release)
  • Revision ID: ci-train-bot@canonical.com-20170621083434-e7ftkyg5qr2fzsao
* New upstream release 1.4.0 (https://launchpad.net/miral/+milestone/1.4.0)
  - ABI summary:
    . miral ABI unchanged at 2
  - Enhancements:
    . Support for passing messages to enable Drag & Drop
    . Support for client requested move
    . Port to the undeprecated Mir APIs
    . Added "--cursor-theme" option when configuring a cursor theme
    . Drop support for Mir versions before 0.26
  - Bugs fixed:

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2016 Canonical Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 *
16
 
 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17
 
 */
18
 
 
19
 
#ifndef MIRAL_MIR_FORWARD_COMPATIBILITY_H
20
 
#define MIRAL_MIR_FORWARD_COMPATIBILITY_H
21
 
 
22
 
#include <mir_toolkit/version.h>
23
 
#include <mir_toolkit/common.h>
24
 
#include <mir/client/detail/mir_features.h>
25
 
 
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;
36
 
 
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;
48
 
 
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;
59
 
 
60
 
typedef struct MirSurface MirWindow;
61
 
typedef struct MirSurfaceParameters MirWindowParameters;
62
 
typedef struct MirSurfacePlacementEvent MirWindowPlacementEvent;
63
 
typedef struct MirSurfaceSpec MirWindowSpec;
64
 
#endif
65
 
 
66
 
 
67
 
// Types that don't exist in earlier versions of Mir's client
68
 
#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0)
69
 
 
70
 
// Inspired by GdkGravity
71
 
/**
72
 
 * Reference point for aligning a surface relative to a rectangle.
73
 
 * Each element (surface and rectangle) has a MirPlacementGravity assigned.
74
 
 */
75
 
typedef enum MirPlacementGravity
76
 
{
77
 
    /// the reference point is at the center.
78
 
        mir_placement_gravity_center    = 0,
79
 
 
80
 
    /// the reference point is at the middle of the left edge.
81
 
        mir_placement_gravity_west      = 1 << 0,
82
 
 
83
 
    /// the reference point is at the middle of the right edge.
84
 
        mir_placement_gravity_east      = 1 << 1,
85
 
 
86
 
    /// the reference point is in the middle of the top edge.
87
 
        mir_placement_gravity_north     = 1 << 2,
88
 
 
89
 
    /// the reference point is at the middle of the lower edge.
90
 
        mir_placement_gravity_south     = 1 << 3,
91
 
 
92
 
    /// the reference point is at the top left corner.
93
 
        mir_placement_gravity_northwest = mir_placement_gravity_north | mir_placement_gravity_west,
94
 
 
95
 
    /// the reference point is at the top right corner.
96
 
        mir_placement_gravity_northeast = mir_placement_gravity_north | mir_placement_gravity_east,
97
 
 
98
 
    /// the reference point is at the lower left corner.
99
 
        mir_placement_gravity_southwest = mir_placement_gravity_south | mir_placement_gravity_west,
100
 
 
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;
104
 
 
105
 
// Inspired by GdkAnchorHints
106
 
/**
107
 
 * Positioning hints for aligning a window relative to a rectangle.
108
 
 *
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.
111
 
 *
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.
116
 
 *
117
 
 * If \p mir_placement_hints_slide_x is set, the window can be shifted
118
 
 * horizontally to fit on-screen.
119
 
 *
120
 
 * If \p mir_placement_hints_resize_x is set, the window can be shrunken
121
 
 * horizontally to fit.
122
 
 *
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.
126
 
 *
127
 
 * When multiple flags are set, flipping should take precedence over sliding,
128
 
 * which should take precedence over resizing.
129
 
 */
130
 
typedef enum MirPlacementHints
131
 
{
132
 
    /// allow flipping anchors horizontally
133
 
        mir_placement_hints_flip_x   = 1 << 0,
134
 
 
135
 
    /// allow flipping anchors vertically
136
 
        mir_placement_hints_flip_y   = 1 << 1,
137
 
 
138
 
    /// allow sliding window horizontally
139
 
        mir_placement_hints_slide_x  = 1 << 2,
140
 
 
141
 
    /// allow sliding window vertically
142
 
        mir_placement_hints_slide_y  = 1 << 3,
143
 
 
144
 
    /// allow resizing window horizontally
145
 
        mir_placement_hints_resize_x = 1 << 4,
146
 
 
147
 
    /// allow resizing window vertically
148
 
        mir_placement_hints_resize_y = 1 << 5,
149
 
 
150
 
    /// allow flipping aux_anchor to opposite corner
151
 
        mir_placement_hints_antipodes= 1 << 6,
152
 
 
153
 
    /// allow flipping anchors on both axes
154
 
        mir_placement_hints_flip_any = mir_placement_hints_flip_x|mir_placement_hints_flip_y,
155
 
 
156
 
    /// allow sliding window on both axes
157
 
        mir_placement_hints_slide_any  = mir_placement_hints_slide_x|mir_placement_hints_slide_y,
158
 
 
159
 
    /// allow resizing window on both axes
160
 
        mir_placement_hints_resize_any = mir_placement_hints_resize_x|mir_placement_hints_resize_y,
161
 
} MirPlacementHints;
162
 
#endif
163
 
 
164
 
#if !MIRAL_MIR_DEFINES_POINTER_CONFINEMENT
165
 
typedef enum MirPointerConfinementState
166
 
{
167
 
    mir_pointer_unconfined,
168
 
    mir_pointer_confined_to_surface,
169
 
} MirPointerConfinementState;
170
 
#endif
171
 
 
172
 
#endif //MIRAL_MIR_FORWARD_COMPATIBILITY_H