on xenial help sign in
address review comments
commit5d97ac9a880b0ae4497e5c11191f9a59f360e9ee authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 19 Apr 2016, 21:24 (11 years ago) parente80ef82
6 files changed+34−25
plugins/Utils/windowstatestorage.h+1−1 qml/Stages/DesktopStage.qml+12−6 qml/Stages/WindowDecoration.qml+1−1 qml/Stages/WindowResizeArea.qml+19−10 tests/mocks/Utils/windowstatestorage.h+1−1 tests/qmltests/Stages/tst_DesktopStage.qml−6
plugins/Utils/windowstatestorage.h+1−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2015 Canonical Ltd.
2+ * Copyright 2015-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * 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 {
372372 animationsEnabled = (animated === undefined) || animated;
373373 windowState = WindowStateStorage.WindowStateMaximized;
374374 }
375− function maximizeLeft() {
375+ function maximizeLeft(animated) {
376+ animationsEnabled = (animated === undefined) || animated;
376377 windowState = WindowStateStorage.WindowStateMaximizedLeft;
377378 }
378− function maximizeRight() {
379+ function maximizeRight(animated) {
380+ animationsEnabled = (animated === undefined) || animated;
379381 windowState = WindowStateStorage.WindowStateMaximizedRight;
380382 }
381− function maximizeHorizontally() {
383+ function maximizeHorizontally(animated) {
384+ animationsEnabled = (animated === undefined) || animated;
382385 windowState = WindowStateStorage.WindowStateMaximizedHorizontally;
383386 }
384− function maximizeVertically() {
387+ function maximizeVertically(animated) {
388+ animationsEnabled = (animated === undefined) || animated;
385389 windowState = WindowStateStorage.WindowStateMaximizedVertically;
386390 }
387391 function minimize(animated) {
@@ -485,11 +489,13 @@ AbstractStage {
485489 },
486490 State {
487491 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 }
489494 },
490495 State {
491496 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 }
493499 },
494500 State {
495501 name: "minimized"; when: appDelegate.minimized
qml/Stages/WindowDecoration.qml+1−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014-2015 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
qml/Stages/WindowResizeArea.qml+19−10
@@ -81,16 +81,25 @@ MouseArea {
8181 target.y = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, root.screenHeight - target.requestedHeight), PanelState.panelHeight); });
8282
8383 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
84− if (windowState === WindowStateStorage.WindowStateMaximized) {
85− target.maximize(false);
86− } else if (windowState === WindowStateStorage.WindowStateMaximizedLeft) {
87− target.maximizeLeft();
88− } else if (windowState === WindowStateStorage.WindowStateMaximizedRight) {
89− target.maximizeRight();
90− } else if (windowState === WindowStateStorage.WindowStateMaximizedHorizontally) {
91− target.maximizeHorizontally();
92− } else if (windowState === WindowStateStorage.WindowStateMaximizedVertically) {
93− target.maximizeVertically();
84+ switch (windowState) {
85+ case WindowStateStorage.WindowStateMaximized:
86+ target.maximize(false);
87+ break;
88+ case WindowStateStorage.WindowStateMaximizedLeft:
89+ target.maximizeLeft(false);
90+ break;
91+ case WindowStateStorage.WindowStateMaximizedRight:
92+ target.maximizeRight(false);
93+ break;
94+ case WindowStateStorage.WindowStateMaximizedHorizontally:
95+ target.maximizeHorizontally(false);
96+ break;
97+ case WindowStateStorage.WindowStateMaximizedVertically:
98+ target.maximizeVertically(false);
99+ break;
100+ default:
101+ console.warn("Unsupported window state");
102+ break;
94103 }
95104
96105 priv.updateNormalGeometry();
tests/mocks/Utils/windowstatestorage.h+1−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2015 Canonical Ltd.
2+ * Copyright 2015-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * 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 {
464464 function test_windowMaximizeHorizontally() {
465465 var dialerDelegate = startApplication("dialer-app");
466466
467− tryCompareFunction(function(){ return dialerDelegate.surface !== null; }, true);
468− tryCompare(dialerDelegate, "focus", true);
469−
470467 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
471468 verify(dialerMaximizeButton);
472469
@@ -482,9 +479,6 @@ Item {
482479 function test_windowMaximizeVertically() {
483480 var dialerDelegate = startApplication("dialer-app");
484481
485− tryCompareFunction(function(){ return dialerDelegate.surface !== null; }, true);
486− tryCompare(dialerDelegate, "focus", true);
487−
488482 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
489483 verify(dialerMaximizeButton);
490484