Merge lp:~alan-griffiths/mir/fix-1603922 into lp:mir
- fix-1603922
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alan Griffiths |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3604 |
Proposed branch: | lp:~alan-griffiths/mir/fix-1603922 |
Merge into: | lp:mir |
Diff against target: |
192 lines (+91/-9) 6 files modified
examples/tooltip.c (+2/-2) include/client/mir_toolkit/mir_surface.h (+38/-2) src/client/mir_surface_api.cpp (+18/-0) src/client/symbols.map (+6/-0) tests/acceptance-tests/test_client_surfaces.cpp (+22/-0) tests/integration-tests/client/test_mirsurface.cpp (+5/-5) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/fix-1603922 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Alan Griffiths | Abstain | ||
Kevin DuBois (community) | Approve | ||
Daniel van Vugt | Abstain | ||
Cemil Azizoglu (community) | Approve | ||
Review via email: mp+300304@code.launchpad.net |
Commit message
Deprecate useless mir_connection_
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
It's regrettable that the new function name is hard to understand, because the old good name is already taken.
Can we think of a better name? mir_connection_
Daniel van Vugt (vanvugt) wrote : | # |
mir_connection_
mir_connection_
Daniel van Vugt (vanvugt) : | # |
Alan Griffiths (alan-griffiths) wrote : | # |
> It's regrettable that the new function name is hard to understand, because the
> old good name is already taken.
>
> Can we think of a better name? mir_connection_
1. the corresponding surface type is: mir_surface_
2. From the (internal) discussion that led to this MP:
On 17/07/16 13:17, Matthew Paul Thomas wrote:
> Maybe that would be a good time to start calling the type “tip”, to
> avoid the impression that it’s just for tooltips.
Gerry Boland (gerboland) wrote : | # |
"tip" is what we're calling this surface type in the Mir surface spec. Makes sense to use that terminology IMO.
Kevin DuBois (kdub) wrote : | # |
seems the naming discussion has a lot more context behind it, but my 2cents is that tooltip and tip are synonyms. (abstain on that point)
small needs fixing
+ int width,
+ int height,
we should check that its a positive number. (or use unsigned int and check that its not 0x0)
Alan Griffiths (alan-griffiths) wrote : | # |
> small needs fixing
> + int width,
> + int height,
> we should check that its a positive number. (or use unsigned int and check
> that its not 0x0)
Curiously, we don't do that for mir_connection_
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
LGTM (modulo the width/height being positive).
Daniel van Vugt (vanvugt) wrote : | # |
I know our design docs use the word 'tip' but that doesn't make it ideal. I'm aiming for something that existing toolkit developers will understand. They will grep for 'tooltip' and never find it.
Remember the Mir API should be a superset of the Unity design in order to support other shells and existing desktop concepts that are omitted from the Unity design.
We should not be betting on Unity8 being the winning shell. Because if it doesn't get sufficient traction and Mir is not more flexible than the Unity design, then Mir too will suffer as a platform that can't support other shells.
Daniel van Vugt (vanvugt) wrote : | # |
OK, too much tangential explanation. But you understand my concerns I hope. Abstain so we can make progress.
Alan Griffiths (alan-griffiths) wrote : | # |
> > small needs fixing
> > + int width,
> > + int height,
> > we should check that its a positive number. (or use unsigned int and check
> > that its not 0x0)
>
> Curiously, we don't do that for mir_connection_
We don't check this for *any* of the existing mir_connection_
1. consider it a precondition violation and:
1.1 check and abort() or
1.2 don't check as its the caller's responsibility.
2. make the "contract" wide and return an error object
As things stand the window manager isn't constrained by the requested and does something sensible with it.
Note also that these attributes of the spec can be updated before calling the server.
Alan Griffiths (alan-griffiths) wrote : | # |
Should I rebase on lp:~alan-griffiths/mir/add-mir_surface_spec_attach and use MirPlacement?
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3598
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
re checking for 0x0, its just a concern that the user will hit #1597717-like bugs (where we can get stuck in surface creation. We should be doing this for all surfaces. Here seems like a good place to start, although if we want to fix all the surface creation stuff at once, I don't mind a followup MP.
rewriting to 0x0 to be 1x1 seems like the solution we've been using in the past, although 2) from the menu of options seems like the right way.
Alan Griffiths (alan-griffiths) wrote : | # |
Personally I'm happy with the existing approach: it's a precondition & we don't need to check.
Agreed, the server should withstand such values if they are ever sent (in a way that applies to all surfaces). I *think* I've seen code that handles this for all surface types, but am not sure where it is.
Maybe a test is in order that goes through all the surface create functions with bad sizes?
If, hypothetically, we adopt your suggestion and client updates a valid spec with mir_surface_
Kevin DuBois (kdub) wrote : | # |
filed LP: #1604874, so no need to fix in this MP
Alan Griffiths (alan-griffiths) wrote : | # |
> Should I rebase on lp:~alan-griffiths/mir/add-mir_surface_spec_attach and use
> MirPlacement?
I'll withdraw the question as we can handle this API along with other placement functions
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
Daniel van Vugt (vanvugt) wrote : | # |
Network problems but also a few of these (?!):
17:06:09 /home/phablet/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Alan Griffiths (alan-griffiths) wrote : | # |
Unrelated failure...
05:14:50 /home/phablet/
05:14:50 I: [FAILED] mir_demo_
...but worrying
Mir CI Bot (mir-ci-bot) : | # |
Preview Diff
1 | === modified file 'examples/tooltip.c' |
2 | --- examples/tooltip.c 2015-06-17 05:20:42 +0000 |
3 | +++ examples/tooltip.c 2016-07-20 10:29:25 +0000 |
4 | @@ -102,8 +102,8 @@ |
5 | MirRectangle zone = { 0, 0, 10, 10 }; |
6 | int const width = 50; |
7 | int const height = 20; |
8 | - MirSurfaceSpec* const spec = mir_connection_create_spec_for_tooltip( |
9 | - connection, width, height, format, parent, &zone); |
10 | + MirSurfaceSpec* const spec = mir_connection_create_spec_for_tip( |
11 | + connection, width, height, format, parent, &zone, mir_edge_attachment_vertical); |
12 | |
13 | mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software); |
14 | mir_surface_spec_set_name(spec, "tooltip"); |
15 | |
16 | === modified file 'include/client/mir_toolkit/mir_surface.h' |
17 | --- include/client/mir_toolkit/mir_surface.h 2016-06-09 00:38:26 +0000 |
18 | +++ include/client/mir_toolkit/mir_surface.h 2016-07-20 10:29:25 +0000 |
19 | @@ -103,9 +103,10 @@ |
20 | * return a surface of this height. |
21 | * \param [in] format Pixel format for the surface. |
22 | * \param [in] parent A valid parent surface for this tooltip. |
23 | - * \param [in] rect A target zone relative to parent. |
24 | + * \param [in] zone A target zone relative to parent. |
25 | * \return A handle that can be passed to mir_surface_create() |
26 | * to complete construction. |
27 | + *\deprecated use mir_connection_create_spec_for_tip() instead |
28 | */ |
29 | MirSurfaceSpec* |
30 | mir_connection_create_spec_for_tooltip(MirConnection* connection, |
31 | @@ -113,7 +114,42 @@ |
32 | int height, |
33 | MirPixelFormat format, |
34 | MirSurface* parent, |
35 | - MirRectangle* zone); |
36 | + MirRectangle* zone) |
37 | + __attribute__((deprecated)); |
38 | + |
39 | +/** |
40 | + * Create a surface specification for a tip surface. |
41 | + * |
42 | + * Positioning of the surface is specified with respect to the parent surface |
43 | + * via an adjacency rectangle. The server will attempt to choose an edge of the |
44 | + * adjacency rectangle on which to place the surface taking in to account |
45 | + * screen-edge proximity or similar constraints. In addition, the server can use |
46 | + * the edge affinity hint to consider only horizontal or only vertical adjacency |
47 | + * edges in the given rectangle. |
48 | + * |
49 | + * \param [in] connection Connection the surface will be created on |
50 | + * \param [in] width Requested width. The server is not guaranteed to |
51 | + * return a surface of this width. |
52 | + * \param [in] height Requested height. The server is not guaranteed to |
53 | + * return a surface of this height. |
54 | + * \param [in] format Pixel format for the surface. |
55 | + * \param [in] parent A valid parent surface for this tip. |
56 | + * \param [in] rect The adjacency rectangle. The server is not |
57 | + * guaranteed to create a surface at the requested |
58 | + * location. |
59 | + * \param [in] edge The preferred edge direction to attach to. Use |
60 | + * mir_edge_attachment_any for no preference. |
61 | + * \return A handle that can be passed to mir_surface_create() |
62 | + * to complete construction. |
63 | + */ |
64 | +MirSurfaceSpec* |
65 | +mir_connection_create_spec_for_tip(MirConnection* connection, |
66 | + int width, |
67 | + int height, |
68 | + MirPixelFormat format, |
69 | + MirSurface* parent, |
70 | + MirRectangle* rect, |
71 | + MirEdgeAttachment edge); |
72 | |
73 | /** |
74 | * Create a surface specification for a modal dialog surface. |
75 | |
76 | === modified file 'src/client/mir_surface_api.cpp' |
77 | --- src/client/mir_surface_api.cpp 2016-06-08 13:49:11 +0000 |
78 | +++ src/client/mir_surface_api.cpp 2016-07-20 10:29:25 +0000 |
79 | @@ -88,7 +88,25 @@ |
80 | auto spec = new MirSurfaceSpec{connection, width, height, format}; |
81 | spec->type = mir_surface_type_tip; |
82 | spec->parent = parent; |
83 | + return spec; |
84 | +} |
85 | + |
86 | +MirSurfaceSpec* mir_connection_create_spec_for_tip(MirConnection* connection, |
87 | + int width, |
88 | + int height, |
89 | + MirPixelFormat format, |
90 | + MirSurface* parent, |
91 | + MirRectangle* rect, |
92 | + MirEdgeAttachment edge) |
93 | +{ |
94 | + mir::require(mir_surface_is_valid(parent)); |
95 | + mir::require(rect != nullptr); |
96 | + |
97 | + auto spec = new MirSurfaceSpec{connection, width, height, format}; |
98 | + spec->type = mir_surface_type_tip; |
99 | + spec->parent = parent; |
100 | spec->aux_rect = *rect; |
101 | + spec->edge_attachment = edge; |
102 | return spec; |
103 | } |
104 | |
105 | |
106 | === modified file 'src/client/symbols.map' |
107 | --- src/client/symbols.map 2016-07-07 09:54:02 +0000 |
108 | +++ src/client/symbols.map 2016-07-20 10:29:25 +0000 |
109 | @@ -415,3 +415,9 @@ |
110 | mir_input_device_state_event_device_pointer_buttons; |
111 | mir_surface_spec_set_pointer_confinement; |
112 | } MIR_CLIENT_0.22; |
113 | + |
114 | +MIR_CLIENT_0.25 { # New functions in Mir 0.25 |
115 | + global: |
116 | + mir_connection_create_spec_for_tip; |
117 | +} MIR_CLIENT_0.24; |
118 | + |
119 | |
120 | === modified file 'tests/acceptance-tests/test_client_surfaces.cpp' |
121 | --- tests/acceptance-tests/test_client_surfaces.cpp 2016-05-03 06:55:25 +0000 |
122 | +++ tests/acceptance-tests/test_client_surfaces.cpp 2016-07-20 10:29:25 +0000 |
123 | @@ -244,6 +244,8 @@ |
124 | mir_surface_release_sync(menu); |
125 | } |
126 | |
127 | +#pragma GCC diagnostic push |
128 | +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
129 | TEST_F(ClientSurfaces, can_be_tooltips) |
130 | { |
131 | auto parent = mtf::make_any_surface(connection); |
132 | @@ -262,6 +264,26 @@ |
133 | mir_surface_release_sync(parent); |
134 | mir_surface_release_sync(tooltip); |
135 | } |
136 | +#pragma GCC diagnostic pop |
137 | + |
138 | +TEST_F(ClientSurfaces, can_be_tips) |
139 | +{ |
140 | + auto parent = mtf::make_any_surface(connection); |
141 | + MirRectangle rect{100, 200, 100, 100}; |
142 | + |
143 | + auto spec = mir_connection_create_spec_for_tip(connection, 640, 480, |
144 | + mir_pixel_format_abgr_8888, parent, &rect, mir_edge_attachment_any); |
145 | + ASSERT_THAT(spec, NotNull()); |
146 | + |
147 | + auto tooltip = mir_surface_create_sync(spec); |
148 | + mir_surface_spec_release(spec); |
149 | + |
150 | + ASSERT_THAT(tooltip, IsValid()); |
151 | + EXPECT_EQ(mir_surface_get_type(tooltip), mir_surface_type_tip); |
152 | + |
153 | + mir_surface_release_sync(parent); |
154 | + mir_surface_release_sync(tooltip); |
155 | +} |
156 | |
157 | TEST_F(ClientSurfaces, can_be_dialogs) |
158 | { |
159 | |
160 | === modified file 'tests/integration-tests/client/test_mirsurface.cpp' |
161 | --- tests/integration-tests/client/test_mirsurface.cpp 2016-01-29 08:18:22 +0000 |
162 | +++ tests/integration-tests/client/test_mirsurface.cpp 2016-07-20 10:29:25 +0000 |
163 | @@ -196,25 +196,25 @@ |
164 | create_surface(menu_spec.get()); |
165 | } |
166 | |
167 | -TEST_F(ClientMirSurface, as_tooltip_sends_correct_params) |
168 | +TEST_F(ClientMirSurface, as_tip_sends_correct_params) |
169 | { |
170 | EXPECT_CALL(*mock_shell, create_surface(_,_,_)); |
171 | auto parent = create_surface(&spec); |
172 | ASSERT_THAT(parent.get(), IsValid()); |
173 | |
174 | - MirRectangle target_zone_rect{100, 200, 300, 400}; |
175 | + MirRectangle placement_hint{100, 200, 300, 400}; |
176 | |
177 | auto spec_deleter = [](MirSurfaceSpec* spec) {mir_surface_spec_release(spec);}; |
178 | std::unique_ptr<MirSurfaceSpec, decltype(spec_deleter)> tooltip_spec{ |
179 | - mir_connection_create_spec_for_tooltip(connection, 640, 480, |
180 | - mir_pixel_format_abgr_8888, parent.get(), &target_zone_rect), |
181 | + mir_connection_create_spec_for_tip(connection, 640, 480, |
182 | + mir_pixel_format_abgr_8888, parent.get(), &placement_hint, mir_edge_attachment_vertical), |
183 | spec_deleter |
184 | }; |
185 | |
186 | ASSERT_THAT(tooltip_spec, NotNull()); |
187 | |
188 | EXPECT_CALL(*mock_shell, create_surface(_, AllOf(IsATooltip(), |
189 | - HasParent(parent.get()), MatchesAuxRect(target_zone_rect)),_)); |
190 | + HasParent(parent.get()), MatchesAuxRect(placement_hint)),_)); |
191 | create_surface(tooltip_spec.get()); |
192 | } |
193 |
PASSED: Continuous integration, rev:3597 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1305/ /mir-jenkins. ubuntu. com/job/ build-mir/ 1531 /mir-jenkins. ubuntu. com/job/ build-0- fetch/1584 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1575 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1575 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 1575 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1546 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1546/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1546 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1546/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1546 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1546/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1546 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1546/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1546 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1546/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1305/rebuild
https:/