Merge lp:~alan-griffiths/miral/confine_pointer into lp:miral

Proposed by Alan Griffiths on 2016-09-23
Status: Merged
Approved by: Daniel d'Andrada on 2016-09-23
Approved revision: 363
Merged at revision: 358
Proposed branch: lp:~alan-griffiths/miral/confine_pointer
Merge into: lp:miral
Diff against target: 537 lines (+230/-101)
11 files modified
debian/libmiral1.symbols (+6/-1)
include/miral/detail/mir_forward_compatibility.h (+130/-0)
include/miral/window_info.h (+3/-0)
include/miral/window_specification.h (+4/-98)
miral/CMakeLists.txt (+12/-1)
miral/basic_window_manager.cpp (+6/-0)
miral/mir_features.h.in (+28/-0)
miral/symbols.map (+8/-0)
miral/window_info.cpp (+11/-0)
miral/window_management_trace.cpp (+2/-1)
miral/window_specification.cpp (+20/-0)
To merge this branch: bzr merge lp:~alan-griffiths/miral/confine_pointer
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve on 2016-09-23
Daniel d'Andrada (community) Approve on 2016-09-23
Alan Griffiths Pending
Review via email: mp+306635@code.launchpad.net

This proposal supersedes a proposal from 2016-09-21.

Commit Message

Add pointer confinement

To post a comment you must log in.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

Does not compile against Mir-0.20 - which is in 16.04 LTS, it needs similar compatibility hacks to MirPlacementGravity. (A PITA I know, but we should support the LTS.)

/home/alan/display_server/miral/include/miral/window_specification.h:196:57: error: ‘MirPointerConfinementState’ was not declared in this scope
     auto confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&;
                                                         ^

review: Needs Fixing
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

On 22/09/2016 05:26, Alan Griffiths wrote:
> Review: Needs Fixing
>
> Does not compile against Mir-0.20 - which is in 16.04 LTS, it needs similar compatibility hacks to MirPlacementGravity. (A PITA I know, but we should support the LTS.)
>
> /home/alan/display_server/miral/include/miral/window_specification.h:196:57: error: ‘MirPointerConfinementState’ was not declared in this scope
> auto confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&;
> ^
>
>
MIR_CLIENT_VERSION hasn't changed between mir 0.23 and 0.24 (where that
symbol got released). What do you suggest?

Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

> MIR_CLIENT_VERSION hasn't changed between mir 0.23 and 0.24 (where that
> symbol got released). What do you suggest?

That's a Mir bug (not sure if I actually reported it).

I suggest detecting MIRCLIENT_VERSION (set by pkg_check_modules()) in CMakeLists.txt with:

    if (MIRTEST_VERSION VERSION_LESS 0.24)
    add_definitions(-DMIRAL_NO_POINTER_CONFINEMENT_IN_MIR)
    endif()

Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

> > MIR_CLIENT_VERSION hasn't changed between mir 0.23 and 0.24 (where that
> > symbol got released). What do you suggest?
>
> That's a Mir bug (not sure if I actually reported it).
>
> I suggest detecting MIRCLIENT_VERSION (set by pkg_check_modules()) in
> CMakeLists.txt with:
>
> if (MIRTEST_VERSION VERSION_LESS 0.24)
MIRCLIENT_VERSION
> add_definitions(-DMIRAL_NO_POINTER_CONFINEMENT_IN_MIR)
> endif()

Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

On 22/09/2016 05:26, Alan Griffiths wrote:
> Review: Needs Fixing
>
> Does not compile against Mir-0.20 - which is in 16.04 LTS, it needs similar compatibility hacks to MirPlacementGravity. (A PITA I know, but we should support the LTS.)
>
> /home/alan/display_server/miral/include/miral/window_specification.h:196:57: error: ‘MirPointerConfinementState’ was not declared in this scope
> auto confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&;
> ^
>
>
Fixed.

Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

I'd like it fixed in a similar way to the window_placement_gravity() - i.e. on earlier versions of Mir the miral downstream sees the API (and ABI) but the feature is inactive.

That way the downstream never needs to care about the Mir version - they just write against the MirAL API.

review: Needs Fixing
362. By Alan Griffiths on 2016-09-23

