on xenial help sign in
Only make background transparent in greeter mode, in case it matters
b98b649Michael Terry
src/CMakeLists.txt+2−2
@@ -25,10 +25,10 @@ add_executable(${SHELL_APP} ${COMMON_SRCS})
25add_executable(${GREETER_APP} ${COMMON_SRCS})
25add_executable(${GREETER_APP} ${COMMON_SRCS})
26
26
27set_target_properties(${SHELL_APP} PROPERTIES
27set_target_properties(${SHELL_APP} PROPERTIES
28− COMPILE_DEFINITIONS "APP_NAME=\"Unity 8\";QML_FILE=\"Shell.qml\";INDICATOR_PROFILE=\"phone\""
28+ COMPILE_DEFINITIONS "UNITY8_SHELL=1;INDICATOR_PROFILE=\"phone\""
29 )
29 )
30set_target_properties(${GREETER_APP} PROPERTIES
30set_target_properties(${GREETER_APP} PROPERTIES
31− COMPILE_DEFINITIONS "APP_NAME=\"Unity 8 Greeter\";QML_FILE=\"GreeterShell.qml\";INDICATOR_PROFILE=\"phone_greeter\""
31+ COMPILE_DEFINITIONS "UNITY8_SHELL=0;INDICATOR_PROFILE=\"phone_greeter\""
32 )
32 )
33
33
34qt5_use_modules(${SHELL_APP} Gui Qml Quick Test)
34qt5_use_modules(${SHELL_APP} Gui Qml Quick Test)
src/main.cpp+10−9
@@ -42,7 +42,7 @@ int startShell(int argc, const char** argv, void* server)
42{
42{
43 const bool isUbuntuMirServer = qgetenv("QT_QPA_PLATFORM") == "ubuntumirserver";
43 const bool isUbuntuMirServer = qgetenv("QT_QPA_PLATFORM") == "ubuntumirserver";
44
44
45− QGuiApplication::setApplicationName(APP_NAME);
45+ QGuiApplication::setApplicationName(UNITY8_SHELL ? "Unity 8" : "Unity 8 Greeter");
46 QGuiApplication *application;
46 QGuiApplication *application;
47 if (isUbuntuMirServer) {
47 if (isUbuntuMirServer) {
48 QLibrary unityMir("unity-mir", 1);
48 QLibrary unityMir("unity-mir", 1);
@@ -113,7 +113,7 @@ int startShell(int argc, const char** argv, void* server)
113 nativeInterface->setProperty("ubuntuSessionType", 1);
113 nativeInterface->setProperty("ubuntuSessionType", 1);
114 view->setProperty("role", 2); // INDICATOR_ACTOR_ROLE
114 view->setProperty("role", 2); // INDICATOR_ACTOR_ROLE
115
115
116− QUrl source(::qmlDirectory()+QML_FILE);
116+ QUrl source(::qmlDirectory() + (UNITY8_SHELL ? "Shell.qml" : "GreeterShell.qml"));
117 prependImportPaths(view->engine(), ::overrideImportPaths());
117 prependImportPaths(view->engine(), ::overrideImportPaths());
118 appendImportPaths(view->engine(), ::fallbackImportPaths());
118 appendImportPaths(view->engine(), ::fallbackImportPaths());
119
119
@@ -121,17 +121,18 @@ int startShell(int argc, const char** argv, void* server)
121 QStringList importPaths = view->engine()->importPathList();
121 QStringList importPaths = view->engine()->importPathList();
122 importPaths.replaceInStrings(QRegExp("qt5/imports$"), "qt5/imports/Unity-Mir");
122 importPaths.replaceInStrings(QRegExp("qt5/imports$"), "qt5/imports/Unity-Mir");
123 view->engine()->setImportPathList(importPaths);
123 view->engine()->setImportPathList(importPaths);
124+
125+#if !UNITY8_SHELL
126+ // Make background transparent, so that the greeter can bleed through.
127+ QSurfaceFormat format;
128+ format.setAlphaBufferSize(8);
129+ view->setFormat(format);
130+ view->setColor(Qt::transparent);
131+#endif
124 }
132 }
125
133
126 view->setSource(source);
134 view->setSource(source);
127
135
128− // Make background transparent, so that the greeter can bleed through.
129− // In normal shell, the background is never seen.
130− QSurfaceFormat format;
131− format.setAlphaBufferSize(8);
132− view->setFormat(format);
133− view->setColor(Qt::transparent);
134−
135 if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || args.contains(QLatin1String("-fullscreen"))) {
136 if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || args.contains(QLatin1String("-fullscreen"))) {
136 // First, size window equal to screen (fake a real WM fullscreen mode).
137 // First, size window equal to screen (fake a real WM fullscreen mode).
137 // Then, in case we are actually running inside a windowing system,
138 // Then, in case we are actually running inside a windowing system,