on xenial help sign in
try to change the resizing logic to allow clipping
commit067f4e1b177beb6d76126098631126cda7c77c20 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 1 Jun 2016, 18:31 (10 years ago) parent26abde6
5 files changed+101−58
plugins/WindowManager/TopLevelSurfaceList.cpp+1−1 qml/Stages/ApplicationWindow.qml+26−20 qml/Stages/DecoratedWindow.qml+6−3 qml/Stages/DesktopStage.qml+38−9 qml/Stages/SurfaceContainer.qml+30−25
plugins/WindowManager/TopLevelSurfaceList.cpp+1−1
@@ -135,7 +135,7 @@ void TopLevelSurfaceList::connectSurface(MirSurfaceInterface *surface)
135135{
136136 connect(surface, &MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
137137 if (focused) {
138− this->raise(surface);
138+// this->raise(surface);
139139 }
140140 });
141141 connect(surface, &MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
qml/Stages/ApplicationWindow.qml+26−20
@@ -191,6 +191,7 @@ FocusScope {
191191
192192 SurfaceContainer {
193193 id: surfaceContainer
194+ anchors.fill: parent
194195 requestedWidth: root.requestedWidth
195196 requestedHeight: root.requestedHeight
196197 surfaceOrientationAngle: application && application.rotatesWindowContents ? root.surfaceOrientationAngle : 0
@@ -216,27 +217,27 @@ FocusScope {
216217 }
217218 }
218219
219− // SurfaceContainer size drives ApplicationWindow size
220− Binding {
221− target: root; property: "width"
222− value: stateGroup.state === "surface" ? surfaceContainer.width : root.requestedWidth
223− when: root.requestedWidth >= 0
224− }
225− Binding {
226− target: root; property: "height"
227− value: stateGroup.state === "surface" ? surfaceContainer.height : root.requestedHeight
228− when: root.requestedHeight >= 0
229− }
220+// // SurfaceContainer size drives ApplicationWindow size
221+// Binding {
222+// target: root; property: "implicitWidth"
223+// value: stateGroup.state === "surface" ? surfaceContainer.implicitWidth : root.requestedWidth
224+// when: root.requestedWidth >= 0
225+// }
226+// Binding {
227+// target: root; property: "implicitHeight"
228+// value: stateGroup.state === "surface" ? surfaceContainer.implicitHeight : root.requestedHeight
229+// when: root.requestedHeight >= 0
230+// }
230231
231− // ApplicationWindow size drives SurfaceContainer size
232− Binding {
233− target: surfaceContainer; property: "width"; value: root.width
234− when: root.requestedWidth < 0
235− }
236− Binding {
237− target: surfaceContainer; property: "height"; value: root.height
238− when: root.requestedHeight < 0
239− }
232+// // ApplicationWindow size drives SurfaceContainer size
233+// Binding {
234+// target: surfaceContainer; property: "width"; value: root.width
235+// when: root.requestedWidth < 0
236+// }
237+// Binding {
238+// target: surfaceContainer; property: "height"; value: root.height
239+// when: root.requestedHeight < 0
240+// }
240241
241242 StateGroup {
242243 id: stateGroup
@@ -402,4 +403,9 @@ FocusScope {
402403 ]
403404 }
404405
406+ Rectangle {
407+ anchors.fill: parent
408+ color: "yellow"
409+ opacity: .4
410+ }
405411}
qml/Stages/DecoratedWindow.qml+6−3
@@ -23,8 +23,8 @@ import Unity.Application 0.1
2323FocusScope {
2424 id: root
2525
26− width: applicationWindow.width
27− height: (decorationShown ? decoration.height : 0) + applicationWindow.height
26+ implicitWidth: applicationWindow.width
27+ implicitHeight: (decorationShown ? decoration.height : 0) + applicationWindow.implicitHeight
2828
2929 property alias application: applicationWindow.application
3030 property alias surface: applicationWindow.surface
@@ -39,8 +39,9 @@ FocusScope {
3939 property bool highlightShown: false
4040 property real shadowOpacity: 1
4141
42+ property alias resizeSurface: applicationWindow.resizeSurface
4243 property alias requestedWidth: applicationWindow.requestedWidth
43− property real requestedHeight
44+ property alias requestedHeight: applicationWindow.requestedHeight
4445
4546 property alias minimumWidth: applicationWindow.minimumWidth
4647 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
@@ -101,6 +102,8 @@ FocusScope {
101102 anchors.top: parent.top
102103 anchors.topMargin: root.decorationShown ? decoration.height : 0
103104 anchors.left: parent.left
105+ width: root.width
106+ height: root.height - anchors.topMargin
104107 requestedHeight: root.requestedHeight
105108 interactive: true
106109 focus: true
qml/Stages/DesktopStage.qml+38−9
@@ -291,8 +291,8 @@ AbstractStage {
291291 x: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
292292 y: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
293293
294− width: decoratedWindow.width
295− height: decoratedWindow.height
294+ width: decoratedWindow.implicitWidth
295+ height: decoratedWindow.implicitHeight
296296 property int requestedWidth: -1
297297 property int requestedHeight: -1
298298 property alias minimumWidth: decoratedWindow.minimumWidth
@@ -486,8 +486,8 @@ AbstractStage {
486486 StagedRightEdgeMaths {
487487 id: stagedRightEdgeMaths
488488 itemIndex: index
489− sceneWidth: root.width
490− sceneHeight: root.height
489+ sceneWidth: appContainer.width - root.leftMargin
490+ sceneHeight: appContainer.height
491491 progress: 0
492492 targetX: spreadMaths.animatedX
493493 targetAngle: spreadMaths.animatedAngle
@@ -507,7 +507,7 @@ AbstractStage {
507507 }
508508 ]
509509
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)
511511 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
512512 states: [
513513 State {
@@ -517,8 +517,17 @@ AbstractStage {
517517 y: spreadMaths.animatedY
518518 z: index
519519 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;
520530 }
521− PropertyChanges { target: decoratedWindow; showDecoration: false }
522531 PropertyChanges { target: inputBlocker; enabled: true }
523532 },
524533 State {
@@ -531,12 +540,17 @@ AbstractStage {
531540 target: appDelegate
532541 y: PanelState.panelHeight
533542 x: stagedRightEdgeMaths.animatedX
534− requestedWidth: stagedRightEdgeMaths.animatedWidth
535− requestedHeight: stagedRightEdgeMaths.animatedHeight
536543 angle: stagedRightEdgeMaths.animatedAngle
537544 z: index
538545 }
539− PropertyChanges { target: decoratedWindow; showDecoration: false }
546+ PropertyChanges {
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+ }
540554 },
541555 State {
542556 name: "staged"; when: root.state == "staged"
@@ -549,6 +563,8 @@ AbstractStage {
549563 target: decoratedWindow
550564 requestedWidth: appContainer.width - root.leftMargin;
551565 requestedHeight: appContainer.height;
566+ width: requestedWidth
567+ height: requestedHeight
552568 showDecoration: false
553569 }
554570 PropertyChanges {
@@ -747,6 +763,11 @@ AbstractStage {
747763 requestedWidth: appDelegate.requestedWidth
748764 requestedHeight: appDelegate.requestedHeight
749765
766+ property int oldRequestedWidth: -1
767+ property int oldRequestedHeight: -1
768+ onRequestedWidthChanged: oldRequestedWidth = requestedWidth
769+ onRequestedHeightChanged: oldRequestedHeight = requestedHeight
770+
750771 onClose: { appDelegate.close(); }
751772 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
752773 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
@@ -765,12 +786,20 @@ AbstractStage {
765786
766787 MouseArea {
767788 id: inputBlocker
789+ anchors.fill: parent
768790 enabled: false
791+ onPressed: mouse.accepted = true;
769792 onClicked: {
770793 print("focusing because of inputBlocker click")
771794 appDelegate.focus = true
795+ priv.goneToSpread = false;
772796 }
773797 }
798+ Rectangle {
799+ anchors.fill: parent
800+ color: "blue"
801+ opacity: .4
802+ }
774803 }
775804 }
776805 }
qml/Stages/SurfaceContainer.qml+30−25
@@ -55,35 +55,40 @@ FocusScope {
5555 MirSurfaceItem {
5656 id: surfaceItem
5757 objectName: "surfaceItem"
58+ anchors.fill: parent
5859
5960 focus: true
6061
6162 fillMode: MirSurfaceItem.PadOrCrop
6263 consumesInput: true
6364
64− surfaceWidth: {
65− if (root.resizeSurface) {
66− if (root.requestedWidth >= 0) {
67− return root.requestedWidth;
68− } else {
69− return width;
70− }
71− } else {
72− return -1;
73− }
74− }
75−
76− surfaceHeight: {
77− if (root.resizeSurface) {
78− if (root.requestedHeight >= 0) {
79− return root.requestedHeight;
80− } else {
81− return height;
82− }
83− } else {
84− return -1;
85− }
86− }
65+ surfaceWidth: root.requestedWidth
66+ surfaceHeight: root.requestedHeight
67+// surfaceWidth: {
68+// print("surfaceWidth:", model.application.appId, root.resizeSurface, root.requestedWidth, width)
69+// if (root.resizeSurface) {
70+// if (root.requestedWidth >= 0) {
71+// return root.requestedWidth;
72+// } else {
73+// return width;
74+// }
75+// } else {
76+// return -1;
77+// }
78+// }
79+
80+// surfaceHeight: {
81+// print("surfaceHeight:", model.application.appId, root.resizeSurface, root.requestedHeight, height)
82+// if (root.resizeSurface) {
83+// if (root.requestedHeight >= 0) {
84+// return root.requestedHeight;
85+// } else {
86+// return height;
87+// }
88+// } else {
89+// return -1;
90+// }
91+// }
8792
8893 enabled: root.interactive
8994 antialiasing: !root.interactive
@@ -106,11 +111,11 @@ FocusScope {
106111 when: root.requestedHeight >= 0 && root.surface
107112 }
108113 Binding {
109− target: root; property: "width"; value: surfaceItem.width
114+ target: root; property: "implicitWidth"; value: surfaceItem.width
110115 when: root.requestedWidth >= 0
111116 }
112117 Binding {
113− target: root; property: "height"; value: surfaceItem.height
118+ target: root; property: "implicitHeight"; value: surfaceItem.height
114119 when: root.requestedHeight >= 0
115120 }
116121