@@ -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.