on xenial help sign in
Really disable the window decoration when in staged mode

Instead of having it only fully translucent (but still catching input). So that it doesn't eat mouse clicks and taps near the window's top edge (LP: #1670361) Approved by: Lukáš Tinkl, Unity8 CI Bot

commitfd8148a1db96b080e4a251a63bfd500a5526bfa8 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateTue 21 Mar 2017, 10:52 (10 years ago) parentbcc34ec09f4c48
2 files changed+35−2
qml/Stage/DecoratedWindow.qml+2−1 tests/qmltests/Stage/tst_TabletStage.qml+33−1
qml/Stage/DecoratedWindow.qml+2−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
2+ * Copyright (C) 2014-2017 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
@@ -212,6 +212,7 @@ FocusScope {
212212
213213 opacity: root.hasDecoration ? Math.min(1, root.showDecoration) : 0
214214 Behavior on opacity { UbuntuNumberAnimation { } }
215+ visible: opacity > 0 // don't eat input when decoration is fully translucent
215216
216217 onPressed: root.decorationPressed();
217218 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
tests/qmltests/Stage/tst_TabletStage.qml+33−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2015-2016 Canonical, Ltd.
2+ * Copyright (C) 2015-2017 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
@@ -761,6 +761,38 @@ Rectangle {
761761 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
762762 }
763763
764+ /*
765+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1670361
766+
767+ Clicks near the top window edge (but still inside the window boundaries) should go to
768+ the window (and not get eaten by some translucent decoration like in that bug).
769+ */
770+ function test_clickNearTopEdgeGoesToWindow() {
771+ compare(topLevelSurfaceList.count, 1); // assume unity8-dash is already there
772+
773+ var appDelegate = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
774+ verify(appDelegate);
775+
776+ var surfaceItem = findChild(appDelegate, "surfaceItem");
777+ verify(surfaceItem);
778+
779+ compare(surfaceItem.mousePressCount, 0);
780+ compare(surfaceItem.mouseReleaseCount, 0);
764781
782+ mouseClick(appDelegate, 1, 1); // near top left
783+
784+ compare(surfaceItem.mousePressCount, 1);
785+ compare(surfaceItem.mouseReleaseCount, 1);
786+
787+ mouseClick(appDelegate, appDelegate.width / 2, 1); // near top
788+
789+ compare(surfaceItem.mousePressCount, 2);
790+ compare(surfaceItem.mouseReleaseCount, 2);
791+
792+ mouseClick(appDelegate, appDelegate.width - 1, 1); // near top right
793+
794+ compare(surfaceItem.mousePressCount, 3);
795+ compare(surfaceItem.mouseReleaseCount, 3);
796+ }
765797 }
766798}