on xenial help sign in
Don't build MouseTouchAdaptor on ARM

+ remove unused context property from unity8-dash

commit81a1c684fa1459db150c3198d5e103bdafd005be authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateWed 16 Dec 2015, 11:58 (11 years ago) parentb71c30f
11 files changed+94−38
CMakeLists.txt+10 debian/control+3−3 src/CMakeLists.txt+13−7 src/Dash/CMakeLists.txt+8−8 src/Dash/main.cpp+9−5 src/ShellApplication.cpp+5−5 src/ShellApplication.h+12−4 src/UnityCommandLineParser.cpp+6 src/UnityCommandLineParser.h+8 tests/utils/modules/Unity/Test/CMakeLists.txt+7−3 tests/utils/modules/Unity/Test/plugin.cpp+13−3
CMakeLists.txt+10
@@ -128,6 +128,16 @@ if(NOT QUIET_LOGGER)
128128 set(STDOUT_LOGGER "-o" "-,txt")
129129endif()
130130
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+
131141# add subdirectories to build
132142add_subdirectory(include)
133143add_subdirectory(libs)
debian/control+3−3
@@ -32,9 +32,9 @@ Build-Depends: cmake,
3232 libunity-api-dev (>= 7.104),
3333 libusermetricsoutput1-dev,
3434# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
35− libxcb1-dev,
36− libx11-dev
37− libxi-dev,
35+ libxcb1-dev[!armhf],
36+ libx11-dev[!armhf],
37+ libxi-dev[!armhf],
3838# End of X11 libs
3939 pkg-config,
4040 python3-all:any,
src/CMakeLists.txt+13−7
@@ -16,10 +16,9 @@ file(GLOB_RECURSE QML_FILES
1616 ${CMAKE_SOURCE_DIR}/tests/*.svg
1717)
1818
19−add_executable(${SHELL_APP}
19+set(SOURCE_FILES
2020 ApplicationArguments.cpp
2121 main.cpp
22− MouseTouchAdaptor.cpp
2322 CachingNetworkManagerFactory.cpp
2423 SecondaryWindow.cpp
2524 ShellApplication.cpp
@@ -28,15 +27,22 @@ add_executable(${SHELL_APP}
2827 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
2928)
3029
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})
3136qt5_use_modules(${SHELL_APP} Gui Qml Quick Test)
3237
33−pkg_check_modules(NEEDED_LIBS REQUIRED x11 xcb xi libandroid-properties)
34−if (NOT "${NEEDED_LIBS_INCLUDE_DIRS}" STREQUAL "")
35− set_target_properties(${SHELL_APP} PROPERTIES INCLUDE_DIRECTORIES ${NEEDED_LIBS_INCLUDE_DIRS})
38+if (NOT "${ANDROID_PROPERTIES_INCLUDE_DIRS}" STREQUAL "")
39+ set_target_properties(${SHELL_APP} PROPERTIES INCLUDE_DIRECTORIES ${ANDROID_PROPERTIES_INCLUDE_DIRS})
3640endif()
37−target_link_libraries(${SHELL_APP} ${NEEDED_LIBS_LDFLAGS})
41+target_link_libraries(${SHELL_APP} ${ANDROID_PROPERTIES_LDFLAGS} UbuntuGestures connectivity-qt1)
3842
39−target_link_libraries(${SHELL_APP} UbuntuGestures connectivity-qt1)
43+if (ENABLE_TOUCH_EMULATION)
44+ target_link_libraries(${SHELL_APP} ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
45+endif()
4046
4147# For it to find libUbuntuGestures.so
4248set_target_properties(${SHELL_APP} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
src/Dash/CMakeLists.txt+8−8
@@ -1,25 +1,25 @@
11set(DASH_SRCS
22 main.cpp
3− ../ApplicationArguments.cpp
4− ../MouseTouchAdaptor.cpp
53 ../CachingNetworkManagerFactory.cpp
64)
75
6+if (ENABLE_TOUCH_EMULATION)
7+ set(DASH_SRCS ${DASH_SRCS} ../MouseTouchAdaptor.cpp)
8+endif()
9+
810add_executable(unity8-dash ${DASH_SRCS})
911
1012qt5_use_modules(unity8-dash Gui Qml Quick Test)
1113
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−
1814# For it to find libUbuntuGestures.so, needed by Ubuntu.Gestures QML module.
1915set_target_properties(unity8-dash PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
2016
2117target_link_libraries(unity8-dash UbuntuGestures connectivity-qt1)
2218
19+if (ENABLE_TOUCH_EMULATION)
20+ target_link_libraries(unity8-dash ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
21+endif()
22+
2323set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
2424
2525# install binaries
src/Dash/main.cpp+9−5
@@ -27,8 +27,9 @@
2727#include <libintl.h>
2828
2929#include <paths.h>
30−#include "../MouseTouchAdaptor.h"
31−#include "../ApplicationArguments.h"
30+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
31+ #include "../MouseTouchAdaptor.h"
32+#endif
3233#include "../CachingNetworkManagerFactory.h"
3334
3435int main(int argc, const char *argv[])
@@ -57,8 +58,6 @@ int main(int argc, const char *argv[])
5758 parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
5859 parser.process(*application);
5960
60− ApplicationArguments qmlArgs;
61−
6261 if (getenv("QT_LOAD_TESTABILITY")) {
6362 QLibrary testLib(QStringLiteral("qttestability"));
6463 if (testLib.load()) {
@@ -92,14 +91,15 @@ int main(int argc, const char *argv[])
9291 }
9392
9493 view->setTitle(QStringLiteral("Scopes"));
95− view->rootContext()->setContextProperty(QStringLiteral("applicationArguments"), &qmlArgs);
9694
95+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
9796 // You will need this if you want to interact with touch-only components using a mouse
9897 // Needed only when manually testing on a desktop.
9998 MouseTouchAdaptor *mouseTouchAdaptor = 0;
10099 if (parser.isSet(mousetouchOption)) {
101100 mouseTouchAdaptor = MouseTouchAdaptor::instance();
102101 }
102+ #endif
103103
104104 QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
105105 prependImportPaths(view->engine(), ::overrideImportPaths());
@@ -114,7 +114,11 @@ int main(int argc, const char *argv[])
114114 int result = application->exec();
115115
116116 delete view;
117+
118+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
117119 delete mouseTouchAdaptor;
120+ #endif
121+
118122 delete application;
119123
120124 return result;
src/ShellApplication.cpp+5−5
@@ -28,15 +28,10 @@
2828// local
2929#include <paths.h>
3030#include "CachingNetworkManagerFactory.h"
31−#include "MouseTouchAdaptor.h"
3231#include "UnityCommandLineParser.h"
3332
3433ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
3534 : QGuiApplication(argc, argv)
36− , m_shellView(nullptr)
37− , m_secondaryWindow(nullptr)
38− , m_mouseTouchAdaptor(nullptr)
39− , m_qmlEngine(nullptr)
4035{
4136
4237 setApplicationName(QStringLiteral("unity8"));
@@ -89,11 +84,14 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
8984 m_shellView->setFlags(Qt::FramelessWindowHint);
9085 }
9186
87+
88+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
9289 // You will need this if you want to interact with touch-only components using a mouse
9390 // Needed only when manually testing on a desktop.
9491 if (parser.hasMouseToTouch()) {
9592 m_mouseTouchAdaptor = MouseTouchAdaptor::instance();
9693 }
94+ #endif
9795
9896
9997 // Some hard-coded policy for now.
@@ -134,8 +132,10 @@ void ShellApplication::destroyResources()
134132 delete m_secondaryWindow;
135133 m_secondaryWindow = nullptr;
136134
135+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
137136 delete m_mouseTouchAdaptor;
138137 m_mouseTouchAdaptor = nullptr;
138+ #endif
139139
140140 delete m_qmlEngine;
141141 m_qmlEngine = nullptr;
src/ShellApplication.h+12−4
@@ -23,7 +23,11 @@
2323#include <QScopedPointer>
2424
2525#include "ApplicationArguments.h"
26+
27+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
2628#include "MouseTouchAdaptor.h"
29+#endif
30+
2731#include "SecondaryWindow.h"
2832#include "ShellView.h"
2933
@@ -46,10 +50,14 @@ private:
4650 void setupQmlEngine(bool isMirServer);
4751 QString m_deviceName;
4852 ApplicationArguments m_qmlArgs;
49− ShellView *m_shellView;
50− SecondaryWindow *m_secondaryWindow;
51− MouseTouchAdaptor *m_mouseTouchAdaptor;
52− QQmlEngine *m_qmlEngine;
53+ ShellView *m_shellView{nullptr};
54+ SecondaryWindow *m_secondaryWindow{nullptr};
55+
56+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
57+ MouseTouchAdaptor *m_mouseTouchAdaptor{nullptr};
58+ #endif
59+
60+ QQmlEngine *m_qmlEngine{nullptr};
5361};
5462
5563#endif // SHELLAPPLICATION_H
src/UnityCommandLineParser.cpp+6
@@ -37,9 +37,11 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
3737 QStringLiteral("Run without window borders"));
3838 parser.addOption(framelessOption);
3939
40+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
4041 QCommandLineOption mousetouchOption(QStringLiteral("mousetouch"),
4142 QStringLiteral("Allow the mouse to provide touch input"));
4243 parser.addOption(mousetouchOption);
44+ #endif
4345
4446 QCommandLineOption windowGeometryOption(QStringList() << QStringLiteral("windowgeometry"),
4547 QStringLiteral("Specify the window geometry as [<width>x<height>]"), QStringLiteral("windowgeometry"), QStringLiteral("1"));
@@ -75,7 +77,11 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
7577
7678 m_hasTestability = parser.isSet(testabilityOption);
7779 m_hasFrameless = parser.isSet(framelessOption);
80+
81+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
7882 m_hasMouseToTouch = parser.isSet(mousetouchOption);
83+ #endif
84+
7985 m_hasFullscreen = parser.isSet(fullscreenOption);
8086 m_deviceName = parser.value(devicenameOption);
8187 resolveMode(parser, modeOption);
src/UnityCommandLineParser.h+8
@@ -28,7 +28,11 @@ public:
2828 QSize windowGeometry() const { return m_windowGeometry; }
2929 bool hasTestability() const { return m_hasTestability; }
3030 bool hasFrameless() const { return m_hasFrameless; }
31+
32+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
3133 bool hasMouseToTouch() const { return m_hasMouseToTouch; }
34+ #endif
35+
3236 bool hasFullscreen() const { return m_hasFullscreen; }
3337 QString deviceName() const { return m_deviceName; }
3438 QString mode() const { return m_mode; }
@@ -43,7 +47,11 @@ private:
4347 QSize m_windowGeometry;
4448 bool m_hasTestability;
4549 bool m_hasFrameless;
50+
51+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
4652 bool m_hasMouseToTouch;
53+ #endif
54+
4755 bool m_hasFullscreen;
4856 QString m_deviceName;
4957 QString m_mode;
tests/utils/modules/Unity/Test/CMakeLists.txt+7−3
@@ -13,14 +13,18 @@ set(UnityTestQML_SOURCES
1313 testutil.cpp
1414 plugin.cpp
1515 TouchEventSequenceWrapper.cpp
16− ${CMAKE_SOURCE_DIR}/src/MouseTouchAdaptor.cpp
1716)
1817
18+if (ENABLE_TOUCH_EMULATION)
19+ set(UnityTestQML_SOURCES ${UnityTestQML_SOURCES} ${CMAKE_SOURCE_DIR}/src/MouseTouchAdaptor.cpp)
20+endif()
21+
1922add_library(UnityTestQml MODULE ${UnityTestQML_SOURCES})
2023target_link_libraries(UnityTestQml UbuntuGestures)
2124
22−pkg_check_modules(MOUSETOUCHADAPTOR_LIBS REQUIRED x11 xcb xi)
23−target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
25+if (ENABLE_TOUCH_EMULATION)
26+ target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
27+endif()
2428
2529qt5_use_modules(UnityTestQml Core Quick Test)
2630
tests/utils/modules/Unity/Test/plugin.cpp+13−3
@@ -17,7 +17,11 @@
1717
1818#include "plugin.h"
1919#include "testutil.h"
20+
21+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
2022#include <MouseTouchAdaptor.h>
23+#endif
24+
2125#include "TouchEventSequenceWrapper.h"
2226
2327#include <qqml.h>
@@ -27,23 +31,29 @@ QObject *testutil_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine
2731{
2832 return new TestUtil();
2933}
34+
35+#ifdef UNITY8_ENABLE_TOUCH_EMULATION
3036QObject *getMouseTouchAdaptorQMLSingleton(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
3137{
3238 return MouseTouchAdaptor::instance();
3339}
40+#endif
41+
3442} // anonymous namespace
3543
3644void UnityTestPlugin::registerTypes(const char *uri)
3745{
3846 Q_ASSERT(QLatin1String(uri) == QLatin1String("Unity.Test"));
3947
40− // Ensure the instance gets created
41− MouseTouchAdaptor::instance();
42−
4348 // @uri Unity.Test
4449 qmlRegisterSingletonType<TestUtil>(uri, 0, 1, "Util", testutil_provider);
4550 qmlRegisterUncreatableType<TouchEventSequenceWrapper>(uri, 0, 1, "TouchEventSequence",
4651 "You cannot directly create a TouchEventSequence object.");
52+
53+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
54+ // Ensure the instance gets created
55+ MouseTouchAdaptor::instance();
4756 qmlRegisterSingletonType<MouseTouchAdaptor>(uri, 0, 1, "MouseTouchAdaptor",
4857 getMouseTouchAdaptorQMLSingleton);
58+ #endif
4959}