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
1=== modified file 'qml/ApplicationMenus/MenuBar.qml'
2--- qml/ApplicationMenus/MenuBar.qml 2017-01-09 15:26:05 +0000
3+++ qml/ApplicationMenus/MenuBar.qml 2017-01-19 16:09:12 +0000
4@@ -188,6 +188,8 @@
5 anchors.fill: parent
6 hoverEnabled: d.currentItem
7
8+ propagateComposedEvents: true
9+
10 onEntered: {
11 if (d.currentItem) {
12 updateCurrentItemFromPosition(Qt.point(mouseX, mouseY))
13
14=== modified file 'qml/Stage/DecoratedWindow.qml'
15--- qml/Stage/DecoratedWindow.qml 2016-12-12 11:16:47 +0000
16+++ qml/Stage/DecoratedWindow.qml 2017-01-19 16:09:12 +0000
17@@ -196,18 +196,19 @@
18 ]
19 }
20
21- MouseArea {
22+ WindowDecoration {
23+ id: decoration
24+ closeButtonVisible: root.application.appId !== "unity8-dash"
25+ objectName: "appWindowDecoration"
26+
27 anchors { left: parent.left; top: parent.top; right: parent.right }
28 height: units.gu(3)
29
30+ title: applicationWindow.title
31+
32 opacity: root.hasDecoration ? Math.min(1, root.showDecoration) : 0
33-
34 Behavior on opacity { UbuntuNumberAnimation { } }
35
36- drag.target: Item {}
37- drag.filterChildren: true
38- drag.threshold: 0
39-
40 onPressed: root.decorationPressed();
41 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
42 onPositionChanged: moveHandler.handlePositionChanged(mouse)
43@@ -216,47 +217,39 @@
44 moveHandler.handleReleased();
45 }
46
47- WindowDecoration {
48- id: decoration
49- closeButtonVisible: root.application.appId !== "unity8-dash"
50- objectName: "appWindowDecoration"
51- anchors.fill: parent
52- title: applicationWindow.title
53-
54- onCloseClicked: root.closeClicked();
55- onMaximizeClicked: { root.decorationPressed(); root.maximizeClicked(); }
56- onMaximizeHorizontallyClicked: { root.decorationPressed(); root.maximizeHorizontallyClicked(); }
57- onMaximizeVerticallyClicked: { root.decorationPressed(); root.maximizeVerticallyClicked(); }
58- onMinimizeClicked: root.minimizeClicked();
59-
60- enableMenus: {
61- return active &&
62- surface &&
63- (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)
64- }
65- menu: sharedAppModel.model
66-
67- Indicators.SharedUnityMenuModel {
68- id: sharedAppModel
69- property var menus: surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : []
70- property var menuService: menus.length > 0 ? menus[0] : undefined
71-
72- busName: menuService ? menuService.service : ""
73- menuObjectPath: menuService && menuService.menuPath ? menuService.menuPath : ""
74- actions: menuService && menuService.actionPath ? { "unity": menuService.actionPath } : {}
75- }
76-
77- Connections {
78- target: ApplicationMenuRegistry
79- onSurfaceMenuRegistered: {
80- if (surface && surfaceId === surface.persistentId) {
81- sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
82- }
83+ onCloseClicked: root.closeClicked();
84+ onMaximizeClicked: { root.decorationPressed(); root.maximizeClicked(); }
85+ onMaximizeHorizontallyClicked: { root.decorationPressed(); root.maximizeHorizontallyClicked(); }
86+ onMaximizeVerticallyClicked: { root.decorationPressed(); root.maximizeVerticallyClicked(); }
87+ onMinimizeClicked: root.minimizeClicked();
88+
89+ enableMenus: {
90+ return active &&
91+ surface &&
92+ (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)
93+ }
94+ menu: sharedAppModel.model
95+
96+ Indicators.SharedUnityMenuModel {
97+ id: sharedAppModel
98+ property var menus: surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : []
99+ property var menuService: menus.length > 0 ? menus[0] : undefined
100+
101+ busName: menuService ? menuService.service : ""
102+ menuObjectPath: menuService && menuService.menuPath ? menuService.menuPath : ""
103+ actions: menuService && menuService.actionPath ? { "unity": menuService.actionPath } : {}
104+ }
105+
106+ Connections {
107+ target: ApplicationMenuRegistry
108+ onSurfaceMenuRegistered: {
109+ if (surface && surfaceId === surface.persistentId) {
110+ sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
111 }
112- onSurfaceMenuUnregistered: {
113- if (surface && surfaceId === surface.persistentId) {
114- sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
115- }
116+ }
117+ onSurfaceMenuUnregistered: {
118+ if (surface && surfaceId === surface.persistentId) {
119+ sharedAppModel.menus = Qt.binding(function() { return surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : [] });
120 }
121 }
122 }
123
124=== modified file 'qml/Stage/WindowDecoration.qml'
125--- qml/Stage/WindowDecoration.qml 2016-12-12 11:16:47 +0000
126+++ qml/Stage/WindowDecoration.qml 2017-01-19 16:09:12 +0000
127@@ -38,6 +38,10 @@
128 acceptedButtons: Qt.AllButtons // prevent leaking unhandled mouse events
129 hoverEnabled: true
130
131+ drag.target: Item {}
132+ drag.filterChildren: true
133+ drag.threshold: 0
134+
135 signal closeClicked()
136 signal minimizeClicked()
137 signal maximizeClicked()
138@@ -64,8 +68,8 @@
139 (menuBar.showRequested || root.containsMouse)
140 }
141
142- // We dont want touch events to fall through to parent,
143- // otherwise the containsMouse will not work.
144+ // We dont want touch events to fall through to parent as it expect some child MouseArea to have them
145+ // If not some MouseArea in the menu bar, it will be this one.
146 MouseArea {
147 anchors.fill: parent
148 propagateComposedEvents: true
149
150=== modified file 'tests/qmltests/Stage/tst_DesktopStage.qml'
151--- tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-10 14:44:29 +0000
152+++ tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-19 16:09:12 +0000
153@@ -695,10 +695,17 @@
154 var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
155 var deco = findChild(dialerDelegate, "appWindowDecoration");
156 verify(deco);
157- tryCompare(deco, "maximizeButtonShown", false);
158- mouseDoubleClick(deco);
159- var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
160- tryCompareFunction(function(){ return sizeBefore; }, sizeAfter);
161+ mouseMove(deco, deco.width - units.gu(1), deco.height/2);
162+ var menuBarLoader = findChild(deco, "menuBarLoader");
163+ tryCompare(menuBarLoader.item, "visible", true);
164+ mouseDoubleClick(deco, deco.width - units.gu(1), deco.height/2);
165+ expectFail("", "Double click should not maximize ina a size restricted window");
166+ tryCompareFunction(function() {
167+ var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
168+ return sizeAfter.width > sizeBefore.width && sizeAfter.height > sizeBefore.height;
169+ },
170+ true
171+ );
172
173 // remove restrictions, the maximize button should again be visible
174 dialerDelegate.surface.setMaximumWidth(0);
175@@ -706,6 +713,28 @@
176 tryCompare(dialerMaximizeButton, "visible", true);
177 }
178
179+ function test_doubleClickMaximizes() {
180+ var dialerDelegate = startApplication("dialer-app");
181+
182+ var dialerMaximizeButton = findChild(dialerDelegate, "maximizeWindowButton");
183+ tryCompare(dialerMaximizeButton, "visible", true);
184+
185+ // try double clicking the decoration, shoul maximize it
186+ var sizeBefore = Qt.size(dialerDelegate.width, dialerDelegate.height);
187+ var deco = findChild(dialerDelegate, "appWindowDecoration");
188+ verify(deco);
189+ mouseMove(deco, deco.width - units.gu(1), deco.height/2);
190+ var menuBarLoader = findChild(deco, "menuBarLoader");
191+ tryCompare(menuBarLoader.item, "visible", true);
192+ mouseDoubleClick(deco, deco.width - units.gu(1), deco.height/2);
193+ tryCompareFunction(function() {
194+ var sizeAfter = Qt.size(dialerDelegate.width, dialerDelegate.height);
195+ return sizeAfter.width > sizeBefore.width && sizeAfter.height > sizeBefore.height;
196+ },
197+ true
198+ );
199+ }
200+
201 function test_canMoveWindowWithLeftMouseButtonOnly_data() {
202 return [
203 {tag: "left mouse button", button: Qt.LeftButton },

Subscribers

People subscribed via source and target branches