Merge lp:~aacid/unity8/doubleClickMaximize into lp:unity8

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~aacid/unity8/doubleClickMaximize
Merge into: lp:unity8
Diff against target: 203 lines (+80/-52)
4 files modified
qml/ApplicationMenus/MenuBar.qml (+2/-0)
qml/Stage/DecoratedWindow.qml (+39/-46)
qml/Stage/WindowDecoration.qml (+6/-2)
tests/qmltests/Stage/tst_DesktopStage.qml (+33/-4)
To merge this branch: bzr merge lp:~aacid/unity8/doubleClickMaximize
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+315146@code.launchpad.net

This proposal has been superseded by a proposal from 2017-01-19.

Commit message

Make double click on the window decoration still maximize

And fix test and add a new one

Description of the change

WiP but i want to see the full CI test run

To post a comment you must log in.
lp:~aacid/unity8/doubleClickMaximize updated
2771. By Albert Astals Cid

Dfiferent way of making double click work on window decoration

2772. By Albert Astals Cid

comment++

2773. By Albert Astals Cid

i'm tyopeing moar than usual

2774. By Albert Astals Cid

Merge ~nick-dedekind/unity8/menu.overflow

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/ApplicationMenus/MenuBar.qml'
--- qml/ApplicationMenus/MenuBar.qml 2017-01-09 15:26:05 +0000
+++ qml/ApplicationMenus/MenuBar.qml 2017-01-19 16:09:12 +0000
@@ -188,6 +188,8 @@
188 anchors.fill: parent188 anchors.fill: parent
189 hoverEnabled: d.currentItem189 hoverEnabled: d.currentItem
190190
191 propagateComposedEvents: true
192
191 onEntered: {193 onEntered: {
192 if (d.currentItem) {194 if (d.currentItem) {
193 updateCurrentItemFromPosition(Qt.point(mouseX, mouseY))195 updateCurrentItemFromPosition(Qt.point(mouseX, mouseY))
194196
=== modified file 'qml/Stage/DecoratedWindow.qml'
--- qml/Stage/DecoratedWindow.qml 2016-12-12 11:16:47 +0000
+++ qml/Stage/DecoratedWindow.qml 2017-01-19 16:09:12 +0000
@@ -196,18 +196,19 @@
196 ]196 ]
197 }197 }
198198
199 MouseArea {199 WindowDecoration {
200 id: decoration
201 closeButtonVisible: root.application.appId !== "unity8-dash"
202 objectName: "appWindowDecoration"
203
200 anchors { left: parent.left; top: parent.top; right: parent.right }204 anchors { left: parent.left; top: parent.top; right: parent.right }
201 height: units.gu(3)205 height: units.gu(3)
202206
207 title: applicationWindow.title
208
203 opacity: root.hasDecoration ? Math.min(1, root.showDecoration) : 0209 opacity: root.hasDecoration ? Math.min(1, root.showDecoration) : 0
204
205 Behavior on opacity { UbuntuNumberAnimation { } }210 Behavior on opacity { UbuntuNumberAnimation { } }
206211
207 drag.target: Item {}
208 drag.filterChildren: true
209 drag.threshold: 0
210
211 onPressed: root.decorationPressed();212 onPressed: root.decorationPressed();
212 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)213 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
213 onPositionChanged: moveHandler.handlePositionChanged(mouse)214 onPositionChanged: moveHandler.handlePositionChanged(mouse)
@@ -216,47 +217,39 @@
216 moveHandler.handleReleased();217 moveHandler.handleReleased();
217 }218 }
218219
219 WindowDecoration {220 onCloseClicked: root.closeClicked();
220 id: decoration221 onMaximizeClicked: { root.decorationPressed(); root.maximizeClicked(); }
221 closeButtonVisible: root.application.appId !== "unity8-dash"222 onMaximizeHorizontallyClicked: { root.decorationPressed(); root.maximizeHorizontallyClicked(); }
222 objectName: "appWindowDecoration"223 onMaximizeVerticallyClicked: { root.decorationPressed(); root.maximizeVerticallyClicked(); }
223 anchors.fill: parent224 onMinimizeClicked: root.minimizeClicked();
224 title: applicationWindow.title225
225226 enableMenus: {
226 onCloseClicked: root.closeClicked();227 return active &&
227 onMaximizeClicked: { root.decorationPressed(); root.maximizeClicked(); }228 surface &&
228 onMaximizeHorizontallyClicked: { root.decorationPressed(); root.maximizeHorizontallyClicked(); }229 (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)
229 onMaximizeVerticallyClicked: { root.decorationPressed(); root.maximizeVerticallyClicked(); }230 }
230 onMinimizeClicked: root.minimizeClicked();231 menu: sharedAppModel.model
231232
232 enableMenus: {233 Indicators.SharedUnityMenuModel {
233 return active &&234 id: sharedAppModel
234 surface &&235 property var menus: surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : []
235 (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)236 property var menuService: menus.length > 0 ? menus[0] : undefined
236 }237
237 menu: sharedAppModel.model238 busName: menuService ? menuService.service : ""
238239 menuObjectPath: menuService && menuService.menuPath ? menuService.menuPath : ""
239 Indicators.SharedUnityMenuModel {240 actions: menuService && menuService.actionPath ? { "unity": menuService.actionPath } : {}
240 id: sharedAppModel241 }
241 property var menus: surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : []242
242 property var menuService: menus.length > 0 ? menus[0] : undefined243 Connections {
243244 target: ApplicationMenuRegistry
244 busName: menuService ? menuService.service : ""245 onSurfaceMenuRegistered: {
245 menuObjectPath: menuService && menuService.menuPath ? menuService.menuPath : ""246 if (surface && surfaceId === surface.persistentId) {
246 actions: menuService && menuService.actionPath ? { "unity": menuService.actionPath } : {}247 sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
247 }
248
249 Connections {
250 target: ApplicationMenuRegistry
251 onSurfaceMenuRegistered: {
252 if (surface && surfaceId === surface.persistentId) {
253 sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
254 }
255 }248 }
256 onSurfaceMenuUnregistered: {249 }
257 if (surface && surfaceId === surface.persistentId) {250 onSurfaceMenuUnregistered: {
258 sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });251 if (surface && surfaceId === surface.persistentId) {
259 }252 sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
260 }253 }
261 }254 }
262 }255 }
263256
=== modified file 'qml/Stage/WindowDecoration.qml'
--- qml/Stage/WindowDecoration.qml 2016-12-12 11:16:47 +0000
+++ qml/Stage/WindowDecoration.qml 2017-01-19 16:09:12 +0000
@@ -38,6 +38,10 @@
38 acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events38 acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events
39 hoverEnabled: true39 hoverEnabled: true
4040
41 drag.target: Item {}
42 drag.filterChildren: true
43 drag.threshold: 0
44
41 signal closeClicked()45 signal closeClicked()
42 signal minimizeClicked()46 signal minimizeClicked()
43 signal maximizeClicked()47 signal maximizeClicked()
@@ -64,8 +68,8 @@
64 (menuBar.showRequested || root.containsMouse)68 (menuBar.showRequested || root.containsMouse)
65 }69 }
6670
67 // We dont want touch events to fall through to parent,71 // We dont want touch events to fall through to parent as it expect some child MouseArea to have them
68 // otherwise the containsMouse will not work.72 // If not some MouseArea in the menu bar, it will be this one.
69 MouseArea {73 MouseArea {
70 anchors.fill: parent74 anchors.fill: parent
71 propagateComposedEvents: true75 propagateComposedEvents: true
7276
=== modified file 'tests/qmltests/Stage/tst_DesktopStage.qml'
--- tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-10 14:44:29 +0000
+++ tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-19 16:09:12 +0000
@@ -695,10 +695,17 @@
695 var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);695 var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
696 var deco = findChild(dialerDelegate, "appWindowDecoration");696 var deco = findChild(dialerDelegate, "appWindowDecoration");
697 verify(deco);697 verify(deco);
698 tryCompare(deco, "maximizeButtonShown", false);698 mouseMove(deco, deco.width - units.gu(1), deco.height/2);
699 mouseDoubleClick(deco);699 var menuBarLoader = findChild(deco, "menuBarLoader");
700 var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);700 tryCompare(menuBarLoader.item, "visible", true);
701 tryCompareFunction(function(){ return sizeBefore; }, sizeAfter);701 mouseDoubleClick(deco, deco.width - units.gu(1), deco.height/2);
702 expectFail("", "Double click should not maximize ina a size restricted window");
703 tryCompareFunction(function() {
704 var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
705 return sizeAfter.width > sizeBefore.width && sizeAfter.height > sizeBefore.height;
706 },
707 true
708 );
702709
703 // remove restrictions, the maximize button should again be visible710 // remove restrictions, the maximize button should again be visible
704 dialerDelegate.surface.setMaximumWidth(0);711 dialerDelegate.surface.setMaximumWidth(0);
@@ -706,6 +713,28 @@
706 tryCompare(dialerMaximizeButton, "visible", true);713 tryCompare(dialerMaximizeButton, "visible", true);
707 }714 }
708715
716 function test_doubleClickMaximizes() {
717 var dialerDelegate = startApplication("dialer-app");
718
719 var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
720 tryCompare(dialerMaximizeButton, "visible", true);
721
722 // try double clicking the decoration, shoul maximize it
723 var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
724 var deco = findChild(dialerDelegate, "appWindowDecoration");
725 verify(deco);
726 mouseMove(deco, deco.width - units.gu(1), deco.height/2);
727 var menuBarLoader = findChild(deco, "menuBarLoader");
728 tryCompare(menuBarLoader.item, "visible", true);
729 mouseDoubleClick(deco, deco.width - units.gu(1), deco.height/2);
730 tryCompareFunction(function() {
731 var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
732 return sizeAfter.width > sizeBefore.width && sizeAfter.height > sizeBefore.height;
733 },
734 true
735 );
736 }
737
709 function test_canMoveWindowWithLeftMouseButtonOnly_data() {738 function test_canMoveWindowWithLeftMouseButtonOnly_data() {
710 return [739 return [
711 {tag: "left mouse button", button: Qt.LeftButton },740 {tag: "left mouse button", button: Qt.LeftButton },

Subscribers

People subscribed via source and target branches