Mir

Merge lp:~vanvugt/mir/retain-set-type into lp:mir

Proposed by Daniel van Vugt
Status: Work in progress
Proposed branch: lp:~vanvugt/mir/retain-set-type
Merge into: lp:mir
Diff against target: 163 lines (+35/-24)
4 files modified
include/client/mir_toolkit/mir_surface.h (+6/-2)
src/utils/ping.c (+4/-4)
tests/acceptance-tests/test_client_library.cpp (+7/-4)
tests/acceptance-tests/throwback/test_shell_control_of_surface_configuration.cpp (+18/-14)
To merge this branch: bzr merge lp:~vanvugt/mir/retain-set-type
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+249915@code.launchpad.net

Commit message

Undeprecate mir_surface_set_type until such time as we have some other
function that can replace it.

For windowed XMir we're going to need it. In X, windows don't have types
for some indefinite period after their creation. Optionally at some point,
some toolkits might tell us the type via _NET_WM_WINDOW_TYPE but
pure/old X apps won't bother to declare a type at all.

So to support the case where an X window does decide to give itself a type
later (usually while it's unmapped/hidden) we need mir_surface_set_type.
Or something else that doesn't exist yet.

Description of the change

This is just a revert of r2245.

To post a comment you must log in.
lp:~vanvugt/mir/retain-set-type updated
2324. By Daniel van Vugt

test_client_library.cpp: Fix weird type/state mixup (which apparently was
a preexisting problem).

Unmerged revisions

2324. By Daniel van Vugt

test_client_library.cpp: Fix weird type/state mixup (which apparently was
a preexisting problem).

2323. By Daniel van Vugt

Undeprecate mir_surface_set_type until such time as we have some other
function that can replace it.

For windowed XMir we're going to need it. In X, windows don't have types
for some indefinite period after their creation. Optionally at some point,
some toolkits might tell us the type via _NET_WM_WINDOW_TYPE but
pure/old X apps won't bother to declare a type at all.

So to support the case where an X window does decide to give itself a type
later (usually while it's unmapped/hidden) we need mir_surface_set_type.
Or something else that doesn't exist yet.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/client/mir_toolkit/mir_surface.h'
2--- include/client/mir_toolkit/mir_surface.h 2015-02-12 02:11:25 +0000
3+++ include/client/mir_toolkit/mir_surface.h 2015-02-17 05:00:50 +0000
4@@ -449,9 +449,13 @@
5 int mir_surface_get_id(MirSurface *surface);
6
7 /**
8- * \deprecated Use the mir_connection_create_spec_for_xxx family of APIs
9+ * Set the type (purpose) of a surface. This is not guaranteed to always work
10+ * with some shell types (e.g. phone/tablet UIs). As such, you may have to
11+ * wait on the function and check the result using mir_surface_get_type.
12+ * \param [in] surface The surface to operate on
13+ * \param [in] type The new type of the surface
14+ * \return A wait handle that can be passed to mir_wait_for
15 */
16-__attribute__((__deprecated__("Use mir_connection_create_spec_for_xxx()")))
17 MirWaitHandle* mir_surface_set_type(MirSurface *surface, MirSurfaceType type);
18
19 /**
20
21=== modified file 'src/utils/ping.c'
22--- src/utils/ping.c 2015-01-22 09:00:14 +0000
23+++ src/utils/ping.c 2015-02-17 05:00:50 +0000
24@@ -103,10 +103,10 @@
25 signal(SIGTERM, shutdown);
26 signal(SIGHUP, shutdown);
27
28- static const MirOrientationMode types[2] =
29+ static const MirSurfaceType types[2] =
30 {
31- mir_orientation_mode_portrait_any,
32- mir_orientation_mode_landscape_any
33+ mir_surface_type_normal,
34+ mir_surface_type_utility
35 };
36 int t = 1;
37
38@@ -116,7 +116,7 @@
39 long long start, duration;
40
41 start = now();
42- mir_wait_for(mir_surface_set_preferred_orientation(surf, types[t]));
43+ mir_wait_for(mir_surface_set_type(surf, types[t]));
44 duration = now() - start;
45 t ^= 1;
46
47
48=== modified file 'tests/acceptance-tests/test_client_library.cpp'
49--- tests/acceptance-tests/test_client_library.cpp 2015-02-12 02:11:25 +0000
50+++ tests/acceptance-tests/test_client_library.cpp 2015-02-17 05:00:50 +0000
51@@ -135,10 +135,16 @@
52 {
53 mir_wait_for_one(mir_surface_set_state(surf,
54 mir_surface_state_maximized));
55+ mir_wait_for_one(mir_surface_set_type(surf,
56+ mir_surface_type_normal));
57 mir_wait_for_one(mir_surface_set_state(surf,
58 mir_surface_state_restored));
59+ mir_wait_for_one(mir_surface_set_type(surf,
60+ mir_surface_type_utility));
61 mir_wait_for_one(mir_surface_set_state(surf,
62 mir_surface_state_fullscreen));
63+ mir_wait_for_one(mir_surface_set_type(surf,
64+ mir_surface_type_dialog));
65 mir_wait_for_one(mir_surface_set_state(surf,
66 mir_surface_state_minimized));
67 }
68@@ -201,9 +207,6 @@
69 mir_connection_release(connection);
70 }
71
72-#pragma GCC diagnostic push
73-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
74-
75 TEST_F(ClientLibrary, can_set_surface_types)
76 {
77 mir_wait_for(mir_connect(new_connection().c_str(), __PRETTY_FUNCTION__, connection_callback, this));
78@@ -248,7 +251,6 @@
79 mir_wait_for(mir_surface_release(surface, release_surface_callback, this));
80 mir_connection_release(connection);
81 }
82-#pragma GCC diagnostic pop
83
84 TEST_F(ClientLibrary, can_set_surface_state)
85 {
86@@ -540,6 +542,7 @@
87 b.join();
88 c.join();
89
90+ EXPECT_THAT(mir_surface_get_type(surface), Eq(mir_surface_type_dialog));
91 EXPECT_THAT(mir_surface_get_state(surface), Eq(mir_surface_state_minimized));
92
93 mir_surface_release_sync(surface);
94
95=== modified file 'tests/acceptance-tests/throwback/test_shell_control_of_surface_configuration.cpp'
96--- tests/acceptance-tests/throwback/test_shell_control_of_surface_configuration.cpp 2015-01-22 09:00:14 +0000
97+++ tests/acceptance-tests/throwback/test_shell_control_of_surface_configuration.cpp 2015-02-17 05:00:50 +0000
98@@ -74,14 +74,14 @@
99 {
100 using namespace ::testing;
101
102- EXPECT_CALL(mock_configurator, select_attribute_value(_, Ne(mir_surface_attrib_state), _))
103+ EXPECT_CALL(mock_configurator, select_attribute_value(_, Ne(mir_surface_attrib_type), _))
104 .Times(AnyNumber())
105 .WillRepeatedly(ReturnArg<2>());
106- EXPECT_CALL(mock_configurator, attribute_set(_, Ne(mir_surface_attrib_state), _)).Times(AnyNumber());
107+ EXPECT_CALL(mock_configurator, attribute_set(_, Ne(mir_surface_attrib_type), _)).Times(AnyNumber());
108
109- ON_CALL(mock_configurator, select_attribute_value(_, _, _)).WillByDefault(Return(mir_surface_state_maximized));
110- EXPECT_CALL(mock_configurator, select_attribute_value(_, mir_surface_attrib_state, Eq(mir_surface_state_maximized))).Times(1);
111- EXPECT_CALL(mock_configurator, attribute_set(_, mir_surface_attrib_state, Eq(mir_surface_state_maximized))).Times(1);
112+ ON_CALL(mock_configurator, select_attribute_value(_, _, _)).WillByDefault(Return(mir_surface_type_freestyle));
113+ EXPECT_CALL(mock_configurator, select_attribute_value(_, mir_surface_attrib_type, Eq(mir_surface_type_freestyle))).Times(1);
114+ EXPECT_CALL(mock_configurator, attribute_set(_, mir_surface_attrib_type, Eq(mir_surface_type_freestyle))).Times(1);
115 }
116
117 mtd::MockSurfaceConfigurator mock_configurator;
118@@ -93,8 +93,10 @@
119 void exec() override
120 {
121 SurfaceCreatingClient::exec();
122- mir_wait_for(mir_surface_set_state(surface, mir_surface_state_maximized));
123- EXPECT_EQ(mir_surface_state_maximized, mir_surface_get_state(surface));
124+ mir_wait_for(mir_surface_set_type(surface,
125+ mir_surface_type_freestyle));
126+ EXPECT_EQ(mir_surface_type_freestyle,
127+ mir_surface_get_type(surface));
128 }
129 } client_config;
130 launch_client_process(client_config);
131@@ -112,14 +114,14 @@
132 {
133 using namespace ::testing;
134
135- EXPECT_CALL(mock_configurator, select_attribute_value(_, Ne(mir_surface_attrib_state), _))
136+ EXPECT_CALL(mock_configurator, select_attribute_value(_, Ne(mir_surface_attrib_type), _))
137 .Times(AnyNumber())
138 .WillRepeatedly(ReturnArg<2>());
139- EXPECT_CALL(mock_configurator, attribute_set(_, Ne(mir_surface_attrib_state), _)).Times(AnyNumber());
140+ EXPECT_CALL(mock_configurator, attribute_set(_, Ne(mir_surface_attrib_type), _)).Times(AnyNumber());
141
142- EXPECT_CALL(mock_configurator, select_attribute_value(_, mir_surface_attrib_state, Eq(mir_surface_state_maximized))).Times(1)
143- .WillOnce(Return(mir_surface_state_maximized));
144- EXPECT_CALL(mock_configurator, attribute_set(_, mir_surface_attrib_state, Eq(mir_surface_state_maximized))).Times(1);
145+ EXPECT_CALL(mock_configurator, select_attribute_value(_, mir_surface_attrib_type, Eq(mir_surface_type_freestyle))).Times(1)
146+ .WillOnce(Return(mir_surface_type_normal));
147+ EXPECT_CALL(mock_configurator, attribute_set(_, mir_surface_attrib_type, Eq(mir_surface_type_normal))).Times(1);
148 }
149 mtd::MockSurfaceConfigurator mock_configurator;
150 } server_config;
151@@ -130,8 +132,10 @@
152 void exec() override
153 {
154 SurfaceCreatingClient::exec();
155- mir_wait_for(mir_surface_set_state(surface, mir_surface_state_maximized));
156- EXPECT_EQ(mir_surface_state_maximized, mir_surface_get_state(surface));
157+ mir_wait_for(mir_surface_set_type(surface,
158+ mir_surface_type_freestyle));
159+ EXPECT_EQ(mir_surface_type_normal,
160+ mir_surface_get_type(surface));
161 }
162 } client_config;
163 launch_client_process(client_config);

Subscribers

People subscribed via source and target branches