Merge lp:~dandrader/miral/confine_pointer into lp:miral

Proposed by Daniel d'Andrada
Status: Superseded
Proposed branch: lp:~dandrader/miral/confine_pointer
Merge into: lp:miral
Diff against target: 163 lines (+68/-0)
5 files modified
include/miral/window_specification.h (+8/-0)
miral/CMakeLists.txt (+11/-0)
miral/mir_features.h.in (+22/-0)
miral/symbols.map (+1/-0)
miral/window_specification.cpp (+26/-0)
To merge this branch: bzr merge lp:~dandrader/miral/confine_pointer
Reviewer Review Type Date Requested Status
Alan Griffiths Needs Fixing
Review via email: mp+306381@code.launchpad.net

This proposal has been superseded by a proposal from 2016-09-23.

Commit message

Add miral::WindowSpecification::confine_pointer

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

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
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

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?

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> 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()

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> > 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()

lp:~dandrader/miral/confine_pointer updated
356. By Daniel d'Andrada

Make it build in xenial

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

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.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

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

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'include/miral/detail'
2=== modified file 'include/miral/window_specification.h'
3--- include/miral/window_specification.h 2016-09-14 15:54:54 +0000
4+++ include/miral/window_specification.h 2016-09-22 16:21:09 +0000
5@@ -29,6 +29,8 @@
6
7 #include <memory>
8
9+#include "miral/detail/mir_features.h"
10+
11 // TODO this wants to move to Mir's toolkit API
12 #if MIR_CLIENT_VERSION < MIR_VERSION_NUMBER(3, 4, 0)
13
14@@ -193,6 +195,9 @@
15 auto input_shape() const -> mir::optional_value<std::vector<Rectangle>> const&;
16 auto input_mode() const -> mir::optional_value<InputReceptionMode> const&;
17 auto shell_chrome() const -> mir::optional_value<MirShellChrome> const&;
18+#if MIRAL_MIR_POINTER_CONFINEMENT
19+ auto confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&;
20+#endif
21
22 auto top_left() -> mir::optional_value<Point>&;
23 auto size() -> mir::optional_value<Size>&;
24@@ -218,6 +223,9 @@
25 auto input_shape() -> mir::optional_value<std::vector<Rectangle>>&;
26 auto input_mode() -> mir::optional_value<InputReceptionMode>&;
27 auto shell_chrome() -> mir::optional_value<MirShellChrome>&;
28+#if MIRAL_MIR_POINTER_CONFINEMENT
29+ auto confine_pointer() -> mir::optional_value<MirPointerConfinementState>&;
30+#endif
31
32 private:
33 struct Self;
34
35=== modified file 'miral/CMakeLists.txt'
36--- miral/CMakeLists.txt 2016-09-21 16:49:48 +0000
37+++ miral/CMakeLists.txt 2016-09-22 16:21:09 +0000
38@@ -71,6 +71,17 @@
39 @ONLY
40 )
41
42+if (MIRSERVER_VERSION VERSION_LESS 0.24)
43+ set(MIR_POINTER_CONFINEMENT 0)
44+else()
45+ set(MIR_POINTER_CONFINEMENT 1)
46+endif()
47+
48+configure_file(
49+ ${CMAKE_CURRENT_SOURCE_DIR}/mir_features.h.in
50+ ${PROJECT_SOURCE_DIR}/include/miral/detail/mir_features.h
51+)
52+
53 install(TARGETS miral LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")
54 install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION "${INCLUDEDIR}")
55 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miral.pc DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
56
57=== added file 'miral/mir_features.h.in'
58--- miral/mir_features.h.in 1970-01-01 00:00:00 +0000
59+++ miral/mir_features.h.in 2016-09-22 16:21:09 +0000
60@@ -0,0 +1,22 @@
61+/*
62+ * Copyright © 2016 Canonical Ltd.
63+ *
64+ * This program is free software: you can redistribute it and/or modify it
65+ * under the terms of the GNU General Public License version 3,
66+ * as published by the Free Software Foundation.
67+ *
68+ * This program is distributed in the hope that it will be useful,
69+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
70+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71+ * GNU General Public License for more details.
72+ *
73+ * You should have received a copy of the GNU General Public License
74+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
75+ */
76+
77+#ifndef MIRAL_MIR_FEATURES_H
78+#define MIRAL_MIR_FEATURES_H
79+
80+#define MIRAL_MIR_POINTER_CONFINEMENT (@MIR_POINTER_CONFINEMENT@)
81+
82+#endif // MIRAL_MIR_FEATURES_H
83
84=== modified file 'miral/symbols.map'
85--- miral/symbols.map 2016-09-14 15:55:48 +0000
86+++ miral/symbols.map 2016-09-22 16:21:09 +0000
87@@ -182,6 +182,7 @@
88 miral::WindowSpecification::placement_hints*;
89 miral::WindowSpecification::preferred_orientation*;
90 miral::WindowSpecification::shell_chrome*;
91+ miral::WindowSpecification::confine_pointer*;
92 miral::WindowSpecification::size*;
93 miral::WindowSpecification::state*;
94 miral::WindowSpecification::top_left*;
95
96=== modified file 'miral/window_specification.cpp'
97--- miral/window_specification.cpp 2016-09-14 15:54:54 +0000
98+++ miral/window_specification.cpp 2016-09-22 16:21:09 +0000
99@@ -59,6 +59,9 @@
100 mir::optional_value<std::vector<Rectangle>> input_shape;
101 mir::optional_value<InputReceptionMode> input_mode;
102 mir::optional_value<MirShellChrome> shell_chrome;
103+#if MIRAL_MIR_POINTER_CONFINEMENT
104+ mir::optional_value<MirPointerConfinementState> confine_pointer;
105+#endif
106 };
107
108 miral::WindowSpecification::Self::Self(mir::shell::SurfaceSpecification const& spec) :
109@@ -90,6 +93,9 @@
110 input_shape(spec.input_shape),
111 input_mode(),
112 shell_chrome(spec.shell_chrome)
113+#if MIRAL_MIR_POINTER_CONFINEMENT
114+ ,confine_pointer(spec.confine_pointer)
115+#endif
116 {
117 #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
118 if (spec.aux_rect_placement_offset_x.is_set() && spec.aux_rect_placement_offset_y.is_set())
119@@ -236,6 +242,9 @@
120 input_shape(params.input_shape),
121 input_mode(static_cast<InputReceptionMode>(params.input_mode)),
122 shell_chrome(params.shell_chrome)
123+#if MIRAL_MIR_POINTER_CONFINEMENT
124+ ,confine_pointer(params.confine_pointer)
125+#endif
126 {
127 #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
128 if (params.aux_rect_placement_offset_x.is_set() && params.aux_rect_placement_offset_y.is_set())
129@@ -304,6 +313,9 @@
130 copy_if_set(params.input_shape, input_shape);
131 copy_if_set(params.input_mode, input_mode);
132 copy_if_set(params.shell_chrome, shell_chrome);
133+#if MIRAL_MIR_POINTER_CONFINEMENT
134+ copy_if_set(params.confine_pointer, confine_pointer);
135+#endif
136
137 #if MIR_SERVER_VERSION >= MIR_VERSION_NUMBER(0, 25, 0)
138 copy_if_set(params.placement_hints, placement_hints);
139@@ -472,6 +484,13 @@
140 return self->shell_chrome;
141 }
142
143+#if MIRAL_MIR_POINTER_CONFINEMENT
144+auto miral::WindowSpecification::confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&
145+{
146+ return self->confine_pointer;
147+}
148+#endif
149+
150 auto miral::WindowSpecification::top_left() -> mir::optional_value<Point>&
151 {
152 return self->top_left;
153@@ -591,3 +610,10 @@
154 {
155 return self->shell_chrome;
156 }
157+
158+#if MIRAL_MIR_POINTER_CONFINEMENT
159+auto miral::WindowSpecification::confine_pointer() -> mir::optional_value<MirPointerConfinementState>&
160+{
161+ return self->confine_pointer;
162+}
163+#endif

Subscribers

People subscribed via source and target branches