on xenial help sign in
only rotate the surface, not the whole item
7aff6f1Michael Zanetti
qml/Stages/DesktopStage.qml+26−28
@@ -127,6 +127,7 @@ AbstractStage {
127 property var foregroundMaximizedAppDelegate: null // for stuff like drop shadow and focusing maximized app by clicking panel
127 property var foregroundMaximizedAppDelegate: null // for stuff like drop shadow and focusing maximized app by clicking panel
128
128
129 property bool goneToSpread: false
129 property bool goneToSpread: false
130+ property int animationDuration: UbuntuAnimation.SleepyDuration
130
131
131 function updateForegroundMaximizedApp() {
132 function updateForegroundMaximizedApp() {
132 var found = false;
133 var found = false;
@@ -324,8 +325,6 @@ AbstractStage {
324
325
325 readonly property var surface: model.surface
326 readonly property var surface: model.surface
326
327
327− property real angle: 0
328−
329 function claimFocus() {
328 function claimFocus() {
330// if (spread.state == "altTab") {
329// if (spread.state == "altTab") {
331// spread.cancel();
330// spread.cancel();
@@ -493,40 +492,26 @@ AbstractStage {
493 targetAngle: spreadMaths.animatedAngle
492 targetAngle: spreadMaths.animatedAngle
494 }
493 }
495
494
496− transform: [
497− Scale {
498− origin.x: itemScaleOriginX
499− origin.y: itemScaleOriginY
500− xScale: itemScale
501− yScale: itemScale
502− },
503− Rotation {
504−// origin { x: 0; y: (clippedSpreadDelegate.height - (clippedSpreadDelegate.height * itemScale / 2)) }
505− axis { x: 0; y: 1; z: 0 }
506− angle: appDelegate.angle
507− }
508− ]
509−
510// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
495// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
511 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
496 onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
512 states: [
497 states: [
513 State {
498 State {
514 name: "spread"; when: root.state == "spread"
499 name: "spread"; when: root.state == "spread"
500+ PropertyChanges {
515− PropertyChanges { target: appDelegate;
501+ target: appDelegate;
516 x: spreadMaths.animatedX
502 x: spreadMaths.animatedX
517 y: spreadMaths.animatedY
503 y: spreadMaths.animatedY
518 z: index
504 z: index
519− angle: spreadMaths.animatedAngle
505+ height: appContainer.height
520− height: appDelegate.width
521 }
506 }
522 PropertyChanges {
507 PropertyChanges {
523 target: decoratedWindow;
508 target: decoratedWindow;
524 showDecoration: false;
509 showDecoration: false;
525 height: units.gu(15)
510 height: units.gu(15)
526 width: units.gu(15)
511 width: units.gu(15)
512+ angle: spreadMaths.animatedAngle
527 requestedWidth: decoratedWindow.oldRequestedWidth
513 requestedWidth: decoratedWindow.oldRequestedWidth
528 requestedHeight: decoratedWindow.oldRequestedHeight
514 requestedHeight: decoratedWindow.oldRequestedHeight
529−// resizeSurface: false;
530 }
515 }
531 PropertyChanges { target: inputBlocker; enabled: true }
516 PropertyChanges { target: inputBlocker; enabled: true }
532 },
517 },
@@ -540,7 +525,6 @@ AbstractStage {
540 target: appDelegate
525 target: appDelegate
541 y: PanelState.panelHeight
526 y: PanelState.panelHeight
542 x: stagedRightEdgeMaths.animatedX
527 x: stagedRightEdgeMaths.animatedX
543− angle: stagedRightEdgeMaths.animatedAngle
544 z: index
528 z: index
545 }
529 }
546 PropertyChanges {
530 PropertyChanges {
@@ -550,6 +534,7 @@ AbstractStage {
550 requestedHeight: stagedRightEdgeMaths.animatedHeight
534 requestedHeight: stagedRightEdgeMaths.animatedHeight
551 width: appContainer.width - root.leftMargin
535 width: appContainer.width - root.leftMargin
552 height: appContainer.height
536 height: appContainer.height
537+ angle: stagedRightEdgeMaths.animatedAngle
553 }
538 }
554 },
539 },
555 State {
540 State {
@@ -693,19 +678,17 @@ AbstractStage {
693 },
678 },
694 Transition {
679 Transition {
695 to: "spread"
680 to: "spread"
696− PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
681+ PropertyAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
682+ PropertyAnimation { target: decoratedWindow; properties: "width,height,angle"; duration: priv.animationDuration }
697 },
683 },
698 Transition {
684 Transition {
699 from: "spread"; to: "staged"
685 from: "spread"; to: "staged"
700− PropertyAnimation {
686+ PropertyAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
701− target: appDelegate
687+ PropertyAnimation { target: decoratedWindow; properties: "angle,width,height"; duration: priv.animationDuration }
702− properties: "x,y,angle"
703− duration: 4000
704− }
705 },
688 },
706 Transition { // Ordering is important. This generic case needs to be after spread -> staged
689 Transition { // Ordering is important. This generic case needs to be after spread -> staged
707 to: "staged";
690 to: "staged";
708− PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
691+ PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: priv.animationDuration }
709 }
692 }
710 ]
693 ]
711
694
@@ -781,6 +764,21 @@ AbstractStage {
781 print("***** focusing because of decoration press", model.application.appId)
764 print("***** focusing because of decoration press", model.application.appId)
782 appDelegate.focus = true;
765 appDelegate.focus = true;
783 }
766 }
767+
768+ property real angle: 0
769+ transform: [
770+// Scale {
771+// origin.x: itemScaleOriginX
772+// origin.y: itemScaleOriginY
773+// xScale: itemScale
774+// yScale: itemScale
775+// },
776+ Rotation {
777+ // origin { x: 0; y: (clippedSpreadDelegate.height - (clippedSpreadDelegate.height * itemScale / 2)) }
778+ axis { x: 0; y: 1; z: 0 }
779+ angle: decoratedWindow.angle
780+ }
781+ ]
784 }
782 }
785
783
786 WindowedFullscreenPolicy {
784 WindowedFullscreenPolicy {
qml/Stages/SurfaceContainer.qml−10
@@ -44,16 +44,6 @@ FocusScope {
44 surfaceItem.surface = surface;
44 surfaceItem.surface = surface;
45 }
45 }
46
46
47− onImplicitWidthChanged: print("implicit width changed", implicitWidth)
48− onImplicitHeightChanged: print("implicit height changed", implicitHeight)
49−
50− Timer {
51− interval: 1000
52− repeat: true
53− running: true
54− onTriggered: print("implicit size:", root.implicitWidth, root.implicitHeight)
55− }
56−
57 InputWatcher {
47 InputWatcher {
58 target: surfaceItem
48 target: surfaceItem
59 onTargetPressedChanged: {
49 onTargetPressedChanged: {
tests/mocks/Unity/Application/MirSurfaceItem.cpp+5
@@ -319,6 +319,7 @@ int MirSurfaceItem::surfaceWidth() const
319
319
320void MirSurfaceItem::setSurfaceWidth(int value)
320void MirSurfaceItem::setSurfaceWidth(int value)
321{
321{
322+ qDebug() << "setSurfaceWidth called" << value;
322 if (value != -1 && m_surfaceWidth != value) {
323 if (value != -1 && m_surfaceWidth != value) {
323 m_surfaceWidth = value;
324 m_surfaceWidth = value;
324 Q_EMIT surfaceWidthChanged(m_surfaceWidth);
325 Q_EMIT surfaceWidthChanged(m_surfaceWidth);
@@ -344,6 +345,10 @@ void MirSurfaceItem::updateSurfaceSize()
344{
345{
345 if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
346 if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
346 m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
347 m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
348+ if (m_qmlItem) {
349+ m_qmlItem->setWidth(m_surfaceWidth);
350+ m_qmlItem->setHeight(m_surfaceHeight);
351+ }
347 setImplicitSize(m_surfaceWidth, m_surfaceHeight);
352 setImplicitSize(m_surfaceWidth, m_surfaceHeight);
348 }
353 }
349}
354}