on xenial help sign in
try to change the resizing logic to allow clipping
067f4e1Michael Zanetti
plugins/WindowManager/TopLevelSurfaceList.cpp+1−1
@@ -135,7 +135,7 @@ void TopLevelSurfaceList::connectSurface(MirSurfaceInterface *surface)
135{
135{
136 connect(surface, &MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
136 connect(surface, &MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
137 if (focused) {
137 if (focused) {
138− this->raise(surface);
138+// this->raise(surface);
139 }
139 }
140 });
140 });
141 connect(surface, &MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
141 connect(surface, &MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
qml/Stages/ApplicationWindow.qml+26−20
@@ -191,6 +191,7 @@ FocusScope {
191
191
192 SurfaceContainer {
192 SurfaceContainer {
193 id: surfaceContainer
193 id: surfaceContainer
194+ anchors.fill: parent
194 requestedWidth: root.requestedWidth
195 requestedWidth: root.requestedWidth
195 requestedHeight: root.requestedHeight
196 requestedHeight: root.requestedHeight
196 surfaceOrientationAngle: application && application.rotatesWindowContents ? root.surfaceOrientationAngle : 0
197 surfaceOrientationAngle: application && application.rotatesWindowContents ? root.surfaceOrientationAngle : 0
@@ -216,27 +217,27 @@ FocusScope {
216 }
217 }
217 }
218 }
218
219
219− // SurfaceContainer size drives ApplicationWindow size
220+// // SurfaceContainer size drives ApplicationWindow size
220− Binding {
221+// Binding {
221− target: root; property: "width"
222+// target: root; property: "implicitWidth"
222− value: stateGroup.state === "surface" ? surfaceContainer.width : root.requestedWidth
223+// value: stateGroup.state === "surface" ? surfaceContainer.implicitWidth : root.requestedWidth
223− when: root.requestedWidth >= 0
224+// when: root.requestedWidth >= 0
224− }
225+// }
225− Binding {
226+// Binding {
226− target: root; property: "height"
227+// target: root; property: "implicitHeight"
227− value: stateGroup.state === "surface" ? surfaceContainer.height : root.requestedHeight
228+// value: stateGroup.state === "surface" ? surfaceContainer.implicitHeight : root.requestedHeight
228− when: root.requestedHeight >= 0
229+// when: root.requestedHeight >= 0
229− }
230+// }
230
231
231− // ApplicationWindow size drives SurfaceContainer size
232+// // ApplicationWindow size drives SurfaceContainer size
232− Binding {
233+// Binding {
233− target: surfaceContainer; property: "width"; value: root.width
234+// target: surfaceContainer; property: "width"; value: root.width
234− when: root.requestedWidth < 0
235+// when: root.requestedWidth < 0
235− }
236+// }
236− Binding {
237+// Binding {
237− target: surfaceContainer; property: "height"; value: root.height
238+// target: surfaceContainer; property: "height"; value: root.height
238− when: root.requestedHeight < 0
239+// when: root.requestedHeight < 0
239− }
240+// }
240
241
241 StateGroup {
242 StateGroup {
242 id: stateGroup
243 id: stateGroup
@@ -402,4 +403,9 @@ FocusScope {
402 ]
403 ]
403 }
404 }
404
405
406+ Rectangle {
407+ anchors.fill: parent
408+ color: "yellow"
409+ opacity: .4
410+ }
405}
411}
qml/Stages/DecoratedWindow.qml+6−3
@@ -23,8 +23,8 @@ import Unity.Application 0.1
23FocusScope {
23FocusScope {
24 id: root
24 id: root
25
25
26− width: applicationWindow.width
26+ implicitWidth: applicationWindow.width
27− height: (decorationShown ? decoration.height : 0) + applicationWindow.height
27+ implicitHeight: (decorationShown ? decoration.height : 0) + applicationWindow.implicitHeight
28
28
29 property alias application: applicationWindow.application
29 property alias application: applicationWindow.application
30 property alias surface: applicationWindow.surface
30 property alias surface: applicationWindow.surface
@@ -39,8 +39,9 @@ FocusScope {
39 property bool highlightShown: false
39 property bool highlightShown: false
40 property real shadowOpacity: 1
40 property real shadowOpacity: 1
41
41
42+ property alias resizeSurface: applicationWindow.resizeSurface
42 property alias requestedWidth: applicationWindow.requestedWidth
43 property alias requestedWidth: applicationWindow.requestedWidth
43− property real requestedHeight
44+ property alias requestedHeight: applicationWindow.requestedHeight
44
45
45 property alias minimumWidth: applicationWindow.minimumWidth
46 property alias minimumWidth: applicationWindow.minimumWidth
46 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
47 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
@@ -101,6 +102,8 @@ FocusScope {
101 anchors.top: parent.top
102 anchors.top: parent.top
102 anchors.topMargin: root.decorationShown ? decoration.height : 0
103 anchors.topMargin: root.decorationShown ? decoration.height : 0
103 anchors.left: parent.left
104 anchors.left: parent.left
105+ width: root.width
106+ height: root.height - anchors.topMargin
104 requestedHeight: root.requestedHeight
107 requestedHeight: root.requestedHeight
105 interactive: true
108 interactive: true
106 focus: true
109 focus: true
qml/Stages/DesktopStage.qml+38−9
@@ -291,8 +291,8 @@ AbstractStage {
291 x: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
291 x: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
292 y: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
292 y: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
293
293
294− width: decoratedWindow.width
294+ width: decoratedWindow.implicitWidth
295− height: decoratedWindow.height
295+ height: decoratedWindow.implicitHeight
296 property int requestedWidth: -1
296 property int requestedWidth: -1
297 property int requestedHeight: -1
297 property int requestedHeight: -1
298 property alias minimumWidth: decoratedWindow.minimumWidth
298 property alias minimumWidth: decoratedWindow.minimumWidth
@@ -486,8 +486,8 @@ AbstractStage {
486 StagedRightEdgeMaths {
486 StagedRightEdgeMaths {
487 id: stagedRightEdgeMaths
487 id: stagedRightEdgeMaths
488 itemIndex: index
488 itemIndex: index
489− sceneWidth: root.width
489+ sceneWidth: appContainer.width - root.leftMargin
490− sceneHeight: root.height
490+ sceneHeight: appContainer.height
491 progress: 0
491 progress: 0
492 targetX: spreadMaths.animatedX
492 targetX: spreadMaths.animatedX
493 targetAngle: spreadMaths.animatedAngle
493 targetAngle: spreadMaths.animatedAngle
@@ -507,7 +507,7 @@ AbstractStage {
507 }
507 }
508 ]
508 ]
509
509
510− onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
510+// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
511 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
511 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
512 states: [
512 states: [
513 State {
513 State {
@@ -517,8 +517,17 @@ AbstractStage {
517 y: spreadMaths.animatedY
517 y: spreadMaths.animatedY
518 z: index
518 z: index
519 angle: spreadMaths.animatedAngle
519 angle: spreadMaths.animatedAngle
520+ height: appDelegate.width
521+ }
522+ PropertyChanges {
523+ target: decoratedWindow;
524+ showDecoration: false;
525+ height: units.gu(15)
526+ width: units.gu(15)
527+ requestedWidth: decoratedWindow.oldRequestedWidth
528+ requestedHeight: decoratedWindow.oldRequestedHeight
529+// resizeSurface: false;
520 }
530 }
521− PropertyChanges { target: decoratedWindow; showDecoration: false }
522 PropertyChanges { target: inputBlocker; enabled: true }
531 PropertyChanges { target: inputBlocker; enabled: true }
523 },
532 },
524 State {
533 State {
@@ -531,12 +540,17 @@ AbstractStage {
531 target: appDelegate
540 target: appDelegate
532 y: PanelState.panelHeight
541 y: PanelState.panelHeight
533 x: stagedRightEdgeMaths.animatedX
542 x: stagedRightEdgeMaths.animatedX
534− requestedWidth: stagedRightEdgeMaths.animatedWidth
535− requestedHeight: stagedRightEdgeMaths.animatedHeight
536 angle: stagedRightEdgeMaths.animatedAngle
543 angle: stagedRightEdgeMaths.animatedAngle
537 z: index
544 z: index
538 }
545 }
546+ PropertyChanges {
539− PropertyChanges { target: decoratedWindow; showDecoration: false }
547+ target: decoratedWindow;
548+ showDecoration: false
549+ requestedWidth: stagedRightEdgeMaths.animatedWidth
550+ requestedHeight: stagedRightEdgeMaths.animatedHeight
551+ width: appContainer.width - root.leftMargin
552+ height: appContainer.height
553+ }
540 },
554 },
541 State {
555 State {
542 name: "staged"; when: root.state == "staged"
556 name: "staged"; when: root.state == "staged"
@@ -549,6 +563,8 @@ AbstractStage {
549 target: decoratedWindow
563 target: decoratedWindow
550 requestedWidth: appContainer.width - root.leftMargin;
564 requestedWidth: appContainer.width - root.leftMargin;
551 requestedHeight: appContainer.height;
565 requestedHeight: appContainer.height;
566+ width: requestedWidth
567+ height: requestedHeight
552 showDecoration: false
568 showDecoration: false
553 }
569 }
554 PropertyChanges {
570 PropertyChanges {
@@ -747,6 +763,11 @@ AbstractStage {
747 requestedWidth: appDelegate.requestedWidth
763 requestedWidth: appDelegate.requestedWidth
748 requestedHeight: appDelegate.requestedHeight
764 requestedHeight: appDelegate.requestedHeight
749
765
766+ property int oldRequestedWidth: -1
767+ property int oldRequestedHeight: -1
768+ onRequestedWidthChanged: oldRequestedWidth = requestedWidth
769+ onRequestedHeightChanged: oldRequestedHeight = requestedHeight
770+
750 onClose: { appDelegate.close(); }
771 onClose: { appDelegate.close(); }
751 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
772 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
752 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
773 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
@@ -765,12 +786,20 @@ AbstractStage {
765
786
766 MouseArea {
787 MouseArea {
767 id: inputBlocker
788 id: inputBlocker
789+ anchors.fill: parent
768 enabled: false
790 enabled: false
791+ onPressed: mouse.accepted = true;
769 onClicked: {
792 onClicked: {
770 print("focusing because of inputBlocker click")
793 print("focusing because of inputBlocker click")
771 appDelegate.focus = true
794 appDelegate.focus = true
795+ priv.goneToSpread = false;
772 }
796 }
773 }
797 }
798+ Rectangle {
799+ anchors.fill: parent
800+ color: "blue"
801+ opacity: .4
802+ }
774 }
803 }
775 }
804 }
776 }
805 }
qml/Stages/SurfaceContainer.qml+30−25
@@ -55,35 +55,40 @@ FocusScope {
55 MirSurfaceItem {
55 MirSurfaceItem {
56 id: surfaceItem
56 id: surfaceItem
57 objectName: "surfaceItem"
57 objectName: "surfaceItem"
58+ anchors.fill: parent
58
59
59 focus: true
60 focus: true
60
61
61 fillMode: MirSurfaceItem.PadOrCrop
62 fillMode: MirSurfaceItem.PadOrCrop
62 consumesInput: true
63 consumesInput: true
63
64
64− surfaceWidth: {
65+ surfaceWidth: root.requestedWidth
66+ surfaceHeight: root.requestedHeight
67+// surfaceWidth: {
68+// print("surfaceWidth:", model.application.appId, root.resizeSurface, root.requestedWidth, width)
65− if (root.resizeSurface) {
69+// if (root.resizeSurface) {
66− if (root.requestedWidth >= 0) {
70+// if (root.requestedWidth >= 0) {
67− return root.requestedWidth;
71+// return root.requestedWidth;
68− } else {
72+// } else {
69− return width;
73+// return width;
70− }
74+// }
71− } else {
75+// } else {
72− return -1;
76+// return -1;
73− }
77+// }
74− }
78+// }
75−
79+
76− surfaceHeight: {
80+// surfaceHeight: {
81+// print("surfaceHeight:", model.application.appId, root.resizeSurface, root.requestedHeight, height)
77− if (root.resizeSurface) {
82+// if (root.resizeSurface) {
78− if (root.requestedHeight >= 0) {
83+// if (root.requestedHeight >= 0) {
79− return root.requestedHeight;
84+// return root.requestedHeight;
80− } else {
85+// } else {
81− return height;
86+// return height;
82− }
87+// }
83− } else {
88+// } else {
84− return -1;
89+// return -1;
85− }
90+// }
86− }
91+// }
87
92
88 enabled: root.interactive
93 enabled: root.interactive
89 antialiasing: !root.interactive
94 antialiasing: !root.interactive
@@ -106,11 +111,11 @@ FocusScope {
106 when: root.requestedHeight >= 0 && root.surface
111 when: root.requestedHeight >= 0 && root.surface
107 }
112 }
108 Binding {
113 Binding {
109− target: root; property: "width"; value: surfaceItem.width
114+ target: root; property: "implicitWidth"; value: surfaceItem.width
110 when: root.requestedWidth >= 0
115 when: root.requestedWidth >= 0
111 }
116 }
112 Binding {
117 Binding {
113− target: root; property: "height"; value: surfaceItem.height
118+ target: root; property: "implicitHeight"; value: surfaceItem.height
114 when: root.requestedHeight >= 0
119 when: root.requestedHeight >= 0
115 }
120 }
116
121