Merge lp:~gerboland/qtmir/fix-cmdline-args into lp:qtmir

Proposed by Gerry Boland on 2015-10-19
Status: Superseded
Proposed branch: lp:~gerboland/qtmir/fix-cmdline-args
Merge into: lp:qtmir
Diff against target: 502 lines (+192/-50)
19 files modified
src/modules/Unity/Application/desktopfilereader.cpp (+2/-1)
src/modules/Unity/Application/mirsurfaceitem.h (+1/-1)
src/modules/Unity/Application/objectlistmodel.h (+1/-1)
src/platforms/mirserver/argvHelper.h (+52/-0)
src/platforms/mirserver/mirserver.cpp (+24/-11)
src/platforms/mirserver/mirserver.h (+1/-1)
src/platforms/mirserver/mirserverintegration.cpp (+2/-2)
src/platforms/mirserver/mirserverintegration.h (+1/-1)
src/platforms/mirserver/plugin.cpp (+4/-8)
src/platforms/mirserver/plugin.h (+1/-2)
src/platforms/mirserver/qmirserver.cpp (+2/-11)
src/platforms/mirserver/qmirserver.h (+1/-1)
src/platforms/mirserver/qmirserver_p.h (+2/-1)
tests/mirserver/ArgvHelper/CMakeLists.txt (+18/-0)
tests/mirserver/ArgvHelper/argvHelper_test.cpp (+72/-0)
tests/mirserver/CMakeLists.txt (+1/-0)
tests/modules/common/fake_mirsurface.h (+1/-3)
tests/modules/common/qtmir_test.h (+3/-3)
tests/modules/common/stub_scene_surface.h (+3/-3)
To merge this branch: bzr merge lp:~gerboland/qtmir/fix-cmdline-args
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) 2015-10-19 Approve on 2015-10-30
PS Jenkins bot continuous-integration Needs Fixing on 2015-10-30
Review via email: mp+274954@code.launchpad.net

This proposal has been superseded by a proposal from 2015-11-17.

Commit Message

Allow Mir remove command line arguments it understands, before letting Qt process them.

To post a comment you must log in.
Daniel d'Andrada (dandrader) wrote :

Not comfortable with the "_p" suffix in "argvHelper_p.h". We're not using this naming convention anywhere in the project. And it doesn't make much sense as mirserver is not exporting any headers in the first place, so I don't see the need for that differentiation.

Daniel d'Andrada (dandrader) wrote :

> Not comfortable with the "_p" suffix in "argvHelper_p.h". We're not using this
> naming convention anywhere in the project. And it doesn't make much sense as
> mirserver is not exporting any headers in the first place, so I don't see the
> need for that differentiation.

Biting my tongue, we do use this already. :)

Daniel d'Andrada (dandrader) wrote :

Copy-and-paste issue in tests/mirserver/ArgvHelper/argvHelper_test.cpp:

"""
 * Copyright (C) 2014-2015 Canonical, Ltd.
"""

review: Needs Fixing
Daniel d'Andrada (dandrader) wrote :

"""
    const char *filteredArgv[3] = { "-fullscreen", "-testability" };
"""

For completeness it would be interesting if you added an entry that is not present in argv.

Gerry Boland (gerboland) wrote :

> """
> const char *filteredArgv[3] = { "-fullscreen", "-testability" };
> """
>
> For completeness it would be interesting if you added an entry that is not
> present in argv.

That isn't a realistic use-case for the api, but if you really want it...

Daniel d'Andrada (dandrader) wrote :

> """
> const char *filteredArgv[3] = { "-fullscreen", "-testability" };
> """
>
> For completeness it would be interesting if you added an entry that is not
> present in argv.

And if you care about having a trailing null parameter, the following would be better form:

const char *filteredArgv[] = { "-fullscreen", "-testability", nullptr };

Daniel d'Andrada (dandrader) wrote :

> > """
> > const char *filteredArgv[3] = { "-fullscreen", "-testability" };
> > """
> >
> > For completeness it would be interesting if you added an entry that is not
> > present in argv.
>
> That isn't a realistic use-case for the api, but if you really want it...

