Commit 27f5084a authored by Filip Matijević's avatar Filip Matijević

[rotation] fix reported gesture when swiping away from apps

parent 38b043ff
...@@ -152,7 +152,7 @@ Compositor { ...@@ -152,7 +152,7 @@ Compositor {
if (gestureArea.progress >= swipeThreshold) { if (gestureArea.progress >= swipeThreshold) {
swipeAnimation.valueTo = inverted ? -max : max swipeAnimation.valueTo = inverted ? -max : max
swipeAnimation.start() swipeAnimation.start()
if (gestureArea.gesture == "down") { if (gesture == "down") {
Lipstick.compositor.closeClientForWindowId(topmostWindow.window.windowId) Lipstick.compositor.closeClientForWindowId(topmostWindow.window.windowId)
} }
} else { } else {
...@@ -160,7 +160,7 @@ Compositor { ...@@ -160,7 +160,7 @@ Compositor {
} }
} else if (root.homeActive){ } else if (root.homeActive){
if (gestureArea.progress >= lockThreshold) { if (gestureArea.progress >= lockThreshold) {
lockAnimation.valueTo = (gestureArea.gesture == "left" ? lockAnimation.valueTo = (gesture == "left" ?
Desktop.instance.lockscreen.width : Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.width) -Desktop.instance.lockscreen.width)
lockAnimation.start() lockAnimation.start()
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
// SOFTWARE. // SOFTWARE.
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Window 2.0
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
MouseArea { MouseArea {
...@@ -44,11 +45,26 @@ MouseArea { ...@@ -44,11 +45,26 @@ MouseArea {
// Internal // Internal
property int _mouseStart property int _mouseStart
property Item _mapTo: Lipstick.compositor.homeActive ? Lipstick.compositor.topmostWindow.window : parent property Item _mapTo: Lipstick.compositor.homeActive ? Lipstick.compositor.topmostWindow.window : parent
property variant _gestures: ["down", "left", "up", "right"]
function mouseToMouseReal(m) { function mouseToMouseReal(m) {
return mapToItem(_mapTo, m.x, m.y) 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: { onPressed: {
var mouseReal = mouseToMouseReal(mouse) var mouseReal = mouseToMouseReal(mouse)
...@@ -75,7 +91,7 @@ MouseArea { ...@@ -75,7 +91,7 @@ MouseArea {
else else
_mouseStart = mouseReal.y _mouseStart = mouseReal.y
gestureStarted(gesture) gestureStarted(Lipstick.compositor.homeActive ? gesture : realGesture(gesture))
} }
onPositionChanged: { onPositionChanged: {
...@@ -96,7 +112,7 @@ MouseArea { ...@@ -96,7 +112,7 @@ MouseArea {
} }
onReleased: { onReleased: {
gestureFinished(gesture) gestureFinished(Lipstick.compositor.homeActive ? gesture : realGesture(gesture))
if (!delayReset) if (!delayReset)
reset() 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