on xenial help sign in
Merge lp:~unity-team/unity8/externalMonitor
commite587bd6d584ff0fe648f3d15a78fc01faab372dd authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 16 Oct 2015, 19:11 (11 years ago) parent50178202c54cbd
9 files changed+36−22
plugins/Cursor/MousePointer.cpp+1−1 plugins/Cursor/MousePointer.h+1−1 qml/Notifications/Notification.qml+2 qml/Notifications/NotificationMenuItemFactory.qml+2−1 qml/Notifications/Notifications.qml+2 qml/Shell.qml+1 src/ShellView.cpp+23 src/ShellView.h+4 tests/qmltests/Stages/tst_WindowResizeArea.qml−19
plugins/Cursor/MousePointer.cpp+1−1
@@ -34,7 +34,7 @@ MousePointer::MousePointer(QQuickItem *parent)
3434{
3535}
3636
37−void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButton buttons,
37+void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
3838 Qt::KeyboardModifiers modifiers)
3939{
4040 if (!parentItem()) {
plugins/Cursor/MousePointer.h+1−1
@@ -39,7 +39,7 @@ public:
3939 qreal hotspotY() const override { return m_hotspotY; }
4040
4141public Q_SLOTS:
42− void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButton buttons,
42+ void handleMouseEvent(ulong timestamp, QPointF movement, Qt::MouseButtons buttons,
4343 Qt::KeyboardModifiers modifiers) override;
4444
4545protected:
qml/Notifications/Notification.qml+2
@@ -50,6 +50,7 @@ Item {
5050 readonly property real contentSpacing: units.gu(2)
5151 readonly property bool canBeClosed: type === Notification.Ephemeral
5252 property bool hasMouse
53+ property url background: ""
5354
5455 objectName: "background"
5556 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
@@ -401,6 +402,7 @@ Item {
401402 menuData: model
402403 menuIndex: index
403404 maxHeight: notification.maxHeight
405+ background: notification.background
404406
405407 onLoaded: {
406408 notification.fullscreen = Qt.binding(function() { return fullscreen; });
qml/Notifications/NotificationMenuItemFactory.qml+2−1
@@ -30,6 +30,7 @@ Loader {
3030 property int menuIndex : -1
3131 property int maxHeight
3232 readonly property bool fullscreen: menuData.type === "com.canonical.snapdecision.pinlock"
33+ property url background: ""
3334
3435 signal accepted()
3536
@@ -149,7 +150,7 @@ Loader {
149150 infoText: notification.summary
150151 errorText: errorAction.valid ? errorAction.state : ""
151152 retryText: notification.body
152− background: shell.background
153+ background: menuFactory.background
153154 darkenBackground: 0.4
154155
155156 onEntered: {
qml/Notifications/Notifications.qml+2
@@ -29,6 +29,7 @@ ListView {
2929 property real margin
3030 property bool useModal: snapDecisionProxyModel.count > 0
3131 property bool hasMouse
32+ property url background: ""
3233
3334 UnitySortFilterProxyModel {
3435 id: snapDecisionProxyModel
@@ -60,6 +61,7 @@ ListView {
6061 maxHeight: notificationList.height
6162 margins: notificationList.margin
6263 hasMouse: notificationList.hasMouse
64+ background: notificationList.background
6365
6466 // make sure there's no opacity-difference between the several
6567 // elements in a notification
qml/Shell.qml+1
@@ -610,6 +610,7 @@ Item {
610610 model: NotificationBackend.Model
611611 margin: units.gu(1)
612612 hasMouse: shell.hasMouse
613+ background: wallpaperResolver.background
613614
614615 y: topmostIsFullscreen ? 0 : panel.panelHeight
615616 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
src/ShellView.cpp+23
@@ -18,6 +18,7 @@
1818
1919// Qt
2020#include <QQmlContext>
21+#include <QQuickItem>
2122
2223// local
2324#include <paths.h>
@@ -33,4 +34,26 @@ ShellView::ShellView(QQmlEngine *engine, QObject *qmlArgs)
3334
3435 QUrl source(::qmlDirectory() + "/OrientedShell.qml");
3536 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);
3659}
src/ShellView.h+4
@@ -25,6 +25,10 @@ class ShellView : public QQuickView
2525
2626public:
2727 ShellView(QQmlEngine *engine, QObject *qmlArgs);
28+
29+private Q_SLOTS:
30+ void onWidthChanged(int);
31+ void onHeightChanged(int);
2832};
2933
3034#endif // UNITY_SHELL_VIEW_H
tests/qmltests/Stages/tst_WindowResizeArea.qml−19
@@ -147,25 +147,6 @@ Item {
147147 compare(fakeWindow.y, Math.min(initialWindowY + data.dy, initialWindowY + maxMoveY));
148148 }
149149
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−
169150 function test_saveRestoreSize() {
170151 var initialWindowX = fakeWindow.x;
171152 var initialWindowY = fakeWindow.y;