Oh, really? Then ok, ignore me.

lp:~gerboland/qtmir/fix-cmdline-args updated on 2015-10-30
394. By Gerry Boland on 2015-10-30

People do not trust C standards, so explicitly null terminate arrays

395. By Gerry Boland on 2015-10-30

Fix copyright header

396. By Gerry Boland on 2015-10-30

Remove insinuation of private header: _p

Gerry Boland (gerboland) wrote :

Review comments addressed

Daniel d'Andrada (dandrader) wrote :

"""
    if (!unknownArgsFound) { // mir parsed all the arguments, so edit argv to pretend to have just argv[0]
        argc = 1;
    }
"""

It's worth commenting that the command_line_handler never gets called in this case. I would never have guessed that. I was thinking that this was some redundant optimization before.

Daniel d'Andrada (dandrader) wrote :

> """
> if (!unknownArgsFound) { // mir parsed all the arguments, so edit argv to
> pretend to have just argv[0]
> argc = 1;
> }
> """
>
> It's worth commenting that the command_line_handler never gets called in this
> case. I would never have guessed that. I was thinking that this was some
> redundant optimization before.

Hmmm, but unknownArgsFound serves as a hint for that. Nevermind

Daniel d'Andrada (dandrader) wrote :

LGTM

review: Approve
lp:~gerboland/qtmir/fix-cmdline-args updated on 2016-02-15
397. By Gerry Boland on 2015-11-17

Merge trunk

398. By Gerry Boland on 2015-11-17

Merge lp:~unity-team/qtmir/build_with_clang to pre-empt conflicts on landing

399. By Gerry Boland on 2015-11-20

Merge trunk

400. By Gerry Boland on 2015-12-12

Merge trunk

401. By Gerry Boland on 2015-12-12

Fix test fail due to assert maths error

402. By Gerry Boland on 2016-02-15

Merge trunk

403. By Gerry Boland on 2016-02-15

