on xenial help sign in
Don't build MouseTouchAdaptor on ARM
81a1c68Daniel d'Andrada
CMakeLists.txt+10
@@ -128,6 +128,16 @@ if(NOT QUIET_LOGGER)
128 set(STDOUT_LOGGER "-o" "-,txt")
128 set(STDOUT_LOGGER "-o" "-,txt")
129endif()
129endif()
130
130
131+execute_process(COMMAND arch OUTPUT_VARIABLE ARCH)
132+if (NOT ARCH MATCHES "arm*")
133+ set(ENABLE_TOUCH_EMULATION true)
134+ add_definitions(-DUNITY8_ENABLE_TOUCH_EMULATION)
135+ pkg_check_modules(MOUSETOUCHADAPTOR_LIBS REQUIRED x11 xcb xi)
136+else()
137+ set(ENABLE_TOUCH_EMULATION false)
138+ message(STATUS "Touch emulation support disabled.")
139+endif()
140+
131# add subdirectories to build
141# add subdirectories to build
132add_subdirectory(include)
142add_subdirectory(include)
133add_subdirectory(libs)
143add_subdirectory(libs)
debian/control+3−3
@@ -32,9 +32,9 @@ Build-Depends: cmake,
32 libunity-api-dev (>= 7.104),
32 libunity-api-dev (>= 7.104),
33 libusermetricsoutput1-dev,
33 libusermetricsoutput1-dev,
34# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
34# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
35− libxcb1-dev,
35+ libxcb1-dev[!armhf],
36− libx11-dev
36+ libx11-dev[!armhf],
37− libxi-dev,
37+ libxi-dev[!armhf],
38# End of X11 libs
38# End of X11 libs
39 pkg-config,
39 pkg-config,
40 python3-all:any,
40 python3-all:any,
src/CMakeLists.txt+13−7
@@ -16,10 +16,9 @@ file(GLOB_RECURSE QML_FILES
16 ${CMAKE_SOURCE_DIR}/tests/*.svg
16 ${CMAKE_SOURCE_DIR}/tests/*.svg
17)
17)
18
18
19−add_executable(${SHELL_APP}
19+set(SOURCE_FILES
20 ApplicationArguments.cpp
20 ApplicationArguments.cpp
21 main.cpp
21 main.cpp
22− MouseTouchAdaptor.cpp
23 CachingNetworkManagerFactory.cpp
22 CachingNetworkManagerFactory.cpp
24 SecondaryWindow.cpp
23 SecondaryWindow.cpp
25 ShellApplication.cpp
24 ShellApplication.cpp
@@ -28,15 +27,22 @@ add_executable(${SHELL_APP}
28 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
27 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
29)
28)
30
29
30+if (ENABLE_TOUCH_EMULATION)
31+ set(SOURCE_FILES ${SOURCE_FILES} MouseTouchAdaptor.cpp)
32+endif()
33+
34+pkg_check_modules(ANDROID_PROPERTIES REQUIRED libandroid-properties)
35+add_executable(${SHELL_APP} ${SOURCE_FILES})
31qt5_use_modules(${SHELL_APP} Gui Qml Quick Test)
36qt5_use_modules(${SHELL_APP} Gui Qml Quick Test)
32
37
33−pkg_check_modules(NEEDED_LIBS REQUIRED x11 xcb xi libandroid-properties)
38+if (NOT "${ANDROID_PROPERTIES_INCLUDE_DIRS}" STREQUAL "")
34−if (NOT "${NEEDED_LIBS_INCLUDE_DIRS}" STREQUAL "")
35− set_target_properties(${SHELL_APP} PROPERTIES INCLUDE_DIRECTORIES ${NEEDED_LIBS_INCLUDE_DIRS})
39+ set_target_properties(${SHELL_APP} PROPERTIES INCLUDE_DIRECTORIES ${ANDROID_PROPERTIES_INCLUDE_DIRS})
36endif()
40endif()
37−target_link_libraries(${SHELL_APP} ${NEEDED_LIBS_LDFLAGS})
41+target_link_libraries(${SHELL_APP} ${ANDROID_PROPERTIES_LDFLAGS} UbuntuGestures connectivity-qt1)
38
42
43+if (ENABLE_TOUCH_EMULATION)
39−target_link_libraries(${SHELL_APP} UbuntuGestures connectivity-qt1)
44+ target_link_libraries(${SHELL_APP} ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
45+endif()
40
46
41# For it to find libUbuntuGestures.so
47# For it to find libUbuntuGestures.so
42set_target_properties(${SHELL_APP} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
48set_target_properties(${SHELL_APP} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
src/Dash/CMakeLists.txt+8−8
@@ -1,25 +1,25 @@
1set(DASH_SRCS
1set(DASH_SRCS
2 main.cpp
2 main.cpp
3− ../ApplicationArguments.cpp
4− ../MouseTouchAdaptor.cpp
5 ../CachingNetworkManagerFactory.cpp
3 ../CachingNetworkManagerFactory.cpp
6)
4)
7
5
6+if (ENABLE_TOUCH_EMULATION)
7+ set(DASH_SRCS ${DASH_SRCS} ../MouseTouchAdaptor.cpp)
8+endif()
9+
8add_executable(unity8-dash ${DASH_SRCS})
10add_executable(unity8-dash ${DASH_SRCS})
9
11
10qt5_use_modules(unity8-dash Gui Qml Quick Test)
12qt5_use_modules(unity8-dash Gui Qml Quick Test)
11
13
12−pkg_check_modules(NEEDED_LIBS REQUIRED xcb libandroid-properties)
13−if (NOT "${NEEDED_LIBS_INCLUDE_DIRS}" STREQUAL "")
14− set_target_properties(unity8-dash PROPERTIES INCLUDE_DIRECTORIES ${NEEDED_LIBS_INCLUDE_DIRS})
15−endif()
16−target_link_libraries(unity8-dash ${NEEDED_LIBS_LDFLAGS})
17−
18# For it to find libUbuntuGestures.so, needed by Ubuntu.Gestures QML module.
14# For it to find libUbuntuGestures.so, needed by Ubuntu.Gestures QML module.
19set_target_properties(unity8-dash PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
15set_target_properties(unity8-dash PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
20
16
21target_link_libraries(unity8-dash UbuntuGestures connectivity-qt1)
17target_link_libraries(unity8-dash UbuntuGestures connectivity-qt1)
22
18
19+if (ENABLE_TOUCH_EMULATION)
20+ target_link_libraries(unity8-dash ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
21+endif()
22+
23set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
23set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
24
24
25# install binaries
25# install binaries
src/Dash/main.cpp+9−5
@@ -27,8 +27,9 @@
27#include <libintl.h>
27#include <libintl.h>
28
28
29#include <paths.h>
29#include <paths.h>
30+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
30−#include "../MouseTouchAdaptor.h"
31+ #include "../MouseTouchAdaptor.h"
31−#include "../ApplicationArguments.h"
32+#endif
32#include "../CachingNetworkManagerFactory.h"
33#include "../CachingNetworkManagerFactory.h"
33
34
34int main(int argc, const char *argv[])
35int main(int argc, const char *argv[])
@@ -57,8 +58,6 @@ int main(int argc, const char *argv[])
57 parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
58 parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
58 parser.process(*application);
59 parser.process(*application);
59
60
60− ApplicationArguments qmlArgs;
61−
62 if (getenv("QT_LOAD_TESTABILITY")) {
61 if (getenv("QT_LOAD_TESTABILITY")) {
63 QLibrary testLib(QStringLiteral("qttestability"));
62 QLibrary testLib(QStringLiteral("qttestability"));
64 if (testLib.load()) {
63 if (testLib.load()) {
@@ -92,14 +91,15 @@ int main(int argc, const char *argv[])
92 }
91 }
93
92
94 view->setTitle(QStringLiteral("Scopes"));
93 view->setTitle(QStringLiteral("Scopes"));
95− view->rootContext()->setContextProperty(QStringLiteral("applicationArguments"), &qmlArgs);
96
94
95+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
97 // You will need this if you want to interact with touch-only components using a mouse
96 // You will need this if you want to interact with touch-only components using a mouse
98 // Needed only when manually testing on a desktop.
97 // Needed only when manually testing on a desktop.
99 MouseTouchAdaptor *mouseTouchAdaptor = 0;
98 MouseTouchAdaptor *mouseTouchAdaptor = 0;
100 if (parser.isSet(mousetouchOption)) {
99 if (parser.isSet(mousetouchOption)) {
101 mouseTouchAdaptor = MouseTouchAdaptor::instance();
100 mouseTouchAdaptor = MouseTouchAdaptor::instance();
102 }
101 }
102+ #endif
103
103
104 QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
104 QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
105 prependImportPaths(view->engine(), ::overrideImportPaths());
105 prependImportPaths(view->engine(), ::overrideImportPaths());
@@ -114,7 +114,11 @@ int main(int argc, const char *argv[])
114 int result = application->exec();
114 int result = application->exec();
115
115
116 delete view;
116 delete view;
117+
118+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
117 delete mouseTouchAdaptor;
119 delete mouseTouchAdaptor;
120+ #endif
121+
118 delete application;
122 delete application;
119
123
120 return result;
124 return result;
src/ShellApplication.cpp+5−5
@@ -28,15 +28,10 @@
28// local
28// local
29#include <paths.h>
29#include <paths.h>
30#include "CachingNetworkManagerFactory.h"
30#include "CachingNetworkManagerFactory.h"
31−#include "MouseTouchAdaptor.h"
32#include "UnityCommandLineParser.h"
31#include "UnityCommandLineParser.h"
33
32
34ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
33ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
35 : QGuiApplication(argc, argv)
34 : QGuiApplication(argc, argv)
36− , m_shellView(nullptr)
37− , m_secondaryWindow(nullptr)
38− , m_mouseTouchAdaptor(nullptr)
39− , m_qmlEngine(nullptr)
40{
35{
41
36
42 setApplicationName(QStringLiteral("unity8"));
37 setApplicationName(QStringLiteral("unity8"));
@@ -89,11 +84,14 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
89 m_shellView->setFlags(Qt::FramelessWindowHint);
84 m_shellView->setFlags(Qt::FramelessWindowHint);
90 }
85 }
91
86
87+
88+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
92 // You will need this if you want to interact with touch-only components using a mouse
89 // You will need this if you want to interact with touch-only components using a mouse
93 // Needed only when manually testing on a desktop.
90 // Needed only when manually testing on a desktop.
94 if (parser.hasMouseToTouch()) {
91 if (parser.hasMouseToTouch()) {
95 m_mouseTouchAdaptor = MouseTouchAdaptor::instance();
92 m_mouseTouchAdaptor = MouseTouchAdaptor::instance();
96 }
93 }
94+ #endif
97
95
98
96
99 // Some hard-coded policy for now.
97 // Some hard-coded policy for now.
@@ -134,8 +132,10 @@ void ShellApplication::destroyResources()
134 delete m_secondaryWindow;
132 delete m_secondaryWindow;
135 m_secondaryWindow = nullptr;
133 m_secondaryWindow = nullptr;
136
134
135+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
137 delete m_mouseTouchAdaptor;
136 delete m_mouseTouchAdaptor;
138 m_mouseTouchAdaptor = nullptr;
137 m_mouseTouchAdaptor = nullptr;
138+ #endif
139
139
140 delete m_qmlEngine;
140 delete m_qmlEngine;
141 m_qmlEngine = nullptr;
141 m_qmlEngine = nullptr;
src/ShellApplication.h+12−4
@@ -23,7 +23,11 @@
23#include <QScopedPointer>
23#include <QScopedPointer>
24
24
25#include "ApplicationArguments.h"
25#include "ApplicationArguments.h"
26+
27+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
26#include "MouseTouchAdaptor.h"
28#include "MouseTouchAdaptor.h"
29+#endif
30+
27#include "SecondaryWindow.h"
31#include "SecondaryWindow.h"
28#include "ShellView.h"
32#include "ShellView.h"
29
33
@@ -46,10 +50,14 @@ private:
46 void setupQmlEngine(bool isMirServer);
50 void setupQmlEngine(bool isMirServer);
47 QString m_deviceName;
51 QString m_deviceName;
48 ApplicationArguments m_qmlArgs;
52 ApplicationArguments m_qmlArgs;
49− ShellView *m_shellView;
53+ ShellView *m_shellView{nullptr};
50− SecondaryWindow *m_secondaryWindow;
54+ SecondaryWindow *m_secondaryWindow{nullptr};
55+
56+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
51− MouseTouchAdaptor *m_mouseTouchAdaptor;
57+ MouseTouchAdaptor *m_mouseTouchAdaptor{nullptr};
58+ #endif
59+
52− QQmlEngine *m_qmlEngine;
60+ QQmlEngine *m_qmlEngine{nullptr};
53};
61};
54
62
55#endif // SHELLAPPLICATION_H
63#endif // SHELLAPPLICATION_H
src/UnityCommandLineParser.cpp+6
@@ -37,9 +37,11 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
37 QStringLiteral("Run without window borders"));
37 QStringLiteral("Run without window borders"));
38 parser.addOption(framelessOption);
38 parser.addOption(framelessOption);
39
39
40+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
40 QCommandLineOption mousetouchOption(QStringLiteral("mousetouch"),
41 QCommandLineOption mousetouchOption(QStringLiteral("mousetouch"),
41 QStringLiteral("Allow the mouse to provide touch input"));
42 QStringLiteral("Allow the mouse to provide touch input"));
42 parser.addOption(mousetouchOption);
43 parser.addOption(mousetouchOption);
44+ #endif
43
45
44 QCommandLineOption windowGeometryOption(QStringList() << QStringLiteral("windowgeometry"),
46 QCommandLineOption windowGeometryOption(QStringList() << QStringLiteral("windowgeometry"),
45 QStringLiteral("Specify the window geometry as [<width>x<height>]"), QStringLiteral("windowgeometry"), QStringLiteral("1"));
47 QStringLiteral("Specify the window geometry as [<width>x<height>]"), QStringLiteral("windowgeometry"), QStringLiteral("1"));
@@ -75,7 +77,11 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
75
77
76 m_hasTestability = parser.isSet(testabilityOption);
78 m_hasTestability = parser.isSet(testabilityOption);
77 m_hasFrameless = parser.isSet(framelessOption);
79 m_hasFrameless = parser.isSet(framelessOption);
80+
81+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
78 m_hasMouseToTouch = parser.isSet(mousetouchOption);
82 m_hasMouseToTouch = parser.isSet(mousetouchOption);
83+ #endif
84+
79 m_hasFullscreen = parser.isSet(fullscreenOption);
85 m_hasFullscreen = parser.isSet(fullscreenOption);
80 m_deviceName = parser.value(devicenameOption);
86 m_deviceName = parser.value(devicenameOption);
81 resolveMode(parser, modeOption);
87 resolveMode(parser, modeOption);
src/UnityCommandLineParser.h+8
@@ -28,7 +28,11 @@ public:
28 QSize windowGeometry() const { return m_windowGeometry; }
28 QSize windowGeometry() const { return m_windowGeometry; }
29 bool hasTestability() const { return m_hasTestability; }
29 bool hasTestability() const { return m_hasTestability; }
30 bool hasFrameless() const { return m_hasFrameless; }
30 bool hasFrameless() const { return m_hasFrameless; }
31+
32+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
31 bool hasMouseToTouch() const { return m_hasMouseToTouch; }
33 bool hasMouseToTouch() const { return m_hasMouseToTouch; }
34+ #endif
35+
32 bool hasFullscreen() const { return m_hasFullscreen; }
36 bool hasFullscreen() const { return m_hasFullscreen; }
33 QString deviceName() const { return m_deviceName; }
37 QString deviceName() const { return m_deviceName; }
34 QString mode() const { return m_mode; }
38 QString mode() const { return m_mode; }
@@ -43,7 +47,11 @@ private:
43 QSize m_windowGeometry;
47 QSize m_windowGeometry;
44 bool m_hasTestability;
48 bool m_hasTestability;
45 bool m_hasFrameless;
49 bool m_hasFrameless;
50+
51+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
46 bool m_hasMouseToTouch;
52 bool m_hasMouseToTouch;
53+ #endif
54+
47 bool m_hasFullscreen;
55 bool m_hasFullscreen;
48 QString m_deviceName;
56 QString m_deviceName;
49 QString m_mode;
57 QString m_mode;
tests/utils/modules/Unity/Test/CMakeLists.txt+7−3
@@ -13,14 +13,18 @@ set(UnityTestQML_SOURCES
13 testutil.cpp
13 testutil.cpp
14 plugin.cpp
14 plugin.cpp
15 TouchEventSequenceWrapper.cpp
15 TouchEventSequenceWrapper.cpp
16− ${CMAKE_SOURCE_DIR}/src/MouseTouchAdaptor.cpp
17)
16)
18
17
18+if (ENABLE_TOUCH_EMULATION)
19+ set(UnityTestQML_SOURCES ${UnityTestQML_SOURCES} ${CMAKE_SOURCE_DIR}/src/MouseTouchAdaptor.cpp)
20+endif()
21+
19add_library(UnityTestQml MODULE ${UnityTestQML_SOURCES})
22add_library(UnityTestQml MODULE ${UnityTestQML_SOURCES})
20target_link_libraries(UnityTestQml UbuntuGestures)
23target_link_libraries(UnityTestQml UbuntuGestures)
21
24
22−pkg_check_modules(MOUSETOUCHADAPTOR_LIBS REQUIRED x11 xcb xi)
25+if (ENABLE_TOUCH_EMULATION)
23−target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
26+ target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
27+endif()
24
28
25qt5_use_modules(UnityTestQml Core Quick Test)
29qt5_use_modules(UnityTestQml Core Quick Test)
26
30
tests/utils/modules/Unity/Test/plugin.cpp+13−3
@@ -17,7 +17,11 @@
17
17
18#include "plugin.h"
18#include "plugin.h"
19#include "testutil.h"
19#include "testutil.h"
20+
21+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
20#include <MouseTouchAdaptor.h>
22#include <MouseTouchAdaptor.h>
23+#endif
24+
21#include "TouchEventSequenceWrapper.h"
25#include "TouchEventSequenceWrapper.h"
22
26
23#include <qqml.h>
27#include <qqml.h>
@@ -27,23 +31,29 @@ QObject *testutil_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine
27{
31{
28 return new TestUtil();
32 return new TestUtil();
29}
33}
34+
35+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
30QObject *getMouseTouchAdaptorQMLSingleton(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
36QObject *getMouseTouchAdaptorQMLSingleton(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
31{
37{
32 return MouseTouchAdaptor::instance();
38 return MouseTouchAdaptor::instance();
33}
39}
40+#endif
41+
34} // anonymous namespace
42} // anonymous namespace
35
43
36void UnityTestPlugin::registerTypes(const char *uri)
44void UnityTestPlugin::registerTypes(const char *uri)
37{
45{
38 Q_ASSERT(QLatin1String(uri) == QLatin1String("Unity.Test"));
46 Q_ASSERT(QLatin1String(uri) == QLatin1String("Unity.Test"));
39
47
40− // Ensure the instance gets created
41− MouseTouchAdaptor::instance();
42−
43 // @uri Unity.Test
48 // @uri Unity.Test
44 qmlRegisterSingletonType<TestUtil>(uri, 0, 1, "Util", testutil_provider);
49 qmlRegisterSingletonType<TestUtil>(uri, 0, 1, "Util", testutil_provider);
45 qmlRegisterUncreatableType<TouchEventSequenceWrapper>(uri, 0, 1, "TouchEventSequence",
50 qmlRegisterUncreatableType<TouchEventSequenceWrapper>(uri, 0, 1, "TouchEventSequence",
46 "You cannot directly create a TouchEventSequence object.");
51 "You cannot directly create a TouchEventSequence object.");
52+
53+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
54+ // Ensure the instance gets created
55+ MouseTouchAdaptor::instance();
47 qmlRegisterSingletonType<MouseTouchAdaptor>(uri, 0, 1, "MouseTouchAdaptor",
56 qmlRegisterSingletonType<MouseTouchAdaptor>(uri, 0, 1, "MouseTouchAdaptor",
48 getMouseTouchAdaptorQMLSingleton);
57 getMouseTouchAdaptorQMLSingleton);
58+ #endif
49}
59}