Commit 2976172e authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Merge pull request #37 from filippz/master

Fix reported gesture when swiping away from apps
parents 38b043ff 5e25bfff
......@@ -9,7 +9,7 @@ Name: lipstick-glacier-home-qt5
# << macros
Summary: A nice homescreen for Glacier experience
Version: 0.22
Version: 0.23
Release: 1
Group: System/GUI/Other
License: BSD
......
Name: lipstick-glacier-home-qt5
Summary: A nice homescreen for Glacier experience
Version: 0.22
Version: 0.23
Release: 1
Group: System/GUI/Other
License: BSD
......
......@@ -152,7 +152,7 @@ Compositor {
if (gestureArea.progress >= swipeThreshold) {
swipeAnimation.valueTo = inverted ? -max : max
swipeAnimation.start()
if (gestureArea.gesture == "down") {
if (gesture == "down") {
Lipstick.compositor.closeClientForWindowId(topmostWindow.window.windowId)
}
} else {
......@@ -160,7 +160,7 @@ Compositor {
}
} else if (root.homeActive){
if (gestureArea.progress >= lockThreshold) {
lockAnimation.valueTo = (gestureArea.gesture == "left" ?
lockAnimation.valueTo = (gesture == "left" ?
Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.width)
lockAnimation.start()
......
......@@ -21,6 +21,7 @@
// SOFTWARE.
import QtQuick 2.0
import QtQuick.Window 2.0
import org.nemomobile.lipstick 0.1
MouseArea {
......@@ -44,11 +45,26 @@ MouseArea {
// Internal
property int _mouseStart
property Item _mapTo: Lipstick.compositor.homeActive ? Lipstick.compositor.topmostWindow.window : parent
property variant _gestures: ["down", "left", "up", "right"]
function mouseToMouseReal(m) {
return mapToItem(_mapTo, m.x, m.y)
}
function realGesture(g) {
var r = Screen.angleBetween(Lipstick.compositor.screenOrientation, Screen.orientation) / 90
if (r === 0)
return g
var shiftedGestures = _gestures.slice(0)
for (var i = 0; i < r; i++) {
var shifted = shiftedGestures.shift()
shiftedGestures.push(shifted)
}
return _gestures[shiftedGestures.indexOf(g)]
}
onPressed: {
var mouseReal = mouseToMouseReal(mouse)
......@@ -75,7 +91,7 @@ MouseArea {
else
_mouseStart = mouseReal.y
gestureStarted(gesture)
gestureStarted(Lipstick.compositor.homeActive ? gesture : realGesture(gesture))
}
onPositionChanged: {
......@@ -96,7 +112,7 @@ MouseArea {
}
onReleased: {
gestureFinished(gesture)
gestureFinished(Lipstick.compositor.homeActive ? gesture : realGesture(gesture))
if (!delayReset)
reset()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment