on xenial help sign in
Merge lp:~unity-team/unity8/externalMonitor
e587bd6Michał Sawicz
plugins/Cursor/MousePointer.cpp+1−1
@@ -34,7 +34,7 @@ MousePointer::MousePointer(QQuickItem *parent)
34{
34{
35}
35}
36
36
37−void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButton buttons,
37+void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
38 Qt::KeyboardModifiers modifiers)
38 Qt::KeyboardModifiers modifiers)
39{
39{
40 if (!parentItem()) {
40 if (!parentItem()) {
plugins/Cursor/MousePointer.h+1−1
@@ -39,7 +39,7 @@ public:
39 qreal hotspotY() const override { return m_hotspotY; }
39 qreal hotspotY() const override { return m_hotspotY; }
40
40
41public Q_SLOTS:
41public Q_SLOTS:
42− void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButton buttons,
42+ void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
43 Qt::KeyboardModifiers modifiers) override;
43 Qt::KeyboardModifiers modifiers) override;
44
44
45protected:
45protected:
qml/Notifications/Notification.qml+2
@@ -50,6 +50,7 @@ Item {
50 readonly property real contentSpacing: units.gu(2)
50 readonly property real contentSpacing: units.gu(2)
51 readonly property bool canBeClosed: type === Notification.Ephemeral
51 readonly property bool canBeClosed: type === Notification.Ephemeral
52 property bool hasMouse
52 property bool hasMouse
53+ property url background: ""
53
54
54 objectName: "background"
55 objectName: "background"
55 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
56 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
@@ -401,6 +402,7 @@ Item {
401 menuData: model
402 menuData: model
402 menuIndex: index
403 menuIndex: index
403 maxHeight: notification.maxHeight
404 maxHeight: notification.maxHeight
405+ background: notification.background
404
406
405 onLoaded: {
407 onLoaded: {
406 notification.fullscreen = Qt.binding(function() { return fullscreen; });
408 notification.fullscreen = Qt.binding(function() { return fullscreen; });
qml/Notifications/NotificationMenuItemFactory.qml+2−1
@@ -30,6 +30,7 @@ Loader {
30 property int menuIndex : -1
30 property int menuIndex : -1
31 property int maxHeight
31 property int maxHeight
32 readonly property bool fullscreen: menuData.type === "com.canonical.snapdecision.pinlock"
32 readonly property bool fullscreen: menuData.type === "com.canonical.snapdecision.pinlock"
33+ property url background: ""
33
34
34 signal accepted()
35 signal accepted()
35
36
@@ -149,7 +150,7 @@ Loader {
149 infoText: notification.summary
150 infoText: notification.summary
150 errorText: errorAction.valid ? errorAction.state : ""
151 errorText: errorAction.valid ? errorAction.state : ""
151 retryText: notification.body
152 retryText: notification.body
152− background: shell.background
153+ background: menuFactory.background
153 darkenBackground: 0.4
154 darkenBackground: 0.4
154
155
155 onEntered: {
156 onEntered: {
qml/Notifications/Notifications.qml+2
@@ -29,6 +29,7 @@ ListView {
29 property real margin
29 property real margin
30 property bool useModal: snapDecisionProxyModel.count > 0
30 property bool useModal: snapDecisionProxyModel.count > 0
31 property bool hasMouse
31 property bool hasMouse
32+ property url background: ""
32
33
33 UnitySortFilterProxyModel {
34 UnitySortFilterProxyModel {
34 id: snapDecisionProxyModel
35 id: snapDecisionProxyModel
@@ -60,6 +61,7 @@ ListView {
60 maxHeight: notificationList.height
61 maxHeight: notificationList.height
61 margins: notificationList.margin
62 margins: notificationList.margin
62 hasMouse: notificationList.hasMouse
63 hasMouse: notificationList.hasMouse
64+ background: notificationList.background
63
65
64 // make sure there's no opacity-difference between the several
66 // make sure there's no opacity-difference between the several
65 // elements in a notification
67 // elements in a notification
qml/Shell.qml+1
@@ -610,6 +610,7 @@ Item {
610 model: NotificationBackend.Model
610 model: NotificationBackend.Model
611 margin: units.gu(1)
611 margin: units.gu(1)
612 hasMouse: shell.hasMouse
612 hasMouse: shell.hasMouse
613+ background: wallpaperResolver.background
613
614
614 y: topmostIsFullscreen ? 0 : panel.panelHeight
615 y: topmostIsFullscreen ? 0 : panel.panelHeight
615 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
616 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
src/ShellView.cpp+23
@@ -18,6 +18,7 @@
18
18
19// Qt
19// Qt
20#include <QQmlContext>
20#include <QQmlContext>
21+#include <QQuickItem>
21
22
22// local
23// local
23#include <paths.h>
24#include <paths.h>
@@ -33,4 +34,26 @@ ShellView::ShellView(QQmlEngine *engine, QObject *qmlArgs)
33
34
34 QUrl source(::qmlDirectory() + "/OrientedShell.qml");
35 QUrl source(::qmlDirectory() + "/OrientedShell.qml");
35 setSource(source);
36 setSource(source);
37+
38+ connect(this, &QWindow::widthChanged, this, &ShellView::onWidthChanged);
39+ connect(this, &QWindow::heightChanged, this, &ShellView::onHeightChanged);
40+}
41+
42+void ShellView::onWidthChanged(int w)
43+{
44+ // For good measure in case SizeRootObjectToView doesn't fulfill its promise.
45+ //
46+ // There's at least one situation that's know to leave the root object with an outdated size.
47+ // (really looks like Qt bug)
48+ // Happens when starting unity8 with an external monitor already connected.
49+ // The QResizeEvent we get still has the size of the first screen and since the resize move is triggered
50+ // from the resize event handler, the root item doesn't get resized.
51+ // TODO: Confirm the Qt bug and submit a patch upstream
52+ rootObject()->setWidth(w);
53+}
54+
55+void ShellView::onHeightChanged(int h)
56+{
57+ // See comment in ShellView::onWidthChanged()
58+ rootObject()->setHeight(h);
36}
59}
src/ShellView.h+4
@@ -25,6 +25,10 @@ class ShellView : public QQuickView
25
25
26public:
26public:
27 ShellView(QQmlEngine *engine, QObject *qmlArgs);
27 ShellView(QQmlEngine *engine, QObject *qmlArgs);
28+
29+private Q_SLOTS:
30+ void onWidthChanged(int);
31+ void onHeightChanged(int);
28};
32};
29
33
30#endif // UNITY_SHELL_VIEW_H
34#endif // UNITY_SHELL_VIEW_H
tests/qmltests/Stages/tst_WindowResizeArea.qml−19
@@ -147,25 +147,6 @@ Item {
147 compare(fakeWindow.y, Math.min(initialWindowY + data.dy, initialWindowY + maxMoveY));
147 compare(fakeWindow.y, Math.min(initialWindowY + data.dy, initialWindowY + maxMoveY));
148 }
148 }
149
149
150− function test_saveRestorePosition() {
151− var initialWindowX = fakeWindow.x;
152− var initialWindowY = fakeWindow.y;
153−
154− var moveDelta = units.gu(5);
155−
156− fakeWindow.x = initialWindowX + moveDelta
157− fakeWindow.y = initialWindowY + moveDelta
158−
159− // This will destroy the window and recreate it
160− windowLoader.active = false;
161− waitForRendering(root);
162− windowLoader.active = true;
163−
164− // Make sure it's again where we left it before destroying
165− tryCompare(fakeWindow, "x", initialWindowX + moveDelta)
166− tryCompare(fakeWindow, "y", initialWindowX + moveDelta)
167− }
168−
169 function test_saveRestoreSize() {
150 function test_saveRestoreSize() {
170 var initialWindowX = fakeWindow.x;
151 var initialWindowX = fakeWindow.x;
171 var initialWindowY = fakeWindow.y;
152 var initialWindowY = fakeWindow.y;