Merge lp:~gerboland/qtubuntu/enable-debug-mode into lp:qtubuntu

Proposed by Gerry Boland on 2015-10-30
Status: Superseded
Proposed branch: lp:~gerboland/qtubuntu/enable-debug-mode
Merge into: lp:qtubuntu
Prerequisite: lp:~albaguirre/qtubuntu/use-mir-surface-apis
Diff against target: 562 lines (+167/-56)
14 files modified
debian/control (+1/-0)
src/ubuntumirclient/debugextension.cpp (+55/-0)
src/ubuntumirclient/debugextension.h (+39/-0)
src/ubuntumirclient/input.cpp (+17/-22)
src/ubuntumirclient/integration.cpp (+14/-2)
src/ubuntumirclient/integration.h (+4/-1)
src/ubuntumirclient/logging.h (+1/-0)
src/ubuntumirclient/plugin.cpp (+5/-11)
src/ubuntumirclient/plugin.h (+2/-3)
src/ubuntumirclient/screen.cpp (+1/-6)
src/ubuntumirclient/screenobserver.cpp (+1/-1)
src/ubuntumirclient/ubuntumirclient.pro (+2/-0)
src/ubuntumirclient/window.cpp (+21/-9)
src/ubuntumirclient/window.h (+4/-1)
To merge this branch: bzr merge lp:~gerboland/qtubuntu/enable-debug-mode
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve on 2016-09-22
Daniel d'Andrada (community) Needs Information on 2016-09-22
Michael Terry Abstain on 2016-08-10
Nick Dedekind (community) 2015-10-30 Needs Information on 2016-01-26
PS Jenkins bot continuous-integration Approve on 2015-10-30
Review via email: mp+276293@code.launchpad.net

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

Commit message

Use mir-client-debug to map window coordinates to screen coordinates

If client detects testability framework was enabled, try to load the mir-client-debug library and use it to implement UbuntuWindow::mapToGlobal. This should enable Autopilot to correctly interact with the application.

Description of the change

Use mir-client-debug to map window coordinates to screen coordinates when under testability

To work with unity8 it needs https://code.launchpad.net/~dandrader/qtmir/coordinateTranslator/+merge/291768

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

Note: this requires work on unity8's side before it is functional. But it works with mir-demo-server.

Also note, mir only supports this mir-client-debug extension if the mir server is started with the --debug argument.

This will be a problem for application autopilot testing, as it will require unity8 to be restarted with the --debug flag now.

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Gerry Boland (gerboland) wrote :

To test, handiest is to apply this patch: http://pastebin.ubuntu.com/13011095/ and then do:

mir_demo_shell --debug

and start any qt app with "-testability" flag.

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:283
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-1-ci/5/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-1-ci/5/rebuild

review: Needs Fixing (continuous-integration)
Nick Dedekind (nick-dedekind) wrote :

Does this mean we can remove UbuntuWindow::updatePanelHeightHack and all the geom.setY(panelHeight()) ?

review: Needs Information
Nick Dedekind (nick-dedekind) wrote :

And how about QPlatformWindow::mapFromGlobal for kicks?

Gerry Boland (gerboland) wrote :

Yep, it lets us remove the panelHeight hack. Could also implement mapFromGlobal too, but I didn't see a use-case

Nick Dedekind (nick-dedekind) wrote :

rebase please :)

Nick Dedekind (nick-dedekind) wrote :

Afraid this will not work unless we get https://bugreports.qt.io/browse/QTBUG-51031 sorted.

Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Daniel d'Andrada (dandrader) wrote :

> Afraid this will not work unless we get
> https://bugreports.qt.io/browse/QTBUG-51031 sorted.

It will work as long as application code calls "window->handle()->mapToGlobal()" instead of "window->mapToGlobal()".

Daniel d'Andrada (dandrader) wrote :

It has a bunch of conflicts with trunk. Solved them here: lp:~dandrader/qtubuntu/enable-debug-mode
Feel free to branch it, squash its history and push it here with --overwrite.

This branch, along with lp:~dandrader/qtmir/coordinateTranslator, should be all autopilot folks need for mapping local points to screen points (regardless of any translations, rotations and scalings done by unity8 to the application surface)

