on xenial help sign in
[Stage] Make sure we send screenOffsets to mir
b489e46Marius Gripsgard
qml/Stage/Stage.qml+22−4
@@ -15,6 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18+import QtQuick.Window 2.2
18import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
19import Unity.Application 0.1
20import Unity.Application 0.1
20import "../Components/PanelState"
21import "../Components/PanelState"
@@ -787,11 +788,19 @@ FocusScope {
787 }
788 }
788 z: normalZ
789 z: normalZ
789
790
791+ // Set these as propertyes as they wont update otherwise
792+ property real screenOffsetX: Screen.virtualX
793+ property real screenOffsetY: Screen.virtualY
794+
790 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
795 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
791 // match what the actual surface size is.
796 // match what the actual surface size is.
792 // Don't write to those, they will be set by states
797 // Don't write to those, they will be set by states
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
793− x: model.window.position.x - clientAreaItem.x
802+ x: model.window.position.x - clientAreaItem.x - screenOffsetX
794− y: model.window.position.y - clientAreaItem.y
803+ y: model.window.position.y - clientAreaItem.y - screenOffsetY
795 width: decoratedWindow.implicitWidth
804 width: decoratedWindow.implicitWidth
796 height: decoratedWindow.implicitHeight
805 height: decoratedWindow.implicitHeight
797
806
@@ -801,13 +810,22 @@ FocusScope {
801 property real requestedY: windowedY
810 property real requestedY: windowedY
802 property real requestedWidth: windowedWidth
811 property real requestedWidth: windowedWidth
803 property real requestedHeight: windowedHeight
812 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
804 Binding {
817 Binding {
805 target: model.window; property: "requestedPosition"
818 target: model.window; property: "requestedPosition"
806 // miral doesn't know about our window decorations. So we have to deduct them
819 // miral doesn't know about our window decorations. So we have to deduct them
807− value: Qt.point(appDelegate.requestedX + appDelegate.clientAreaItem.x,
820+ value: Qt.point(appDelegate.requestedX + appDelegate.clientAreaItem.x + screenOffsetX,
808− appDelegate.requestedY + appDelegate.clientAreaItem.y)
821+ appDelegate.requestedY + appDelegate.clientAreaItem.y + screenOffsetY)
809 when: root.mode == "windowed"
822 when: root.mode == "windowed"
810 }
823 }
824+ Binding {
825+ target: model.window; property: "requestedPosition"
826+ value: Qt.point(screenOffsetX, screenOffsetY)
827+ when: root.mode != "windowed"
828+ }
811
829
812 // In those are for windowed mode. Those values basically store the window's properties
830 // In those are for windowed mode. Those values basically store the window's properties
813 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
831 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.