on xenial help sign in
try to add a special flickable that doesn't eat the mouse presses
6f759cfMichael Zanetti
plugins/Utils/CMakeLists.txt+2
@@ -4,6 +4,7 @@ include_directories(
4 ${CMAKE_CURRENT_SOURCE_DIR}
4 ${CMAKE_CURRENT_SOURCE_DIR}
5 ${CMAKE_CURRENT_BINARY_DIR}
5 ${CMAKE_CURRENT_BINARY_DIR}
6 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
6 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
7+ ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
7 ${GIO_INCLUDE_DIRS}
8 ${GIO_INCLUDE_DIRS}
8)
9)
9
10
@@ -17,6 +18,7 @@ set(QMLPLUGIN_SRC
17 windowkeysfilter.cpp
18 windowkeysfilter.cpp
18 easingcurve.cpp
19 easingcurve.cpp
19 windowstatestorage.cpp
20 windowstatestorage.cpp
21+ spreadflickable.cpp
20 plugin.cpp
22 plugin.cpp
21 )
23 )
22
24
plugins/Utils/plugin.cpp+2
@@ -35,6 +35,7 @@
35#include "windowkeysfilter.h"
35#include "windowkeysfilter.h"
36#include "easingcurve.h"
36#include "easingcurve.h"
37#include "windowstatestorage.h"
37#include "windowstatestorage.h"
38+#include "spreadflickable.h"
38
39
39static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
40static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
40{
41{
@@ -57,6 +58,7 @@ void UtilsPlugin::registerTypes(const char *uri)
57 qmlRegisterType<RelativeTimeFormatter>(uri, 0, 1, "RelativeTimeFormatter");
58 qmlRegisterType<RelativeTimeFormatter>(uri, 0, 1, "RelativeTimeFormatter");
58 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
59 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
59 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
60 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
61+ qmlRegisterType<SpreadFlickable>(uri, 0, 1, "SpreadFlickable");
60}
62}
61
63
62void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
64void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
qml/Stages/DesktopStage.qml+35−2
@@ -174,6 +174,10 @@ FocusScope {
174 visible: true
174 visible: true
175 opacity: spreadMaths.tileInfoOpacity
175 opacity: spreadMaths.tileInfoOpacity
176 }
176 }
177+ PropertyChanges {
178+ target: spreadSelectArea
179+ enabled: true
180+ }
177 }
181 }
178 ]
182 ]
179 transitions: [
183 transitions: [
@@ -239,6 +243,17 @@ FocusScope {
239 angle: appDelegate.angle
243 angle: appDelegate.angle
240 }
244 }
241 ]
245 ]
246+
247+ MouseArea {
248+ id: spreadSelectArea
249+ anchors.fill: parent
250+ enabled: false
251+ onClicked: {
252+ print("clicked")
253+ appDelegate.focusWindow()
254+ root.state = ""
255+ }
256+ }
242 }
257 }
243
258
244
259
@@ -269,7 +284,7 @@ FocusScope {
269 }
284 }
270 }
285 }
271
286
272− Flickable {
287+ SpreadFlickable {
273 id: spreadFlickable
288 id: spreadFlickable
274 anchors.fill: parent
289 anchors.fill: parent
275 contentWidth: Math.max(6, ApplicationManager.count) * width / 5
290 contentWidth: Math.max(6, ApplicationManager.count) * width / 5
@@ -359,7 +374,10 @@ FocusScope {
359 Transition {
374 Transition {
360 from: "*"
375 from: "*"
361 to: "altTab"
376 to: "altTab"
362− PropertyAction { target: spreadFlickable; property: "contentX"; value: 0 }
377+ PropertyAction { target: spreadFlickable; property: "contentX";
378+ value: ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 3, 1));
379+
380+ }
363 PropertyAnimation { property: "opacity" }
381 PropertyAnimation { property: "opacity" }
364 },
382 },
365 Transition {
383 Transition {
@@ -369,4 +387,19 @@ FocusScope {
369 }
387 }
370
388
371 ]
389 ]
390+
391+ MouseArea {
392+ anchors {
393+ top: parent.top
394+ right: parent.right
395+ bottom: parent.bottom
396+ }
397+ width: 1 // yes, we want 1 pixel, regardless of the scaling
398+ hoverEnabled: true
399+ onContainsMouseChanged: {
400+ if (containsMouse) {
401+ root.state = "altTab"
402+ }
403+ }
404+ }
372}
405}
tests/mocks/Utils/CMakeLists.txt+2
@@ -4,6 +4,7 @@ include_directories(
4 ${CMAKE_CURRENT_SOURCE_DIR}
4 ${CMAKE_CURRENT_SOURCE_DIR}
5 ${CMAKE_CURRENT_BINARY_DIR}
5 ${CMAKE_CURRENT_BINARY_DIR}
6 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
6 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
7+ ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
7 ${GIO_INCLUDE_DIRS}
8 ${GIO_INCLUDE_DIRS}
8 ${CMAKE_SOURCE_DIR}/plugins/Utils
9 ${CMAKE_SOURCE_DIR}/plugins/Utils
9)
10)
@@ -17,6 +18,7 @@ set(QMLPLUGIN_SRC
17 ${CMAKE_SOURCE_DIR}/plugins/Utils/windowkeysfilter.cpp
18 ${CMAKE_SOURCE_DIR}/plugins/Utils/windowkeysfilter.cpp
18 ${CMAKE_SOURCE_DIR}/plugins/Utils/easingcurve.cpp
19 ${CMAKE_SOURCE_DIR}/plugins/Utils/easingcurve.cpp
19 ${CMAKE_SOURCE_DIR}/plugins/Utils/inputwatcher.cpp
20 ${CMAKE_SOURCE_DIR}/plugins/Utils/inputwatcher.cpp
21+ ${CMAKE_SOURCE_DIR}/plugins/Utils/spreadflickable.cpp
20 windowstatestorage.cpp
22 windowstatestorage.cpp
21 plugin.cpp
23 plugin.cpp
22 )
24 )
tests/mocks/Utils/plugin.cpp+2
@@ -33,6 +33,7 @@
33#include "unitymenumodelpaths.h"
33#include "unitymenumodelpaths.h"
34#include "windowkeysfilter.h"
34#include "windowkeysfilter.h"
35#include "windowstatestorage.h"
35#include "windowstatestorage.h"
36+#include "spreadflickable.h"
36
37
37static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
38static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
38{
39{
@@ -55,6 +56,7 @@ void FakeUtilsPlugin::registerTypes(const char *uri)
55 qmlRegisterType<RelativeTimeFormatter>(uri, 0, 1, "RelativeTimeFormatter");
56 qmlRegisterType<RelativeTimeFormatter>(uri, 0, 1, "RelativeTimeFormatter");
56 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
57 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
57 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
58 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
59+ qmlRegisterType<SpreadFlickable>(uri, 0, 1, "SpreadFlickable");
58}
60}
59
61
60void FakeUtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
62void FakeUtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)