review: Needs Fixing
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:287
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/35/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1331
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1302
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1302
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1300
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1300/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1300
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1300/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1300
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1300/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1300
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1300/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1300
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1300/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1300
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1300/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/35/rebuild

review: Approve (continuous-integration)
Daniel d'Andrada (dandrader) wrote :

It works.

review: Approve
Michael Terry (mterry) wrote :

This conflicts with trunk now. :(

review: Needs Fixing
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Daniel d'Andrada (dandrader) wrote :

Lot's of conflicts with trunk:

"""
Text conflict in src/ubuntumirclient/integration.cpp
Text conflict in src/ubuntumirclient/integration.h
Text conflict in src/ubuntumirclient/window.cpp
Text conflict in src/ubuntumirclient/window.h
4 conflicts encountered.
"""

review: Needs Fixing
288. By Gerry Boland on 2016-06-24

Merge trunk & fix conflicts

289. By Gerry Boland on 2016-06-24

Fix up some bad merge decisions, and bump copyrights

290. By Gerry Boland on 2016-08-10

Merged trunk

Gerry Boland (gerboland) wrote :

I pushed to the actual right branch this time!

Michael Terry (mterry) wrote :

OK, conflicts fixed.

review: Abstain
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:290
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/102/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/2528/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2556
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2437
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2437
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2437
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2430/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2430/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/102/rebuild

review: Needs Fixing (continuous-integration)
291. By Gerry Boland on 2016-08-10

Fix FTBFS, pass debug extension to Window

Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:291
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/103/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2530
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2558
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2439
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2439
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2439
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2432/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2432
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2432/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/103/rebuild

review: Approve (continuous-integration)
Daniel d'Andrada (dandrader) wrote :

"""
+ qDebug() << "NOTICE: Loading mirclient-debug-extension";
"""

Do we want to keep that? If so, better categorize it so that people know where does it come from when seeing it in the console

review: Needs Information
Gerry Boland (gerboland) wrote :

Updated

Daniel d'Andrada (dandrader) wrote :

Those changes in src/ubuntumirclient/input.cpp seem unrelated. Missing prereq?

review: Needs Information
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:293
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/118/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2941
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2969
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2827/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2827
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2827/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/118/rebuild

review: Approve (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:294
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/119/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2945
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2973
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2831/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2831
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2831/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/119/rebuild

review: Approve (continuous-integration)
292. By Gerry Boland on 2016-09-22

Merge trunk

293. By Gerry Boland on 2016-09-22

Use category logging for debug extension warnings

294. By Gerry Boland on 2016-09-22

Use dedicated logging category for debug-related messages

295. By Gerry Boland on 2016-10-04

Merge trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-08-24 12:40:30 +0000
3+++ debian/control 2016-09-22 15:36:58 +0000
4@@ -11,6 +11,7 @@
5 libglib2.0-dev,
6 libinput-dev,
7 libmirclient-dev (>= 0.13.0),
8+ libmirclient-debug-extension-dev,
9 libmtdev-dev,
10 libubuntu-application-api-dev (>= 2.9.0),
11 libudev-dev,
12
13=== added file 'src/ubuntumirclient/debugextension.cpp'
14--- src/ubuntumirclient/debugextension.cpp 1970-01-01 00:00:00 +0000
15+++ src/ubuntumirclient/debugextension.cpp 2016-09-22 15:36:58 +0000
16@@ -0,0 +1,55 @@
17+/*
18+ * Copyright (C) 2016 Canonical, Ltd.
19+ *
20+ * This program is free software: you can redistribute it and/or modify it under
21+ * the terms of the GNU Lesser General Public License version 3, as published by
22+ * the Free Software Foundation.
23+ *
24+ * This program is distributed in the hope that it will be useful, but WITHOUT
25+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
26+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27+ * Lesser General Public License for more details.
28+ *
29+ * You should have received a copy of the GNU Lesser General Public License
30+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31+ */
32+
33+#include "debugextension.h"
34+
35+#include "logging.h"
36+
37+// mir client debug
38+#include <mir_toolkit/debug/surface.h>
39+
40+Q_LOGGING_CATEGORY(ubuntumirclientDebug, "ubuntumirclient.debug")
41+
42+UbuntuDebugExtension::UbuntuDebugExtension()
43+ : m_mirclientDebug(QStringLiteral("mirclient-debug-extension"), 1)
44+ , m_mapper(nullptr)
45+{
46+ qCDebug(ubuntumirclientDebug) << "NOTICE: Loading mirclient-debug-extension";
47+ m_mapper = (MapperPrototype) m_mirclientDebug.resolve("mir_debug_surface_coords_to_screen");
48+
49+ if (!m_mirclientDebug.isLoaded()) {
50+ qCWarning(ubuntumirclientDebug) << "ERROR: mirclient-debug-extension failed to load:"
51+ << m_mirclientDebug.errorString();
52+ } else if (!m_mapper) {
53+ qCWarning(ubuntumirclientDebug) << "ERROR: unable to find required symbols in mirclient-debug-extension:"
54+ << m_mirclientDebug.errorString();
55+ }
56+}
57+
58+QPoint UbuntuDebugExtension::mapSurfacePointToScreen(MirSurface *surface, const QPoint &point)
59+{
60+ if (!m_mapper) {
61+ return point;
62+ }
63+
64+ QPoint mappedPoint;
65+ bool status = m_mapper(surface, point.x(), point.y(), &mappedPoint.rx(), &mappedPoint.ry());
66+ if (status) {
67+ return mappedPoint;
68+ } else {
69+ return point;
70+ }
71+}
72
73=== added file 'src/ubuntumirclient/debugextension.h'
74--- src/ubuntumirclient/debugextension.h 1970-01-01 00:00:00 +0000
75+++ src/ubuntumirclient/debugextension.h 2016-09-22 15:36:58 +0000
76@@ -0,0 +1,39 @@
77+/*
78+ * Copyright (C) 2016 Canonical, Ltd.
79+ *
80+ * This program is free software: you can redistribute it and/or modify it under
81+ * the terms of the GNU Lesser General Public License version 3, as published by
82+ * the Free Software Foundation.
83+ *
84+ * This program is distributed in the hope that it will be useful, but WITHOUT
85+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
86+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87+ * Lesser General Public License for more details.
88+ *
89+ * You should have received a copy of the GNU Lesser General Public License
90+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
91+ */
92+
93+#ifndef UBUNTU_DEBUG_EXTENSION_H
94+#define UBUNTU_DEBUG_EXTENSION_H
95+
96+#include <QPoint>
97+#include <QLibrary>
98+struct MirSurface;
99+
100+typedef bool (*MapperPrototype)(MirSurface* surface, int x, int y, int* screenX, int* screenY);
101+
102+
103+class UbuntuDebugExtension
104+{
105+public:
106+ UbuntuDebugExtension();
107+
108+ QPoint mapSurfacePointToScreen(MirSurface *, const QPoint &point);
109+
110+private:
111+ QLibrary m_mirclientDebug;
112+ MapperPrototype m_mapper;
113+};
114+
115+#endif // UBUNTU_DEBUG_EXTENSION_H
116
117=== modified file 'src/ubuntumirclient/input.cpp'
118--- src/ubuntumirclient/input.cpp 2016-08-24 12:40:30 +0000
119+++ src/ubuntumirclient/input.cpp 2016-09-22 15:36:58 +0000
120@@ -209,26 +209,31 @@
121 switch (t)
122 {
123 case mir_event_type_key:
124- return "mir_event_type_key";
125+ return "key";
126 case mir_event_type_motion:
127- return "mir_event_type_motion";
128+ return "motion";
129 case mir_event_type_surface:
130- return "mir_event_type_surface";
131+ return "surface";
132 case mir_event_type_resize:
133- return "mir_event_type_resize";
134+ return "resize";
135 case mir_event_type_prompt_session_state_change:
136- return "mir_event_type_prompt_session_state_change";
137+ return "prompt_session_state_change";
138 case mir_event_type_orientation:
139- return "mir_event_type_orientation";
140+ return "orientation";
141 case mir_event_type_close_surface:
142- return "mir_event_type_close_surface";
143+ return "close_surface";
144 case mir_event_type_input:
145- return "mir_event_type_input";
146+ return "input";
147+ case mir_event_type_keymap:
148+ return "keymap";
149+ case mir_event_type_input_configuration:
150+ return "input_configuration";
151 case mir_event_type_surface_output:
152- return "mir_event_type_surface_output";
153- default:
154- return "invalid";
155+ return "surface_output";
156+ case mir_event_type_input_device_state:
157+ return "input_device_state";
158 }
159+ Q_UNREACHABLE();
160 }
161
162 void UbuntuInput::customEvent(QEvent* event)
163@@ -334,8 +339,6 @@
164 case mir_input_event_type_pointer:
165 dispatchPointerEvent(window, ev);
166 break;
167- default:
168- break;
169 }
170 }
171
172@@ -377,7 +380,6 @@
173 touchPoint.state = Qt::TouchPointReleased;
174 break;
175 case mir_touch_action_change:
176- default:
177 touchPoint.state = Qt::TouchPointMoved;
178 }
179
180@@ -537,8 +539,6 @@
181 case mir_pointer_action_leave:
182 QWindowSystemInterface::handleLeaveEvent(window);
183 break;
184- default:
185- qCDebug(ubuntumirclient, "Unrecognized pointer event");
186 }
187 }
188
189@@ -547,19 +547,14 @@
190 switch (orientation) {
191 case mir_orientation_normal:
192 return "Normal";
193- break;
194 case mir_orientation_left:
195 return "Left";
196- break;
197 case mir_orientation_inverted:
198 return "Inverted";
199- break;
200 case mir_orientation_right:
201 return "Right";
202- break;
203- default:
204- return "INVALID!";
205 }
206+ Q_UNREACHABLE();
207 }
208
209 void UbuntuInput::dispatchOrientationEvent(QWindow *window, const MirOrientationEvent *event)
210
211=== modified file 'src/ubuntumirclient/integration.cpp'
212--- src/ubuntumirclient/integration.cpp 2016-08-24 12:40:30 +0000
213+++ src/ubuntumirclient/integration.cpp 2016-09-22 15:36:58 +0000
214@@ -18,6 +18,7 @@
215 #include "integration.h"
216 #include "backingstore.h"
217 #include "clipboard.h"
218+#include "debugextension.h"
219 #include "glcontext.h"
220 #include "input.h"
221 #include "logging.h"
222@@ -69,7 +70,7 @@
223 QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended);
224 }
225
226-UbuntuClientIntegration::UbuntuClientIntegration()
227+UbuntuClientIntegration::UbuntuClientIntegration(int argc, char **argv)
228 : QPlatformIntegration()
229 , mNativeInterface(new UbuntuNativeInterface(this))
230 , mFontDb(new QGenericUnixFontDatabase)
231@@ -104,6 +105,17 @@
232 mEglNativeDisplay = mir_connection_get_egl_native_display(mMirConnection);
233 ASSERT((mEglDisplay = eglGetDisplay(mEglNativeDisplay)) != EGL_NO_DISPLAY);
234 ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE);
235+
236+ // Has debug mode been requsted, either with "-testability" switch or QT_LOAD_TESTABILITY env var
237+ bool testability = qEnvironmentVariableIsSet("QT_LOAD_TESTABILITY");
238+ for (int i=1; !testability && i<argc; i++) {
239+ if (strcmp(argv[i], "-testability") == 0) {
240+ testability = true;
241+ }
242+ }
243+ if (testability) {
244+ mDebugExtension.reset(new UbuntuDebugExtension);
245+ }
246 }
247
248 void UbuntuClientIntegration::initialize()
249@@ -210,7 +222,7 @@
250
251 QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const
252 {
253- return new UbuntuWindow(window, mInput, mNativeInterface, mEglDisplay, mMirConnection);
254+ return new UbuntuWindow(window, mInput, mNativeInterface, mEglDisplay, mMirConnection, mDebugExtension.data());
255 }
256
257 bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
258
259=== modified file 'src/ubuntumirclient/integration.h'
260--- src/ubuntumirclient/integration.h 2016-08-24 12:40:30 +0000
261+++ src/ubuntumirclient/integration.h 2016-09-22 15:36:58 +0000
262@@ -29,6 +29,7 @@
263
264 #include <EGL/egl.h>
265
266+class UbuntuDebugExtension;
267 class UbuntuInput;
268 class UbuntuNativeInterface;
269 class UbuntuScreen;
270@@ -39,7 +40,7 @@
271 Q_OBJECT
272
273 public:
274- UbuntuClientIntegration();
275+ UbuntuClientIntegration(int argc, char **argv);
276 virtual ~UbuntuClientIntegration();
277
278 // QPlatformIntegration methods.
279@@ -64,6 +65,7 @@
280 EGLDisplay eglDisplay() const { return mEglDisplay; }
281 EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; }
282 UbuntuScreenObserver *screenObserver() const { return mScreenObserver.data(); }
283+ UbuntuDebugExtension *debugExtension() const { return mDebugExtension.data(); }
284
285 private Q_SLOTS:
286 void destroyScreen(UbuntuScreen *screen);
287@@ -81,6 +83,7 @@
288
289 UbuntuInput* mInput;
290 QPlatformInputContext* mInputContext;
291+ QScopedPointer<UbuntuDebugExtension> mDebugExtension;
292 QScopedPointer<UbuntuScreenObserver> mScreenObserver;
293 qreal mScaleFactor;
294
295
296=== modified file 'src/ubuntumirclient/logging.h'
297--- src/ubuntumirclient/logging.h 2016-06-22 17:16:33 +0000
298+++ src/ubuntumirclient/logging.h 2016-09-22 15:36:58 +0000
299@@ -26,5 +26,6 @@
300 Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientInput)
301 Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientGraphics)
302 Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientCursor)
303+Q_DECLARE_LOGGING_CATEGORY(ubuntumirclientDebug)
304
305 #endif // QUBUNTULOGGING_H
306
307=== modified file 'src/ubuntumirclient/plugin.cpp'
308--- src/ubuntumirclient/plugin.cpp 2015-12-04 16:19:33 +0000
309+++ src/ubuntumirclient/plugin.cpp 2016-09-22 15:36:58 +0000
310@@ -1,5 +1,5 @@
311 /*
312- * Copyright (C) 2014 Canonical, Ltd.
313+ * Copyright (C) 2014-2016 Canonical, Ltd.
314 *
315 * This program is free software: you can redistribute it and/or modify it under
316 * the terms of the GNU Lesser General Public License version 3, as published by
317@@ -20,15 +20,9 @@
318
319 Q_LOGGING_CATEGORY(ubuntumirclient, "ubuntumirclient", QtWarningMsg)
320
321-QStringList UbuntuMirClientIntegrationPlugin::keys() const
322-{
323- QStringList list;
324- list << QStringLiteral("ubuntumirclient");
325- return list;
326-}
327-
328-QPlatformIntegration* UbuntuMirClientIntegrationPlugin::create(const QString &system,
329- const QStringList &)
330+QPlatformIntegration *UbuntuMirClientIntegrationPlugin::create(const QString &system,
331+ const QStringList &/*paramList*/,
332+ int &argc, char **argv)
333 {
334 if (system.toLower() == QLatin1String("ubuntumirclient")) {
335 #ifdef PLATFORM_API_TOUCH
336@@ -36,7 +30,7 @@
337 #else
338 setenv("UBUNTU_PLATFORM_API_BACKEND", "desktop_mirclient", 1);
339 #endif
340- return new UbuntuClientIntegration;
341+ return new UbuntuClientIntegration(argc, argv);
342 } else {
343 return 0;
344 }
345
346=== modified file 'src/ubuntumirclient/plugin.h'
347--- src/ubuntumirclient/plugin.h 2014-06-18 23:10:00 +0000
348+++ src/ubuntumirclient/plugin.h 2016-09-22 15:36:58 +0000
349@@ -1,5 +1,5 @@
350 /*
351- * Copyright (C) 2014 Canonical, Ltd.
352+ * Copyright (C) 2014-2016 Canonical, Ltd.
353 *
354 * This program is free software: you can redistribute it and/or modify it under
355 * the terms of the GNU Lesser General Public License version 3, as published by
356@@ -25,8 +25,7 @@
357 Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "ubuntumirclient.json")
358
359 public:
360- QStringList keys() const;
361- QPlatformIntegration* create(const QString&, const QStringList&);
362+ QPlatformIntegration *create(const QString &system, const QStringList &paramList, int &argc, char **argv) override;
363 };
364
365 #endif // UBUNTU_CLIENT_PLUGIN_H
366
367=== modified file 'src/ubuntumirclient/screen.cpp'
368--- src/ubuntumirclient/screen.cpp 2016-04-28 14:09:54 +0000
369+++ src/ubuntumirclient/screen.cpp 2016-09-22 15:36:58 +0000
370@@ -46,9 +46,8 @@
371 return "inverted portrait";
372 case Qt::InvertedLandscapeOrientation:
373 return "inverted landscape";
374- default:
375- return "INVALID!";
376 }
377+ Q_UNREACHABLE();
378 }
379
380 const QEvent::Type OrientationChangeEvent::mType =
381@@ -97,10 +96,6 @@
382 Qt::InvertedLandscapeOrientation : Qt::InvertedPortraitOrientation;
383 break;
384 }
385- default: {
386- qCDebug(ubuntumirclient, "UbuntuScreen::customEvent - Unknown orientation.");
387- return;
388- }
389 }
390
391 // Raise the event signal so that client apps know the orientation changed
392
393=== modified file 'src/ubuntumirclient/screenobserver.cpp'
394--- src/ubuntumirclient/screenobserver.cpp 2016-04-28 14:09:54 +0000
395+++ src/ubuntumirclient/screenobserver.cpp 2016-09-22 15:36:58 +0000
396@@ -47,7 +47,7 @@
397 case mir_form_factor_tv: return "tv";
398 case mir_form_factor_projector: return "projector";
399 }
400- return "";
401+ Q_UNREACHABLE();
402 }
403 } // anonymous namespace
404
405
406=== modified file 'src/ubuntumirclient/ubuntumirclient.pro'
407--- src/ubuntumirclient/ubuntumirclient.pro 2016-08-24 12:40:30 +0000
408+++ src/ubuntumirclient/ubuntumirclient.pro 2016-09-22 15:36:58 +0000
409@@ -18,6 +18,7 @@
410 backingstore.cpp \
411 clipboard.cpp \
412 cursor.cpp \
413+ debugextension.cpp \
414 glcontext.cpp \
415 input.cpp \
416 integration.cpp \
417@@ -34,6 +35,7 @@
418 backingstore.h \
419 clipboard.h \
420 cursor.h \
421+ debugextension.h \
422 glcontext.h \
423 input.h \
424 integration.h \
425
426=== modified file 'src/ubuntumirclient/window.cpp'
427--- src/ubuntumirclient/window.cpp 2016-08-31 01:51:15 +0000
428+++ src/ubuntumirclient/window.cpp 2016-09-22 15:36:58 +0000
429@@ -16,8 +16,11 @@
430
431 // Local
432 #include "window.h"
433+//#include "clipboard.h"
434+#include "debugextension.h"
435 #include "nativeinterface.h"
436 #include "input.h"
437+#include "integration.h"
438 #include "screen.h"
439 #include "logging.h"
440
441@@ -81,9 +84,8 @@
442 return "Minimized";
443 case Qt::WindowActive:
444 return "Active";
445- default:
446- return "!?";
447 }
448+ Q_UNREACHABLE();
449 }
450
451 const char *mirSurfaceStateToStr(MirSurfaceState surfaceState)
452@@ -97,8 +99,9 @@
453 case mir_surface_state_fullscreen: return "fullscreen";
454 case mir_surface_state_horizmaximized: return "horizmaximized";
455 case mir_surface_state_hidden: return "hidden";
456- default: return "!?";
457+ case mir_surface_states: Q_UNREACHABLE();
458 }
459+ Q_UNREACHABLE();
460 }
461
462 const char *mirPixelFormatToStr(MirPixelFormat pixelFormat)
463@@ -114,15 +117,16 @@
464 case mir_pixel_format_rgb_565: return "RGB565";
465 case mir_pixel_format_rgba_5551: return "RGBA5551";
466 case mir_pixel_format_rgba_4444: return "RGBA4444";
467- case mir_pixel_formats:
468- default: return "???";
469+ case mir_pixel_formats: Q_UNREACHABLE();
470 }
471+ Q_UNREACHABLE();
472 }
473
474 MirSurfaceState qtWindowStateToMirSurfaceState(Qt::WindowState state)
475 {
476 switch (state) {
477 case Qt::WindowNoState:
478+ case Qt::WindowActive:
479 return mir_surface_state_restored;
480 case Qt::WindowFullScreen:
481 return mir_surface_state_fullscreen;
482@@ -130,10 +134,8 @@
483 return mir_surface_state_maximized;
484 case Qt::WindowMinimized:
485 return mir_surface_state_minimized;
486- default:
487- qCWarning(ubuntumirclient, "Unexpected Qt::WindowState: %d", state);
488- return mir_surface_state_restored;
489 }
490+ return mir_surface_state_unknown; // should never be reached
491 }
492
493 WId makeId()
494@@ -588,13 +590,14 @@
495 }
496
497 UbuntuWindow::UbuntuWindow(QWindow *w, UbuntuInput *input, UbuntuNativeInterface *native,
498- EGLDisplay eglDisplay, MirConnection *mirConnection)
499+ EGLDisplay eglDisplay, MirConnection *mirConnection, UbuntuDebugExtension *debugExt)
500 : QObject(nullptr)
501 , QPlatformWindow(w)
502 , mId(makeId())
503 , mWindowState(w->windowState())
504 , mWindowFlags(w->flags())
505 , mWindowVisible(false)
506+ , mDebugExtention(debugExt)
507 , mNativeInterface(native)
508 , mSurface(new UbuntuSurface{this, eglDisplay, input, mirConnection})
509 , mScale(1.0)
510@@ -786,6 +789,15 @@
511 return mSurface->format();
512 }
513
514+QPoint UbuntuWindow::mapToGlobal(const QPoint &pos) const
515+{
516+ if (mDebugExtention) {
517+ return mDebugExtention->mapSurfacePointToScreen(mSurface->mirSurface(), pos);
518+ } else {
519+ return pos;
520+ }
521+}
522+
523 void* UbuntuWindow::eglSurface() const
524 {
525 return mSurface->eglSurface();
526
527=== modified file 'src/ubuntumirclient/window.h'
528--- src/ubuntumirclient/window.h 2016-08-24 12:40:30 +0000
529+++ src/ubuntumirclient/window.h 2016-09-22 15:36:58 +0000
530@@ -27,6 +27,7 @@
531
532 #include <EGL/egl.h>
533
534+class UbuntuDebugExtension;
535 class UbuntuNativeInterface;
536 class UbuntuInput;
537 class UbuntuScreen;
538@@ -39,7 +40,7 @@
539 Q_OBJECT
540 public:
541 UbuntuWindow(QWindow *w, UbuntuInput *input, UbuntuNativeInterface* native, EGLDisplay eglDisplay,
542- MirConnection *mirConnection);
543+ MirConnection *mirConnection, UbuntuDebugExtension *debugExt);
544 virtual ~UbuntuWindow();
545
546 // QPlatformWindow methods.
547@@ -52,6 +53,7 @@
548 void propagateSizeHints() override;
549 bool isExposed() const override;
550
551+ QPoint mapToGlobal(const QPoint &pos) const override;
552 QSurfaceFormat format() const override;
553
554 // Additional Window properties exposed by NativeInterface
555@@ -79,6 +81,7 @@
556 Qt::WindowFlags mWindowFlags;
557 bool mWindowVisible;
558 bool mWindowExposed;
559+ UbuntuDebugExtension *mDebugExtention;
560 UbuntuNativeInterface *mNativeInterface;
561 std::unique_ptr<UbuntuSurface> mSurface;
562 float mScale;

Subscribers

People subscribed via source and target branches