@@ -18,6 +18,7 @@
20#include <QQmlContext>
20#include <QQmlContext>
23#include <paths.h>
24#include <paths.h>
@@ -33,4 +34,26 @@ ShellView::ShellView(QQmlEngine *engine, QObject *qmlArgs)
34 QUrl source(::qmlDirectory() + "/OrientedShell.qml");
35 QUrl source(::qmlDirectory() + "/OrientedShell.qml");
35 setSource(source);
36 setSource(source);
38+ connect(this, &QWindow::widthChanged, this, &ShellView::onWidthChanged);
39+ connect(this, &QWindow::heightChanged, this, &ShellView::onHeightChanged);
42+void ShellView::onWidthChanged(int w)
44+ // For good measure in case SizeRootObjectToView doesn't fulfill its promise.
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);
55+void ShellView::onHeightChanged(int h)
57+ // See comment in ShellView::onWidthChanged()
58+ rootObject()->setHeight(h);