Skip to content

Commit 8ef39f8

Browse files
committed
Shell rotation
1 parent 36d36ac commit 8ef39f8

File tree

72 files changed

+4345
-595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4345
-595
lines changed

data/unity8-dash.desktop.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Terminal=false
77
Icon=
88
NoDisplay=true
99
X-Ubuntu-Touch=true
10+
X-Ubuntu-Supported-Orientations=primary

debian/control

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Build-Depends: cmake,
1414
# append :native to g++-4.9 so we don't try to run armhf g++
1515
# on an x86 CPU for eaxmple, when cross-compiling.
1616
g++-4.9:native,
17+
libandroid-properties-dev,
1718
libconnectivity-qt1-dev,
1819
libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
1920
libgl1-mesa-dri,
@@ -93,7 +94,7 @@ Depends: gsettings-desktop-schemas,
9394
qml-module-qtquick-xmllistmodel,
9495
qml-module-qtsysteminfo,
9596
qtdeclarative5-gsettings1.0,
96-
qtdeclarative5-qtmir-plugin (>= 0.4.4),
97+
qtdeclarative5-qtmir-plugin (>= 0.4.5),
9798
qtdeclarative5-ubuntu-telephony0.1,
9899
qtdeclarative5-ubuntu-web-plugin,
99100
ubuntu-system-settings,
@@ -123,7 +124,7 @@ Depends: qml-module-qtquick-layouts,
123124
qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.1.1239) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.1.1239),
124125
qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
125126
ubuntu-thumbnailer-impl-0,
126-
unity-application-impl-4,
127+
unity-application-impl-5,
127128
unity-notifications-impl-3,
128129
unity-plugin-scopes | unity-scopes-impl,
129130
unity-scopes-impl-6,
@@ -172,7 +173,7 @@ Pre-Depends: ${misc:Pre-Depends},
172173
Depends: ${misc:Depends},
173174
${shlibs:Depends},
174175
Provides: unity-application-impl,
175-
unity-application-impl-4,
176+
unity-application-impl-5,
176177
Description: Fake environment for running Unity 8 shell
177178
Provides fake implementations of some QML modules used by Unity 8 shell
178179
(e.g Ubuntu.Application) so that you can run it in a sandboxed environment.

debian/unity8.install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ usr/share/applications/unity8-dash.desktop
88
usr/share/unity8/Greeter
99
usr/share/unity8/Launcher
1010
usr/share/unity8/Panel
11+
usr/share/unity8/Rotation
12+
usr/share/unity8/DeviceConfiguration.qml
13+
usr/share/unity8/OrientedShell.qml
1114
usr/share/unity8/Shell.qml
1215
usr/share/unity8/Stages
1316
usr/share/unity8/Tutorial

plugins/Greeter/Unity/Launcher/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include(FindPkgConfig)
22
pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=6)
3-
pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=5)
3+
pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=6)
44
pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
55

66
add_definitions(-DSM_BUSNAME=systemBus)

plugins/Unity/Launcher/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=6)
2-
pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=5)
2+
pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=6)
33
pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
44

55
add_definitions(-DSM_BUSNAME=systemBus)

plugins/Utils/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(QMLPLUGIN_SRC
1414
timeformatter.cpp
1515
unitymenumodelpaths.cpp
1616
windowkeysfilter.cpp
17+
windowscreenshotprovider.cpp
1718
easingcurve.cpp
1819
windowstatestorage.cpp
1920
plugin.cpp

plugins/Utils/plugin.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
#include "plugin.h"
2727

2828
// local
29+
#include "easingcurve.h"
2930
#include "qlimitproxymodelqml.h"
3031
#include "unitysortfilterproxymodelqml.h"
3132
#include "relativetimeformatter.h"
3233
#include "timeformatter.h"
3334
#include "unitymenumodelpaths.h"
3435
#include "windowkeysfilter.h"
35-
#include "easingcurve.h"
36+
#include "windowscreenshotprovider.h"
3637
#include "windowstatestorage.h"
3738

3839
static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
@@ -60,4 +61,6 @@ void UtilsPlugin::registerTypes(const char *uri)
6061
void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
6162
{
6263
QQmlExtensionPlugin::initializeEngine(engine, uri);
64+
65+
engine->addImageProvider(QLatin1String("window"), new WindowScreenshotProvider);
6366
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (C) 2014 Canonical, Ltd.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#include "windowscreenshotprovider.h"
18+
19+
#include <QGuiApplication>
20+
#include <QQuickWindow>
21+
22+
WindowScreenshotProvider::WindowScreenshotProvider()
23+
: QQuickImageProvider(QQmlImageProviderBase::Image, 0)
24+
{
25+
}
26+
27+
// A very simple implementation where we assume that there's only one window and that it's a
28+
// QQuickWindow. Thus the id parameter is irrelevant.
29+
//
30+
// Idea: Make the id contain the objectName of the QQuickWindow once we care about a multi-display
31+
// compositor?
32+
// Strictly speaking that could be the actual QWindow::winId(), but that's mostly a
33+
// meaningless arbitrary number.
34+
QImage WindowScreenshotProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
35+
{
36+
Q_UNUSED(id);
37+
Q_UNUSED(requestedSize);
38+
39+
QWindowList windows = QGuiApplication::topLevelWindows();
40+
41+
if (windows.count() != 1) {
42+
size->rwidth() = 0;
43+
size->rheight() = 0;
44+
return QImage();
45+
}
46+
47+
QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(windows[0]);
48+
49+
if (!quickWindow) {
50+
size->rwidth() = 0;
51+
size->rheight() = 0;
52+
return QImage();
53+
}
54+
55+
QImage image = quickWindow->grabWindow();
56+
size->rwidth() = image.width();
57+
size->rheight() = image.height();
58+
return image;
59+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (C) 2014 Canonical, Ltd.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#ifndef WINDOW_SCREENSHOT_PROVIDER_H_
18+
#define WINDOW_SCREENSHOT_PROVIDER_H_
19+
20+
#include <QQuickImageProvider>
21+
22+
class WindowScreenshotProvider : public QQuickImageProvider
23+
{
24+
public:
25+
WindowScreenshotProvider();
26+
27+
// id is ignored for now
28+
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
29+
};
30+
31+
#endif // WINDOW_SCREENSHOT_PROVIDER_H_

qml/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set(QML_DIRS
1313
Notifications
1414
Panel
1515
Stages
16+
Rotation
1617
Tutorial
1718
Wizard
1819
)

0 commit comments

Comments
 (0)