Fix build on yakkety

Alan Griffiths (alan-griffiths) wrote :

Hmm, debuild doesn't seem to like my libmiral1.symbols file. I wish I understood it.

363. By Alan Griffiths on 2016-09-23

Add pointer confinement to WM trace

Daniel d'Andrada (dandrader) wrote :

Looks good to me.
Thanks.

review: Approve
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/libmiral1.symbols'
2--- debian/libmiral1.symbols 2016-09-20 13:43:29 +0000
3+++ debian/libmiral1.symbols 2016-09-23 15:39:15 +0000
4@@ -1,5 +1,6 @@
5 libmiral.so.1 libmiral1 #MINVER#
6- MIRAL_0.1@MIRAL_0.1 0.1.0
7+ MIRAL_0.1@MIRAL_0.1 0.1.0+16.10.20160919-0ubuntu1
8+ MIRAL_0.2@MIRAL_0.2 0.2.0
9 (c++)"miral::ActiveOutputsListener::advise_output_begin()@MIRAL_0.1" 0.1.0
10 (c++)"miral::ActiveOutputsListener::advise_output_create(miral::Output const&)@MIRAL_0.1" 0.1.0
11 (c++)"miral::ActiveOutputsListener::advise_output_delete(miral::Output const&)@MIRAL_0.1" 0.1.0
12@@ -97,6 +98,8 @@
13 (c++)"miral::WindowInfo::can_be_active() const@MIRAL_0.1" 0.1.0
14 (c++)"miral::WindowInfo::can_morph_to(MirSurfaceType) const@MIRAL_0.1" 0.1.0
15 (c++)"miral::WindowInfo::children() const@MIRAL_0.1" 0.1.0
16+ (c++)"miral::WindowInfo::confine_pointer() const@MIRAL_0.2" 0.2.0
17+ (c++)"miral::WindowInfo::confine_pointer(MirPointerConfinementState)@MIRAL_0.2" 0.2.0
18 (c++)"miral::WindowInfo::constrain_resize(mir::geometry::Point&, mir::geometry::Size&) const@MIRAL_0.1" 0.1.0
19 (c++)"miral::WindowInfo::has_name() const@MIRAL_0.1" 0.1.0
20 (c++)"miral::WindowInfo::has_output_id() const@MIRAL_0.1" 0.1.0
21@@ -190,6 +193,8 @@
22 (c++)"miral::WindowSpecification::aux_rect_placement_gravity()@MIRAL_0.1" 0.1.0
23 (c++)"miral::WindowSpecification::aux_rect_placement_offset() const@MIRAL_0.1" 0.1.0
24 (c++)"miral::WindowSpecification::aux_rect_placement_offset()@MIRAL_0.1" 0.1.0
25+ (c++)"miral::WindowSpecification::confine_pointer const@MIRAL_0.2" 0.2.0
26+ (c++)"miral::WindowSpecification::confine_pointer@MIRAL_0.2" 0.2.0
27 (c++)"miral::WindowSpecification::height_inc() const@MIRAL_0.1" 0.1.0
28 (c++)"miral::WindowSpecification::height_inc()@MIRAL_0.1" 0.1.0
29 (c++)"miral::WindowSpecification::input_mode() const@MIRAL_0.1" 0.1.0
30
31=== added directory 'include/miral/detail'
32=== added file 'include/miral/detail/mir_forward_compatibility.h'
33--- include/miral/detail/mir_forward_compatibility.h 1970-01-01 00:00:00 +0000
34+++ include/miral/detail/mir_forward_compatibility.h 2016-09-23 15:39:15 +0000
35@@ -0,0 +1,130 @@
36+/*
37+ * Copyright © 2016 Canonical Ltd.
38+ *
39+ * This program is free software: you can redistribute it and/or modify it
40+ * under the terms of the GNU General Public License version 3,
41+ * as published by the Free Software Foundation.
42+ *
43+ * This program is distributed in the hope that it will be useful,
44+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
45+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+ * GNU General Public License for more details.
47+ *
48+ * You should have received a copy of the GNU General Public License
49+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
50+ *
51+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
52+ */
53+
54+#ifndef MIRAL_MIR_FORWARD_COMPATIBILITY_H
55+#define MIRAL_MIR_FORWARD_COMPATIBILITY_H
56+
57+#include <mir_toolkit/version.h>
58+#include <miral/detail/mir_features.h>
59+
60+// Types that don't exist in earlier versions of Mir's toolkit
61+#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0)
62+
63+// Inspired by GdkGravity
64+/**
65+ * Reference point for aligning a surface relative to a rectangle.
66+ * Each element (surface and rectangle) has a MirPlacementGravity assigned.
67+ */
68+typedef enum MirPlacementGravity
69+{
70+ /// the reference point is at the center.
71+ mir_placement_gravity_center = 0,
72+
73+ /// the reference point is at the middle of the left edge.
74+ mir_placement_gravity_west = 1 << 0,
75+
76+ /// the reference point is at the middle of the right edge.
77+ mir_placement_gravity_east = 1 << 1,
78+
79+ /// the reference point is in the middle of the top edge.
80+ mir_placement_gravity_north = 1 << 2,
81+
82+ /// the reference point is at the middle of the lower edge.
83+ mir_placement_gravity_south = 1 << 3,
84+
85+ /// the reference point is at the top left corner.
86+ mir_placement_gravity_northwest = mir_placement_gravity_north | mir_placement_gravity_west,
87+
88+ /// the reference point is at the top right corner.
89+ mir_placement_gravity_northeast = mir_placement_gravity_north | mir_placement_gravity_east,
90+
91+ /// the reference point is at the lower left corner.
92+ mir_placement_gravity_southwest = mir_placement_gravity_south | mir_placement_gravity_west,
93+
94+ /// the reference point is at the lower right corner.
95+ mir_placement_gravity_southeast = mir_placement_gravity_south | mir_placement_gravity_east
96+} MirPlacementGravity;
97+
98+// Inspired by GdkAnchorHints
99+/**
100+ * Positioning hints for aligning a window relative to a rectangle.
101+ *
102+ * These hints determine how the window should be positioned in the case that
103+ * the surface would fall off-screen if placed in its ideal position.
104+ *
105+ * For example, \p mir_placement_hints_flip_x will invert the x component of
106+ * \p aux_rect_placement_offset and replace \p mir_placement_gravity_northwest
107+ * with \p mir_placement_gravity_northeast and vice versa if the window extends
108+ * beyond the left or right edges of the monitor.
109+ *
110+ * If \p mir_placement_hints_slide_x is set, the window can be shifted
111+ * horizontally to fit on-screen.
112+ *
113+ * If \p mir_placement_hints_resize_x is set, the window can be shrunken
114+ * horizontally to fit.
115+ *
116+ * If \p mir_placement_hints_antipodes is set then the rect gravity may be
117+ * substituted with the opposite corner (e.g. \p mir_placement_gravity_northeast
118+ * to \p mir_placement_gravity_southwest) in combination with other options.
119+ *
120+ * When multiple flags are set, flipping should take precedence over sliding,
121+ * which should take precedence over resizing.
122+ */
123+typedef enum MirPlacementHints
124+{
125+ /// allow flipping anchors horizontally
126+ mir_placement_hints_flip_x = 1 << 0,
127+
128+ /// allow flipping anchors vertically
129+ mir_placement_hints_flip_y = 1 << 1,
130+
131+ /// allow sliding window horizontally
132+ mir_placement_hints_slide_x = 1 << 2,
133+
134+ /// allow sliding window vertically
135+ mir_placement_hints_slide_y = 1 << 3,
136+
137+ /// allow resizing window horizontally
138+ mir_placement_hints_resize_x = 1 << 4,
139+
140+ /// allow resizing window vertically
141+ mir_placement_hints_resize_y = 1 << 5,
142+
143+ /// allow flipping aux_anchor to opposite corner
144+ mir_placement_hints_antipodes= 1 << 6,
145+
146+ /// allow flipping anchors on both axes
147+ mir_placement_hints_flip_any = mir_placement_hints_flip_x|mir_placement_hints_flip_y,
148+
149+ /// allow sliding window on both axes
150+ mir_placement_hints_slide_any = mir_placement_hints_slide_x|mir_placement_hints_slide_y,
151+
152+ /// allow resizing window on both axes
153+ mir_placement_hints_resize_any = mir_placement_hints_resize_x|mir_placement_hints_resize_y,
154+} MirPlacementHints;
155+#endif
156+
157+#if !MIRAL_MIR_DEFINES_POINTER_CONFINEMENT
158+typedef enum MirPointerConfinementState
159+{
160+ mir_pointer_unconfined,
161+ mir_pointer_confined_to_surface,
162+} MirPointerConfinementState;
163+#endif
164+
165+#endif //MIRAL_MIR_FORWARD_COMPATIBILITY_H
166
167=== modified file 'include/miral/window_info.h'
168--- include/miral/window_info.h 2016-09-12 14:24:21 +0000
169+++ include/miral/window_info.h 2016-09-23 15:39:15 +0000
170@@ -104,6 +104,9 @@
171 auto preferred_orientation() const -> MirOrientationMode;
172 void preferred_orientation(MirOrientationMode preferred_orientation);
173
174+ auto confine_pointer() const -> MirPointerConfinementState;
175+ void confine_pointer(MirPointerConfinementState confinement);
176+
177 /// This can be used by client code to store window manager specific information
178 auto userdata() const -> std::shared_ptr<void>;
179 void userdata(std::shared_ptr<void> userdata);
180
181=== modified file 'include/miral/window_specification.h'
182--- include/miral/window_specification.h 2016-09-14 15:54:54 +0000
183+++ include/miral/window_specification.h 2016-09-23 15:39:15 +0000
184@@ -20,7 +20,8 @@
185 #define MIRAL_WINDOW_SPECIFICATION_H
186
187 #include <mir_toolkit/common.h>
188-#include <mir_toolkit/version.h>
189+
190+#include "miral/detail/mir_forward_compatibility.h"
191
192 #include <mir/geometry/displacement.h>
193 #include <mir/geometry/rectangles.h>
194@@ -29,103 +30,6 @@
195
196 #include <memory>
197
198-// TODO this wants to move to Mir's toolkit API
199-#if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0)
200-
201-// Inspired by GdkGravity
202-/**
203- * Reference point for aligning a surface relative to a rectangle.
204- * Each element (surface and rectangle) has a MirPlacementGravity assigned.
205- */
206-typedef enum MirPlacementGravity
207-{
208- /// the reference point is at the center.
209- mir_placement_gravity_center = 0,
210-
211- /// the reference point is at the middle of the left edge.
212- mir_placement_gravity_west = 1 << 0,
213-
214- /// the reference point is at the middle of the right edge.
215- mir_placement_gravity_east = 1 << 1,
216-
217- /// the reference point is in the middle of the top edge.
218- mir_placement_gravity_north = 1 << 2,
219-
220- /// the reference point is at the middle of the lower edge.
221- mir_placement_gravity_south = 1 << 3,
222-
223- /// the reference point is at the top left corner.
224- mir_placement_gravity_northwest = mir_placement_gravity_north | mir_placement_gravity_west,
225-
226- /// the reference point is at the top right corner.
227- mir_placement_gravity_northeast = mir_placement_gravity_north | mir_placement_gravity_east,
228-
229- /// the reference point is at the lower left corner.
230- mir_placement_gravity_southwest = mir_placement_gravity_south | mir_placement_gravity_west,
231-
232- /// the reference point is at the lower right corner.
233- mir_placement_gravity_southeast = mir_placement_gravity_south | mir_placement_gravity_east
234-} MirPlacementGravity;
235-
236-// Inspired by GdkAnchorHints
237-/**
238- * Positioning hints for aligning a window relative to a rectangle.
239- *
240- * These hints determine how the window should be positioned in the case that
241- * the surface would fall off-screen if placed in its ideal position.
242- *
243- * For example, \p mir_placement_hints_flip_x will invert the x component of
244- * \p aux_rect_placement_offset and replace \p mir_placement_gravity_northwest
245- * with \p mir_placement_gravity_northeast and vice versa if the window extends
246- * beyond the left or right edges of the monitor.
247- *
248- * If \p mir_placement_hints_slide_x is set, the window can be shifted
249- * horizontally to fit on-screen.
250- *
251- * If \p mir_placement_hints_resize_x is set, the window can be shrunken
252- * horizontally to fit.
253- *
254- * If \p mir_placement_hints_antipodes is set then the rect gravity may be
255- * substituted with the opposite corner (e.g. \p mir_placement_gravity_northeast
256- * to \p mir_placement_gravity_southwest) in combination with other options.
257- *
258- * When multiple flags are set, flipping should take precedence over sliding,
259- * which should take precedence over resizing.
260- */
261-typedef enum MirPlacementHints
262-{
263- /// allow flipping anchors horizontally
264- mir_placement_hints_flip_x = 1 << 0,
265-
266- /// allow flipping anchors vertically
267- mir_placement_hints_flip_y = 1 << 1,
268-
269- /// allow sliding window horizontally
270- mir_placement_hints_slide_x = 1 << 2,
271-
272- /// allow sliding window vertically
273- mir_placement_hints_slide_y = 1 << 3,
274-
275- /// allow resizing window horizontally
276- mir_placement_hints_resize_x = 1 << 4,
277-
278- /// allow resizing window vertically
279- mir_placement_hints_resize_y = 1 << 5,
280-
281- /// allow flipping aux_anchor to opposite corner
282- mir_placement_hints_antipodes= 1 << 6,
283-
284- /// allow flipping anchors on both axes
285- mir_placement_hints_flip_any = mir_placement_hints_flip_x|mir_placement_hints_flip_y,
286-
287- /// allow sliding window on both axes
288- mir_placement_hints_slide_any = mir_placement_hints_slide_x|mir_placement_hints_slide_y,
289-
290- /// allow resizing window on both axes
291- mir_placement_hints_resize_any = mir_placement_hints_resize_x|mir_placement_hints_resize_y,
292-} MirPlacementHints;
293-#endif
294-
295 namespace mir
296 {
297 namespace scene { class Surface; struct SurfaceCreationParameters; }
298@@ -193,6 +97,7 @@
299 auto input_shape() const -> mir::optional_value<std::vector<Rectangle>> const&;
300 auto input_mode() const -> mir::optional_value<InputReceptionMode> const&;
301 auto shell_chrome() const -> mir::optional_value<MirShellChrome> const&;
302+ auto confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&;
303
304 auto top_left() -> mir::optional_value<Point>&;
305 auto size() -> mir::optional_value<Size>&;
306@@ -218,6 +123,7 @@
307 auto input_shape() -> mir::optional_value<std::vector<Rectangle>>&;
308 auto input_mode() -> mir::optional_value<InputReceptionMode>&;
309 auto shell_chrome() -> mir::optional_value<MirShellChrome>&;
310+ auto confine_pointer() -> mir::optional_value<MirPointerConfinementState>&;
311
312 private:
313 struct Self;
314
315=== modified file 'miral/CMakeLists.txt'
316--- miral/CMakeLists.txt 2016-09-21 16:49:48 +0000
317+++ miral/CMakeLists.txt 2016-09-23 15:39:15 +0000
318@@ -45,7 +45,7 @@
319 ${CMAKE_SOURCE_DIR}/include/miral/toolkit/persistent_id.h
320 ${CMAKE_SOURCE_DIR}/include/miral/toolkit/connection.h
321 ${CMAKE_SOURCE_DIR}/include/miral/toolkit/surface.h
322-)
323+ ../include/miral/detail/mir_forward_compatibility.h)
324
325 target_link_libraries(miral
326 PUBLIC
327@@ -71,6 +71,17 @@
328 @ONLY
329 )
330
331+if (MIRSERVER_VERSION VERSION_LESS 0.24)
332+ set(MIR_POINTER_CONFINEMENT 0)
333+else()
334+ set(MIR_POINTER_CONFINEMENT 1)
335+endif()
336+
337+configure_file(
338+ ${CMAKE_CURRENT_SOURCE_DIR}/mir_features.h.in
339+ ${PROJECT_SOURCE_DIR}/include/miral/detail/mir_features.h
340+)
341+
342 install(TARGETS miral LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")
343 install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION "${INCLUDEDIR}")
344 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miral.pc DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
345
346=== modified file 'miral/basic_window_manager.cpp'
347--- miral/basic_window_manager.cpp 2016-09-20 13:42:15 +0000
348+++ miral/basic_window_manager.cpp 2016-09-23 15:39:15 +0000
349@@ -543,6 +543,7 @@
350 COPY_IF_SET(max_aspect);
351 COPY_IF_SET(output_id);
352 COPY_IF_SET(preferred_orientation);
353+ COPY_IF_SET(confine_pointer);
354
355 #undef COPY_IF_SET
356
357@@ -641,6 +642,11 @@
358 {
359 set_state(window_info, modifications.state().value());
360 }
361+
362+#if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 24, 0)
363+ if (modifications.confine_pointer().is_set())
364+ std::shared_ptr<scene::Surface>(window)->set_confine_pointer_state(modifications.confine_pointer().value());
365+#endif
366 }
367
368 auto miral::BasicWindowManager::info_for_window_id(std::string const& id) const -> WindowInfo&
369
370=== added file 'miral/mir_features.h.in'
371--- miral/mir_features.h.in 1970-01-01 00:00:00 +0000
372+++ miral/mir_features.h.in 2016-09-23 15:39:15 +0000
373@@ -0,0 +1,28 @@
374+/*
375+ * Copyright © 2016 Canonical Ltd.
376+ *
377+ * This program is free software: you can redistribute it and/or modify it
378+ * under the terms of the GNU General Public License version 3,
379+ * as published by the Free Software Foundation.
380+ *
381+ * This program is distributed in the hope that it will be useful,
382+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
383+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
384+ * GNU General Public License for more details.
385+ *
386+ * You should have received a copy of the GNU General Public License
387+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
388+ */
389+
390+#ifndef MIRAL_MIR_FEATURES_H
391+#define MIRAL_MIR_FEATURES_H
392+
393+// ============================================================
394+// ==> miral/detail/mir_features.h is generated by cmake. <==
395+// ==> DO NOT EDIT! <==
396+// ==> (edit mir_features.h.in instead) <==
397+// ============================================================
398+
399+#define MIRAL_MIR_DEFINES_POINTER_CONFINEMENT (@MIR_POINTER_CONFINEMENT@)
400+
401+#endif // MIRAL_MIR_FEATURES_H
402
403=== modified file 'miral/symbols.map'
404--- miral/symbols.map 2016-09-14 15:55:48 +0000
405+++ miral/symbols.map 2016-09-23 15:39:15 +0000
406@@ -281,3 +281,11 @@
407 };
408 local: *;
409 };
410+
411+MIRAL_0.2 {
412+global:
413+ extern "C++" {
414+ miral::WindowInfo::confine_pointer*;
415+ miral::WindowSpecification::confine_pointer*;
416+ };
417+} MIRAL_0.1;
418
419=== modified file 'miral/window_info.cpp'
420--- miral/window_info.cpp 2016-09-16 10:25:45 +0000
421+++ miral/window_info.cpp 2016-09-23 15:39:15 +0000
422@@ -49,6 +49,7 @@
423 mir::geometry::Width max_width;
424 mir::geometry::Height max_height;
425 MirOrientationMode preferred_orientation;
426+ MirPointerConfinementState confine_pointer;
427
428 mir::geometry::DeltaX width_inc;
429 mir::geometry::DeltaY height_inc;
430@@ -69,6 +70,7 @@
431 max_width{optional_value_or_default(params.max_width(), Width{std::numeric_limits<int>::max()})},
432 max_height{optional_value_or_default(params.max_height(), Height{std::numeric_limits<int>::max()})},
433 preferred_orientation{optional_value_or_default(params.preferred_orientation(), mir_orientation_mode_any)},
434+ confine_pointer(optional_value_or_default(params.confine_pointer(), mir_pointer_unconfined)),
435 width_inc{optional_value_or_default(params.width_inc(), DeltaX{1})},
436 height_inc{optional_value_or_default(params.height_inc(), DeltaY{1})},
437 min_aspect(optional_value_or_default(params.min_aspect(), AspectRatio{0U, std::numeric_limits<unsigned>::max()})),
438@@ -537,6 +539,15 @@
439 self->preferred_orientation = preferred_orientation;
440 }
441
442+auto miral::WindowInfo::confine_pointer() const -> MirPointerConfinementState
443+{
444+ return self->confine_pointer;
445+}
446+
447+void miral::WindowInfo::confine_pointer(MirPointerConfinementState confinement)
448+{
449+ self->confine_pointer = confinement;
450+}
451
452 bool miral::WindowInfo::has_name() const
453 {
454
455=== modified file 'miral/window_management_trace.cpp'
456--- miral/window_management_trace.cpp 2016-09-22 09:47:05 +0000
457+++ miral/window_management_trace.cpp 2016-09-23 15:39:15 +0000
458@@ -108,6 +108,7 @@
459 APPEND(min_aspect);
460 APPEND(max_aspect);
461 APPEND(preferred_orientation);
462+ APPEND(confine_pointer);
463
464 #define APPEND_IF_SET(field) if (info.has_##field()) bout.append(#field, info.field());
465 APPEND_IF_SET(output_id);
466@@ -153,7 +154,7 @@
467 // APPEND_IF_SET(input_mode);
468 APPEND_IF_SET(shell_chrome);
469 APPEND_IF_SET(top_left);
470- APPEND_IF_SET(size);
471+ APPEND_IF_SET(confine_pointer);
472 #undef APPEND_IF_SET
473 }
474
475
476=== modified file 'miral/window_specification.cpp'
477--- miral/window_specification.cpp 2016-09-14 15:54:54 +0000
478+++ miral/window_specification.cpp 2016-09-23 15:39:15 +0000
479@@ -59,6 +59,7 @@
480 mir::optional_value<std::vector<Rectangle>> input_shape;
481 mir::optional_value<InputReceptionMode> input_mode;
482 mir::optional_value<MirShellChrome> shell_chrome;
483+ mir::optional_value<MirPointerConfinementState> confine_pointer;
484 };
485
486 miral::WindowSpecification::Self::Self(mir::shell::SurfaceSpecification const& spec) :
487@@ -90,6 +91,9 @@
488 input_shape(spec.input_shape),
489 input_mode(),
490 shell_chrome(spec.shell_chrome)
491+#if MIRAL_MIR_DEFINES_POINTER_CONFINEMENT
492+ ,confine_pointer(spec.confine_pointer)
493+#endif
494 {
495 #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
496 if (spec.aux_rect_placement_offset_x.is_set() && spec.aux_rect_placement_offset_y.is_set())
497@@ -236,6 +240,9 @@
498 input_shape(params.input_shape),
499 input_mode(static_cast<InputReceptionMode>(params.input_mode)),
500 shell_chrome(params.shell_chrome)
501+#if MIRAL_MIR_DEFINES_POINTER_CONFINEMENT
502+ ,confine_pointer(params.confine_pointer)
503+#endif
504 {
505 #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
506 if (params.aux_rect_placement_offset_x.is_set() && params.aux_rect_placement_offset_y.is_set())
507@@ -304,6 +311,9 @@
508 copy_if_set(params.input_shape, input_shape);
509 copy_if_set(params.input_mode, input_mode);
510 copy_if_set(params.shell_chrome, shell_chrome);
511+#if MIRAL_MIR_DEFINES_POINTER_CONFINEMENT
512+ copy_if_set(params.confine_pointer, confine_pointer);
513+#endif
514
515 #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
516 copy_if_set(params.placement_hints, placement_hints);
517@@ -472,6 +482,11 @@
518 return self->shell_chrome;
519 }
520
521+auto miral::WindowSpecification::confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&
522+{
523+ return self->confine_pointer;
524+}
525+
526 auto miral::WindowSpecification::top_left() -> mir::optional_value<Point>&
527 {
528 return self->top_left;
529@@ -591,3 +606,8 @@
530 {
531 return self->shell_chrome;
532 }
533+
534+auto miral::WindowSpecification::confine_pointer() -> mir::optional_value<MirPointerConfinementState>&
535+{
536+ return self->confine_pointer;
537+}

Subscribers

People subscribed via source and target branches