Fix error in previous merge

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/desktopfilereader.cpp'
2--- src/modules/Unity/Application/desktopfilereader.cpp 2015-09-28 20:11:39 +0000
3+++ src/modules/Unity/Application/desktopfilereader.cpp 2015-11-17 14:21:31 +0000
4@@ -37,8 +37,9 @@
5
6 typedef GObjectScopedPointer<GAppInfo> GAppInfoPointer;
7
8-struct DesktopFileReaderPrivate
9+class DesktopFileReaderPrivate
10 {
11+public:
12 DesktopFileReaderPrivate(DesktopFileReader *parent):
13 q_ptr( parent )
14 {}
15
16=== modified file 'src/modules/Unity/Application/mirsurfaceitem.h'
17--- src/modules/Unity/Application/mirsurfaceitem.h 2015-10-19 15:40:27 +0000
18+++ src/modules/Unity/Application/mirsurfaceitem.h 2015-11-17 14:21:31 +0000
19@@ -103,7 +103,7 @@
20
21 void touchEvent(QTouchEvent *event) override;
22
23- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
24+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
25
26 void releaseResources() override;
27
28
29=== modified file 'src/modules/Unity/Application/objectlistmodel.h'
30--- src/modules/Unity/Application/objectlistmodel.h 2014-08-29 11:15:51 +0000
31+++ src/modules/Unity/Application/objectlistmodel.h 2015-11-17 14:21:31 +0000
32@@ -78,7 +78,7 @@
33 return QVariant();
34 }
35
36- QHash<int, QByteArray> roleNames() const
37+ QHash<int, QByteArray> roleNames() const override
38 {
39 QHash<int, QByteArray> roleNames;
40 roleNames.insert(RoleModelData, "modelData");
41
42=== added file 'src/platforms/mirserver/argvHelper.h'
43--- src/platforms/mirserver/argvHelper.h 1970-01-01 00:00:00 +0000
44+++ src/platforms/mirserver/argvHelper.h 2015-11-17 14:21:31 +0000
45@@ -0,0 +1,52 @@
46+/*
47+ * Copyright (C) 2015 Canonical, Ltd.
48+ *
49+ * This program is free software: you can redistribute it and/or modify it under
50+ * the terms of the GNU Lesser General Public License version 3, as published by
51+ * the Free Software Foundation.
52+ *
53+ * This program is distributed in the hope that it will be useful, but WITHOUT
54+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
55+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
56+ * Lesser General Public License for more details.
57+ *
58+ * You should have received a copy of the GNU Lesser General Public License
59+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
60+ */
61+
62+#ifndef ARGVHELPER_P_H
63+#define ARGVHELPER_P_H
64+
65+#include <cassert>
66+
67+namespace qtmir {
68+
69+// Function to edit argv to strip out unmatched entries of targetArray, so both arrays have identical contents
70+// Note: Mir parses out arguments that it understands, but it also removes argv[0] (bug pad.lv/1511509)
71+// so need to ensure argv[0] is the binary name as usual.
72+void editArgvToMatch(int &argcToEdit, char** argvToEdit, int targetCount, const char* const targetArray[])
73+{
74+ // Make copy of the argv array of pointers, as we will be editing the original
75+ const size_t arraySize = (argcToEdit + 1) * sizeof(char*);
76+ char** argvCopy = static_cast<char**>(malloc(arraySize));
77+ memcpy(argvCopy, argvToEdit, arraySize);
78+
79+ int k=1; // index of argv we want to edit - note we'll leave argv[0] alone
80+ for (int i=0; i<targetCount; i++) { // taking each argument Mir did not parse out
81+ for (int j=1; j<argcToEdit; j++) { // find pointer to same argument in argvCopy (leave arg[0] out)
82+ if (strcmp(targetArray[i], argvCopy[j]) == 0) {
83+ argvToEdit[k] = const_cast<char*>(argvCopy[j]); // edit argv to position that argument to match argv2.
84+ k++;
85+ break;
86+ }
87+ }
88+ }
89+ assert(k == targetCount);
90+ argvToEdit[k] = nullptr;
91+ free(argvCopy);
92+ argcToEdit = targetCount+1; // now argv and targetArray should have list the same strings.
93+}
94+
95+} // namespace qtmir
96+
97+#endif // ARGVHELPER_P_H
98
99=== modified file 'src/platforms/mirserver/mirserver.cpp'
100--- src/platforms/mirserver/mirserver.cpp 2015-10-27 10:17:45 +0000
101+++ src/platforms/mirserver/mirserver.cpp 2015-11-17 14:21:31 +0000
102@@ -19,6 +19,7 @@
103 #include "mirserver.h"
104
105 // local
106+#include "argvHelper.h"
107 #include "mirwindowmanager.h"
108 #include "mirglconfig.h"
109 #include "mirserverstatuslistener.h"
110@@ -46,22 +47,24 @@
111 namespace msh = mir::shell;
112 namespace ms = mir::scene;
113
114-namespace
115-{
116-void ignore_unparsed_arguments(int /*argc*/, char const* const/*argv*/[])
117-{
118-}
119-}
120-
121 Q_LOGGING_CATEGORY(QTMIR_MIR_MESSAGES, "qtmir.mir")
122
123-MirServer::MirServer(int argc, char const* argv[],
124+
125+MirServer::MirServer(int &argc, char **argv,
126 const QSharedPointer<ScreenController> &screenController, QObject* parent)
127 : QObject(parent)
128 , m_screenController(screenController)
129 {
130- set_command_line_handler(&ignore_unparsed_arguments);
131- set_command_line(argc, argv);
132+ bool unknownArgsFound = false;
133+ set_command_line_handler([&argc, &argv, &unknownArgsFound](int filteredCount, const char* const filteredArgv[]) {
134+ unknownArgsFound = true;
135+ // Want to edit argv to match that which Mir returns, as those are for to Qt alone to process. Edit existing
136+ // argc as filteredArgv only defined in this scope.
137+ qtmir::editArgvToMatch(argc, argv, filteredCount, filteredArgv);
138+ });
139+
140+ // Casting char** to be a const char** safe as Mir won't change it, nor will we
141+ set_command_line(argc, const_cast<const char **>(argv));
142
143 override_the_session_listener([]
144 {
145@@ -121,7 +124,16 @@
146 screenController->init(the_display(), the_compositor());
147 });
148
149- apply_settings();
150+ try {
151+ apply_settings();
152+ } catch (const std::exception &ex) {
153+ qCritical() << ex.what();
154+ exit(1);
155+ }
156+
157+ if (!unknownArgsFound) { // mir parsed all the arguments, so edit argv to pretend to have just argv[0]
158+ argc = 1;
159+ }
160
161 // We will draw our own cursor.
162 // FIXME: Call override_the_cusor() instead once this method becomes available in a
163@@ -133,6 +145,7 @@
164 });
165
166 qCDebug(QTMIR_MIR_MESSAGES) << "MirServer created";
167+ qCDebug(QTMIR_MIR_MESSAGES) << "Command line arguments passed to Qt:" << QCoreApplication::arguments();
168 }
169
170 // Override default implementation to ensure we terminate the ScreenController first.
171
172=== modified file 'src/platforms/mirserver/mirserver.h'
173--- src/platforms/mirserver/mirserver.h 2015-08-20 10:16:54 +0000
174+++ src/platforms/mirserver/mirserver.h 2015-11-17 14:21:31 +0000
175@@ -40,7 +40,7 @@
176 Q_PROPERTY(PromptSessionListener* promptSessionListener READ promptSessionListener CONSTANT)
177
178 public:
179- MirServer(int argc, char const* argv[], const QSharedPointer<ScreenController> &, QObject* parent = 0);
180+ MirServer(int &argc, char **argv, const QSharedPointer<ScreenController> &, QObject* parent = 0);
181 ~MirServer() = default;
182
183 /* mir specific */
184
185=== modified file 'src/platforms/mirserver/mirserverintegration.cpp'
186--- src/platforms/mirserver/mirserverintegration.cpp 2015-10-21 11:46:33 +0000
187+++ src/platforms/mirserver/mirserverintegration.cpp 2015-11-17 14:21:31 +0000
188@@ -51,11 +51,11 @@
189 namespace mg = mir::graphics;
190 using qtmir::Clipboard;
191
192-MirServerIntegration::MirServerIntegration()
193+MirServerIntegration::MirServerIntegration(int &argc, char **argv)
194 : m_accessibility(new QPlatformAccessibility())
195 , m_fontDb(new QGenericUnixFontDatabase())
196 , m_services(new Services)
197- , m_mirServer(new QMirServer(QCoreApplication::arguments()))
198+ , m_mirServer(new QMirServer(argc, argv))
199 , m_nativeInterface(nullptr)
200 , m_clipboard(new Clipboard)
201 {
202
203=== modified file 'src/platforms/mirserver/mirserverintegration.h'
204--- src/platforms/mirserver/mirserverintegration.h 2015-08-20 10:16:54 +0000
205+++ src/platforms/mirserver/mirserverintegration.h 2015-11-17 14:21:31 +0000
206@@ -31,7 +31,7 @@
207 class MirServerIntegration : public QPlatformIntegration
208 {
209 public:
210- MirServerIntegration();
211+ MirServerIntegration(int &argc, char **argv);
212 ~MirServerIntegration();
213
214 bool hasCapability(QPlatformIntegration::Capability cap) const override;
215
216=== modified file 'src/platforms/mirserver/plugin.cpp'
217--- src/platforms/mirserver/plugin.cpp 2015-08-11 12:08:32 +0000
218+++ src/platforms/mirserver/plugin.cpp 2015-11-17 14:21:31 +0000
219@@ -17,14 +17,10 @@
220 #include "plugin.h"
221 #include "mirserverintegration.h"
222
223-QStringList MirServerIntegrationPlugin::keys() const {
224- QStringList list;
225- list << "mirserver";
226- return list;
227-}
228-
229-QPlatformIntegration* MirServerIntegrationPlugin::create(const QString &system, const QStringList &) {
230+QPlatformIntegration *MirServerIntegrationPlugin::create(const QString &system, const QStringList &/*paramList*/,
231+ int &argc, char **argv)
232+{
233 if (system.toLower() == "mirserver")
234- return new MirServerIntegration;
235+ return new MirServerIntegration(argc, argv);
236 return 0;
237 }
238
239=== modified file 'src/platforms/mirserver/plugin.h'
240--- src/platforms/mirserver/plugin.h 2015-08-11 12:08:32 +0000
241+++ src/platforms/mirserver/plugin.h 2015-11-17 14:21:31 +0000
242@@ -25,8 +25,7 @@
243 Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "mirserver.json")
244
245 public:
246- QStringList keys() const;
247- QPlatformIntegration* create(const QString&, const QStringList&);
248+ QPlatformIntegration *create(const QString &system, const QStringList &paramList, int &argc, char **argv) override;
249 };
250
251 #endif // PLUGIN_H
252
253=== modified file 'src/platforms/mirserver/qmirserver.cpp'
254--- src/platforms/mirserver/qmirserver.cpp 2015-08-20 10:16:54 +0000
255+++ src/platforms/mirserver/qmirserver.cpp 2015-11-17 14:21:31 +0000
256@@ -26,24 +26,15 @@
257 #include "screencontroller.h"
258 #include "screen.h"
259
260-QMirServer::QMirServer(const QStringList &arguments, QObject *parent)
261+QMirServer::QMirServer(int &argc, char **argv, QObject *parent)
262 : QObject(parent)
263 , d_ptr(new QMirServerPrivate())
264 {
265 Q_D(QMirServer);
266
267- // convert arguments back into argc-argv form that Mir wants
268- int argc = arguments.size();
269- char **argv = new char*[argc + 1];
270- for (int i = 0; i < argc; i++) {
271- argv[i] = new char[strlen(arguments.at(i).toStdString().c_str())+1];
272- memcpy(argv[i], arguments.at(i).toStdString().c_str(), strlen(arguments.at(i).toStdString().c_str())+1);
273- }
274- argv[argc] = '\0';
275-
276 d->screenController = QSharedPointer<ScreenController>(new ScreenController());
277
278- d->server = QSharedPointer<MirServer>(new MirServer(argc, const_cast<const char**>(argv), d->screenController));
279+ d->server = QSharedPointer<MirServer>(new MirServer(argc, argv, d->screenController));
280
281 d->serverThread = new MirServerThread(d->server);
282
283
284=== modified file 'src/platforms/mirserver/qmirserver.h'
285--- src/platforms/mirserver/qmirserver.h 2015-08-20 10:16:54 +0000
286+++ src/platforms/mirserver/qmirserver.h 2015-11-17 14:21:31 +0000
287@@ -30,7 +30,7 @@
288 Q_OBJECT
289
290 public:
291- QMirServer(const QStringList &arguments, QObject* parent=0);
292+ QMirServer(int &argc, char **argv, QObject* parent=0);
293 virtual ~QMirServer();
294
295 bool start();
296
297=== modified file 'src/platforms/mirserver/qmirserver_p.h'
298--- src/platforms/mirserver/qmirserver_p.h 2015-08-20 10:16:54 +0000
299+++ src/platforms/mirserver/qmirserver_p.h 2015-11-17 14:21:31 +0000
300@@ -32,8 +32,9 @@
301 class QMirServer;
302 class MirServerThread;
303
304-struct QMirServerPrivate
305+class QMirServerPrivate
306 {
307+public:
308 QSharedPointer<MirServer> server;
309 QSharedPointer<ScreenController> screenController;
310 MirServerThread *serverThread;
311
312=== added directory 'tests/mirserver/ArgvHelper'
313=== added file 'tests/mirserver/ArgvHelper/CMakeLists.txt'
314--- tests/mirserver/ArgvHelper/CMakeLists.txt 1970-01-01 00:00:00 +0000
315+++ tests/mirserver/ArgvHelper/CMakeLists.txt 2015-11-17 14:21:31 +0000
316@@ -0,0 +1,18 @@
317+set(
318+ ARGVHELPER_TEST_SOURCES
319+ argvHelper_test.cpp
320+)
321+
322+add_executable(ArgvHelperTest ${ARGVHELPER_TEST_SOURCES})
323+
324+include_directories(
325+ ${CMAKE_SOURCE_DIR}/src/platforms/mirserver
326+)
327+
328+target_link_libraries(
329+ ArgvHelperTest
330+
331+ ${GTEST_BOTH_LIBRARIES}
332+)
333+
334+add_test(ArgvHelper, ArgvHelperTest)
335
336=== added file 'tests/mirserver/ArgvHelper/argvHelper_test.cpp'
337--- tests/mirserver/ArgvHelper/argvHelper_test.cpp 1970-01-01 00:00:00 +0000
338+++ tests/mirserver/ArgvHelper/argvHelper_test.cpp 2015-11-17 14:21:31 +0000
339@@ -0,0 +1,72 @@
340+/*
341+ * Copyright (C) 2015 Canonical, Ltd.
342+ *
343+ * This program is free software: you can redistribute it and/or modify it under
344+ * the terms of the GNU Lesser General Public License version 3, as published by
345+ * the Free Software Foundation.
346+ *
347+ * This program is distributed in the hope that it will be useful, but WITHOUT
348+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
349+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
350+ * Lesser General Public License for more details.
351+ *
352+ * You should have received a copy of the GNU Lesser General Public License
353+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
354+ */
355+
356+#include <gtest/gtest.h>
357+
358+#include <argvHelper.h>
359+
360+using namespace qtmir;
361+
362+TEST(ArgvHelperTest, StripsCorrectly)
363+{
364+ int argc = 5;
365+ const char *argv[6] = { "/usr/bin/unity8", "-fullscreen", "--debug",
366+ "--platform-input-lib=/path/to/lib.so", "-testability", nullptr };
367+
368+ const int filteredArgc = 2;
369+ const char *filteredArgv[3] = { "-fullscreen", "-testability", nullptr };
370+
371+ editArgvToMatch(argc, const_cast<char**>(argv), filteredArgc, filteredArgv);
372+
373+ EXPECT_EQ(argc, 3);
374+ EXPECT_EQ(argv[0], "/usr/bin/unity8");
375+ EXPECT_EQ(argv[1], "-fullscreen");
376+ EXPECT_EQ(argv[2], "-testability");
377+ EXPECT_EQ(argv[3], nullptr);
378+}
379+
380+TEST(ArgvHelperTest, NothingToStrip)
381+{
382+ int argc = 4;
383+ const char *argv[5] = { "/usr/bin/unity8", "-fullscreen", "--multisample", "-testability", nullptr };
384+
385+ const int filteredArgc = 3;
386+ const char *filteredArgv[4] = { "-fullscreen", "-testability", "--multisample", nullptr };
387+
388+ editArgvToMatch(argc, const_cast<char**>(argv), filteredArgc, filteredArgv);
389+
390+ EXPECT_EQ(argc, 4);
391+ EXPECT_EQ(argv[0], "/usr/bin/unity8");
392+ EXPECT_EQ(argv[1], "-fullscreen");
393+ EXPECT_EQ(argv[2], "-testability");
394+ EXPECT_EQ(argv[3], "--multisample");
395+ EXPECT_EQ(argv[4], nullptr);
396+}
397+
398+TEST(ArgvHelperTest, NothingToDo)
399+{
400+ int argc = 1;
401+ const char *argv[2] = { "/usr/bin/unity8", nullptr };
402+
403+ const int filteredArgc = 0;
404+ const char *filteredArgv[1] = { nullptr };
405+
406+ editArgvToMatch(argc, const_cast<char**>(argv), filteredArgc, filteredArgv);
407+
408+ EXPECT_EQ(argc, 1);
409+ EXPECT_EQ(argv[0], "/usr/bin/unity8");
410+ EXPECT_EQ(argv[1], nullptr);
411+}
412
413=== modified file 'tests/mirserver/CMakeLists.txt'
414--- tests/mirserver/CMakeLists.txt 2015-10-27 10:17:45 +0000
415+++ tests/mirserver/CMakeLists.txt 2015-11-17 14:21:31 +0000
416@@ -1,3 +1,4 @@
417+add_subdirectory(ArgvHelper)
418 add_subdirectory(QtEventFeeder)
419 add_subdirectory(Clipboard)
420 add_subdirectory(Screen)
421
422=== modified file 'tests/modules/common/fake_mirsurface.h'
423--- tests/modules/common/fake_mirsurface.h 2015-10-26 18:29:24 +0000
424+++ tests/modules/common/fake_mirsurface.h 2015-11-17 14:21:31 +0000
425@@ -52,7 +52,6 @@
426 FakeMirSurface(QObject *parent = nullptr)
427 : MirSurfaceInterface(parent)
428 , m_isFirstFrameDrawn(false)
429- , m_session(nullptr)
430 , m_isFrameDropperRunning(true)
431 , m_live(true)
432 , m_state(Mir::RestoredState)
433@@ -65,7 +64,7 @@
434 // unity.shell.application.MirSurfaceInterface
435 Mir::Type type() const override { return Mir::NormalType; }
436
437- QString name() const { return QString("Fake MirSurface"); }
438+ QString name() const override { return QString("Fake MirSurface"); }
439
440 QSize size() const override { return m_size; }
441
442@@ -211,7 +210,6 @@
443
444
445 bool m_isFirstFrameDrawn;
446- SessionInterface *m_session;
447 bool m_isFrameDropperRunning;
448 bool m_live;
449 Mir::State m_state;
450
451=== modified file 'tests/modules/common/qtmir_test.h'
452--- tests/modules/common/qtmir_test.h 2015-08-20 10:16:54 +0000
453+++ tests/modules/common/qtmir_test.h 2015-11-17 14:21:31 +0000
454@@ -51,7 +51,7 @@
455 void PrintTo(const SessionInterface::State& state, ::std::ostream* os);
456
457 // Initialization of mir::Server needed for by tests
458-class TestMirServerInit : virtual mir::Server
459+class TestMirServerInit : public virtual mir::Server
460 {
461 public:
462 TestMirServerInit()
463@@ -72,13 +72,13 @@
464 };
465
466
467-namespace { char const* argv[] = { nullptr }; }
468+namespace { int argc = 0; char* argv[] = { nullptr }; }
469
470 class FakeMirServer: private TestMirServerInit, public MirServer
471 {
472 public:
473 FakeMirServer()
474- : MirServer(0, argv, QSharedPointer<ScreenController>())
475+ : MirServer(argc, argv, QSharedPointer<ScreenController>())
476 {
477 }
478
479
480=== modified file 'tests/modules/common/stub_scene_surface.h'
481--- tests/modules/common/stub_scene_surface.h 2015-08-11 12:08:32 +0000
482+++ tests/modules/common/stub_scene_surface.h 2015-11-17 14:21:31 +0000
483@@ -72,7 +72,7 @@
484 void resize(geometry::Size const&) override {}
485 void set_transformation(glm::mat4 const&) override {}
486 void set_alpha(float) override {}
487- void set_orientation(MirOrientation) {}
488+ void set_orientation(MirOrientation) override {}
489
490 void add_observer(std::shared_ptr<scene::SurfaceObserver> const&) override {}
491 void remove_observer(std::weak_ptr<scene::SurfaceObserver> const&) override {}
492@@ -80,8 +80,8 @@
493 void set_reception_mode(input::InputReceptionMode mode) override { input_mode = mode; }
494 void consume(MirEvent const&) override {}
495
496- void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& /* image */) {}
497- std::shared_ptr<graphics::CursorImage> cursor_image() const { return {}; }
498+ void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& /* image */) override {}
499+ std::shared_ptr<graphics::CursorImage> cursor_image() const override { return {}; }
500
501 bool supports_input() const override { return true;}
502 int client_input_fd() const override { return fd;}

Subscribers

People subscribed via source and target branches