on xenial help sign in
[Stage] Make sure we send screenOffsets to mir

This makes sure we send screenOffsets to mir, if not mir belives we are on the screen at pos 0,0 regardless of what screen we are on. This will also make per-screen-scaling work correctly! :D This fixes: https://github.com/ubports/ubuntu-touch/issues/1095

commitb489e46d476c620122d8155362da944f86beb5b5 authorMarius Gripsgard <marius@ubports.com> dateFri 20 Dec 2019, 05:44 (7 years ago) parentbe956d1
1 file changed+22−4
qml/Stage/Stage.qml+22−4
qml/Stage/Stage.qml+22−4
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.4
18+import QtQuick.Window 2.2
1819import Ubuntu.Components 1.3
1920import Unity.Application 0.1
2021import "../Components/PanelState"
@@ -787,11 +788,19 @@ FocusScope {
787788 }
788789 z: normalZ
789790
791+ // Set these as propertyes as they wont update otherwise
792+ property real screenOffsetX: Screen.virtualX
793+ property real screenOffsetY: Screen.virtualY
794+
790795 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
791796 // match what the actual surface size is.
792797 // Don't write to those, they will be set by states
793− x: model.window.position.x - clientAreaItem.x
794− y: model.window.position.y - clientAreaItem.y
798+ // --
799+ // Here we will also need to remove the screen offset from miral's results
800+ // as unity8 x,y will be relative to the current screen only
801+ // FIXME: when proper multiscreen lands
802+ x: model.window.position.x - clientAreaItem.x - screenOffsetX
803+ y: model.window.position.y - clientAreaItem.y - screenOffsetY
795804 width: decoratedWindow.implicitWidth
796805 height: decoratedWindow.implicitHeight
797806
@@ -801,13 +810,22 @@ FocusScope {
801810 property real requestedY: windowedY
802811 property real requestedWidth: windowedWidth
803812 property real requestedHeight: windowedHeight
813+
814+ // For both windowed and staged need to tell miral what screen we are on,
815+ // so we need to add the screen offset to the position we tell miral
816+ // FIXME: when proper multiscreen lands
804817 Binding {
805818 target: model.window; property: "requestedPosition"
806819 // miral doesn't know about our window decorations. So we have to deduct them
807− value: Qt.point(appDelegate.requestedX + appDelegate.clientAreaItem.x,
808− appDelegate.requestedY + appDelegate.clientAreaItem.y)
820+ value: Qt.point(appDelegate.requestedX + appDelegate.clientAreaItem.x + screenOffsetX,
821+ appDelegate.requestedY + appDelegate.clientAreaItem.y + screenOffsetY)
809822 when: root.mode == "windowed"
810823 }
824+ Binding {
825+ target: model.window; property: "requestedPosition"
826+ value: Qt.point(screenOffsetX, screenOffsetY)
827+ when: root.mode != "windowed"
828+ }
811829
812830 // In those are for windowed mode. Those values basically store the window's properties
813831 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.