on xenial help sign in
address review comments
5d97ac9Lukáš Tinkl
plugins/Utils/windowstatestorage.h+1−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2015 Canonical Ltd.
2+ * Copyright 2015-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
5 * it under the terms of the GNU Lesser General Public License as published by
qml/Stages/DesktopStage.qml+12−6
@@ -372,16 +372,20 @@ AbstractStage {
372 animationsEnabled = (animated === undefined) || animated;
372 animationsEnabled = (animated === undefined) || animated;
373 windowState = WindowStateStorage.WindowStateMaximized;
373 windowState = WindowStateStorage.WindowStateMaximized;
374 }
374 }
375− function maximizeLeft() {
375+ function maximizeLeft(animated) {
376+ animationsEnabled = (animated === undefined) || animated;
376 windowState = WindowStateStorage.WindowStateMaximizedLeft;
377 windowState = WindowStateStorage.WindowStateMaximizedLeft;
377 }
378 }
378− function maximizeRight() {
379+ function maximizeRight(animated) {
380+ animationsEnabled = (animated === undefined) || animated;
379 windowState = WindowStateStorage.WindowStateMaximizedRight;
381 windowState = WindowStateStorage.WindowStateMaximizedRight;
380 }
382 }
381− function maximizeHorizontally() {
383+ function maximizeHorizontally(animated) {
384+ animationsEnabled = (animated === undefined) || animated;
382 windowState = WindowStateStorage.WindowStateMaximizedHorizontally;
385 windowState = WindowStateStorage.WindowStateMaximizedHorizontally;
383 }
386 }
384− function maximizeVertically() {
387+ function maximizeVertically(animated) {
388+ animationsEnabled = (animated === undefined) || animated;
385 windowState = WindowStateStorage.WindowStateMaximizedVertically;
389 windowState = WindowStateStorage.WindowStateMaximizedVertically;
386 }
390 }
387 function minimize(animated) {
391 function minimize(animated) {
@@ -485,11 +489,13 @@ AbstractStage {
485 },
489 },
486 State {
490 State {
487 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
491 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
488− PropertyChanges { target: appDelegate; x: root.leftMargin; requestedWidth: appContainer.width - root.leftMargin }
492+ PropertyChanges { target: appDelegate; x: root.leftMargin }
493+ PropertyChanges { target: decoratedWindow; requestedWidth: appContainer.width - root.leftMargin }
489 },
494 },
490 State {
495 State {
491 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
496 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
492− PropertyChanges { target: appDelegate; y: PanelState.panelHeight; requestedHeight: appContainer.height - PanelState.panelHeight }
497+ PropertyChanges { target: appDelegate; y: PanelState.panelHeight }
498+ PropertyChanges { target: decoratedWindow; requestedHeight: appContainer.height - PanelState.panelHeight }
493 },
499 },
494 State {
500 State {
495 name: "minimized"; when: appDelegate.minimized
501 name: "minimized"; when: appDelegate.minimized
qml/Stages/WindowDecoration.qml+1−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014-2015 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
qml/Stages/WindowResizeArea.qml+19−10
@@ -81,16 +81,25 @@ MouseArea {
81 target.y = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
81 target.y = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
82
82
83 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
83 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
84+ switch (windowState) {
84− if (windowState === WindowStateStorage.WindowStateMaximized) {
85+ case WindowStateStorage.WindowStateMaximized:
85− target.maximize(false);
86+ target.maximize(false);
87+ break;
86− } else if (windowState === WindowStateStorage.WindowStateMaximizedLeft) {
88+ case WindowStateStorage.WindowStateMaximizedLeft:
87− target.maximizeLeft();
89+ target.maximizeLeft(false);
90+ break;
88− } else if (windowState === WindowStateStorage.WindowStateMaximizedRight) {
91+ case WindowStateStorage.WindowStateMaximizedRight:
89− target.maximizeRight();
92+ target.maximizeRight(false);
93+ break;
90− } else if (windowState === WindowStateStorage.WindowStateMaximizedHorizontally) {
94+ case WindowStateStorage.WindowStateMaximizedHorizontally:
91− target.maximizeHorizontally();
95+ target.maximizeHorizontally(false);
96+ break;
92− } else if (windowState === WindowStateStorage.WindowStateMaximizedVertically) {
97+ case WindowStateStorage.WindowStateMaximizedVertically:
93− target.maximizeVertically();
98+ target.maximizeVertically(false);
99+ break;
100+ default:
101+ console.warn("Unsupported window state");
102+ break;
94 }
103 }
95
104
96 priv.updateNormalGeometry();
105 priv.updateNormalGeometry();
tests/mocks/Utils/windowstatestorage.h+1−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2015 Canonical Ltd.
2+ * Copyright 2015-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
5 * it under the terms of the GNU Lesser General Public License as published by
tests/qmltests/Stages/tst_DesktopStage.qml−6
@@ -464,9 +464,6 @@ Item {
464 function test_windowMaximizeHorizontally() {
464 function test_windowMaximizeHorizontally() {
465 var dialerDelegate = startApplication("dialer-app");
465 var dialerDelegate = startApplication("dialer-app");
466
466
467− tryCompareFunction(function(){ return dialerDelegate.surface !== null; }, true);
468− tryCompare(dialerDelegate, "focus", true);
469−
470 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
467 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
471 verify(dialerMaximizeButton);
468 verify(dialerMaximizeButton);
472
469
@@ -482,9 +479,6 @@ Item {
482 function test_windowMaximizeVertically() {
479 function test_windowMaximizeVertically() {
483 var dialerDelegate = startApplication("dialer-app");
480 var dialerDelegate = startApplication("dialer-app");
484
481
485− tryCompareFunction(function(){ return dialerDelegate.surface !== null; }, true);
486− tryCompare(dialerDelegate, "focus", true);
487−
488 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
482 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
489 verify(dialerMaximizeButton);
483 verify(dialerMaximizeButton);
490
484