Package: cinnamon-session
Version: 3.0.1-2
Control: block -1 by 822246 843257

Dear maintainers,

Qt 5.7 moved the GTK+ 2 theme engine from qtbase to qt-style-plugins[1].
In the process, this caused the old setting of QT_STYLE_OVERRIDE=gtk to
stop working, so Qt 5 programs will default to the out-of-place Fusion
theme.

A backported fix from upstream to fix this is attached: it sets Qt to
use qt5ct as a backend, which in turn allows the user to specify what Qt
5 theme to use globally. However, neither qt5ct[2] nor the new
qt5-style-plugins with GTK+2 support[3] have made it into Debian yet, so
there may be a need for a simpler fix.

Best,
James

[1]:
https://github.com/qt/qtstyleplugins/commit/102da7d50231fc5723dba6e72340bef3d29471aa

[2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=822246

[3]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843257
Description: Make QT5 apps follow the GTK style on Qt >= 5.7
Origin: upstream, https://github.com/linuxmint/cinnamon-session/pull/75
Last-Update: 2016-12-08
Bug: https://github.com/linuxmint/Cinnamon/issues/5440

Index: cinnamon-session/cinnamon-session/main.c
===================================================================
--- cinnamon-session.orig/cinnamon-session/main.c	2016-11-24 22:33:52.233384319 -0800
+++ cinnamon-session/cinnamon-session/main.c	2016-11-24 22:33:52.229384394 -0800
@@ -296,6 +296,7 @@
                 { "whale", 0, 0, G_OPTION_ARG_NONE, &please_fail, N_("Show the fail whale dialog for testing"), NULL },
                 { NULL, 0, 0, 0, NULL, NULL, NULL }
         };
+        char *qt_platform_theme_new = NULL;
 
         /* Make sure that we have a session bus */
         if (!require_dbus_session (argc, argv, &error)) {
@@ -383,8 +384,23 @@
          */
         csm_util_setenv ("GNOME_DESKTOP_SESSION_ID", "this-is-deprecated");
 
-        /* Make QT5 apps follow the GTK style */
-        csm_util_setenv ("QT_STYLE_OVERRIDE", "gtk");
+
+        /* Make QT5 apps follow the GTK style. Starting with QT 5.7, a different
+         * env var has to be set than what worked in previous versions.
+         */
+        qt_platform_theme_new = HAVE_QT57 ? "qt5ct" : "qgnomeplatform";
+
+        if (NULL == g_getenv ("QT_QPA_PLATFORMTHEME")) {
+            csm_util_setenv ("QT_QPA_PLATFORMTHEME", qt_platform_theme_new);
+        }
+
+        if ( ! HAVE_QT57 && NULL == g_getenv ("QT_STYLE_OVERRIDE") ) {
+            csm_util_setenv ("QT_STYLE_OVERRIDE", "gtk");
+
+        } else if (HAVE_QT57 && NULL != g_getenv ("QT_STYLE_OVERRIDE")) {
+            g_unsetenv ("QT_STYLE_OVERRIDE");
+        }
+
 
         /* GTK Overlay scrollbars */
         settings = g_settings_new ("org.cinnamon.desktop.interface");
Index: cinnamon-session/configure.ac
===================================================================
--- cinnamon-session.orig/configure.ac	2016-11-24 22:33:52.233384319 -0800
+++ cinnamon-session/configure.ac	2016-11-24 22:33:55.000000000 -0800
@@ -108,6 +108,20 @@
 AC_SUBST(LOGIND_LIBS)
 
 dnl ====================================================================
+dnl Check for qt 5.7+ to set correct env var for theme/styling
+dnl ====================================================================
+AC_ARG_ENABLE(qt57_theme_support,
+              AS_HELP_STRING([--enable-qt57-theme-support], [Support GTK styles for QT apps with QT 5.7+]),
+              [enable_qt57_theme_support=yes],
+              [enable_qt57_theme_support=no])
+
+if test x$enable_qt57_theme_support = xyes; then
+    AC_DEFINE([HAVE_QT57], [1], [Have QT 5.7+])
+else
+    AC_DEFINE([HAVE_QT57], [0], [Have QT 5.7+])
+fi
+
+dnl ====================================================================
 dnl X development libraries check
 dnl ====================================================================
 
@@ -349,12 +363,13 @@
 
         GConf support:            ${enable_gconf}
         Logind support:           ${have_logind}
+        Qt 5.7+ theme support:    ${enable_qt57_theme_support}
         IPv6 support:             ${have_full_ipv6}
         Backtrace support:        ${have_backtrace}
         XRender support:          ${have_xrender}
         XSync support:            ${have_xsync}
         XTest support:            ${have_xtest}
-	Legacy UPower backend:    ${have_old_upower}
+        Legacy UPower backend:    ${have_old_upower}
         Build documentation:      ${enable_docbook_docs}
 
 "

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to