Hrvoje Senjan 2015-01-30 02:22:02 +00:00 committed by Git OBS Bridge
parent 0592986b2d
commit 76bfc77030
7 changed files with 353 additions and 1 deletions

View File

@ -0,0 +1,141 @@
From 0e949d2b5b54ae7cc44ba21a43cecbde5ddaacc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Date: Thu, 8 Jan 2015 16:31:40 +0100
Subject: [PATCH 1/8] Update XCursor settings
Code taken and adjusted from KGlobalSettings.
REVIEW: 121927
CHANGELOG: Update XCursor settings on X11 platform.
---
autotests/CMakeLists.txt | 1 +
src/platformtheme/CMakeLists.txt | 7 +++++-
src/platformtheme/khintssettings.cpp | 44 ++++++++++++++++++++++++++++++++++++
src/platformtheme/khintssettings.h | 1 +
4 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 00337e775e4e2d3e2d1bb583f4102323f0e5973b..e8ed6a99bb45969231ba21b8c5588e093bbbe3ee 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -17,6 +17,7 @@ remove_definitions(-DQT_NO_CAST_FROM_ASCII)
macro(FRAMEWORKINTEGRATION_TESTS _testname)
add_executable(${_testname} ${_testname}.cpp ${ARGN})
+ set_target_properties(${_testname} PROPERTIES COMPILE_FLAGS "-DUNIT_TEST")
add_test(frameworkintegration-${_testname} ${_testname})
ecm_mark_as_test(${_testname})
target_link_libraries(${_testname} Qt5::Test Qt5::DBus KF5::ConfigWidgets KF5::ConfigCore KF5::IconThemes KF5::Style KF5::KIOFileWidgets KF5::I18n KF5::Notifications)
diff --git a/src/platformtheme/CMakeLists.txt b/src/platformtheme/CMakeLists.txt
index 8a3b1b43d617083730517fe8db0a1e2f543913ab..b0d804904b5df2996893046b2b942be6ad952860 100644
--- a/src/platformtheme/CMakeLists.txt
+++ b/src/platformtheme/CMakeLists.txt
@@ -7,6 +7,11 @@ if(NOT APPLE)
set(HAVE_X11 ${XCB_XCB_FOUND})
if (XCB_XCB_FOUND)
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
+ find_package(X11)
+ set_package_properties(X11 PROPERTIES DESCRIPTION "Required for updating the Cursor theme on X11"
+ URL "http://www.x.org"
+ TYPE REQUIRED
+ )
endif()
else()
set(HAVE_X11 FALSE)
@@ -46,7 +51,7 @@ target_link_libraries(KDEPlatformTheme
)
if(HAVE_X11)
- target_link_libraries(KDEPlatformTheme PRIVATE Qt5::X11Extras XCB::XCB)
+ target_link_libraries(KDEPlatformTheme PRIVATE Qt5::X11Extras XCB::XCB ${X11_Xcursor_LIB})
endif()
install(TARGETS KDEPlatformTheme DESTINATION ${QT_PLUGIN_INSTALL_DIR}/platformthemes)
diff --git a/src/platformtheme/khintssettings.cpp b/src/platformtheme/khintssettings.cpp
index a477a1078f7d62294abfffc92a77889832b1e0db..6e8313d02f5392802a4c8155c2b7341b84a4bd39 100644
--- a/src/platformtheme/khintssettings.cpp
+++ b/src/platformtheme/khintssettings.cpp
@@ -33,6 +33,7 @@
#include <QApplication>
#include <QGuiApplication>
#include <QDialogButtonBox>
+#include <QScreen>
#include <QDBusConnection>
#include <QDBusInterface>
@@ -42,6 +43,16 @@
#include <ksharedconfig.h>
#include <kcolorscheme.h>
+#ifndef UNIT_TEST
+#include <config-platformtheme.h>
+#else
+#define HAVE_X11 0
+#endif
+#if HAVE_X11
+#include <QX11Info>
+#include <X11/Xcursor/Xcursor.h>
+#endif
+
static const QString defaultLookAndFeelPackage = "org.kde.breeze.desktop";
KHintsSettings::KHintsSettings() : QObject(0)
@@ -234,6 +245,9 @@ void KHintsSettings::slotNotifyChange(int type, int arg)
case IconChanged:
iconChanged(arg); //Once the KCM is ported to use IconChanged, this should not be needed
break;
+ case CursorChanged:
+ updateCursorTheme();
+ break;
case StyleChanged: {
QApplication *app = qobject_cast<QApplication *>(QCoreApplication::instance());
if (!app) {
@@ -363,3 +377,33 @@ void KHintsSettings::loadPalettes()
}
}
}
+
+void KHintsSettings::updateCursorTheme()
+{
+ KConfig config("kcminputrc");
+ KConfigGroup g(&config, "Mouse");
+
+ QString theme = g.readEntry("cursorTheme", QString());
+ int size = g.readEntry("cursorSize", -1);
+
+ // Default cursor size is 16 points
+ if (size == -1) {
+ if (QScreen *s = QGuiApplication::primaryScreen()) {
+ size = s->logicalDotsPerInchY() * 16 / 72;
+ } else {
+ size = 0;
+ }
+ }
+
+#if HAVE_X11
+ if (QX11Info::isPlatformX11()) {
+ // Note that in X11R7.1 and earlier, calling XcursorSetTheme()
+ // with a NULL theme would cause Xcursor to use "default", but
+ // in 7.2 and later it will cause it to revert to the theme that
+ // was configured when the application was started.
+ XcursorSetTheme(QX11Info::display(), theme.isNull() ?
+ "default" : QFile::encodeName(theme).constData());
+ XcursorSetDefaultSize(QX11Info::display(), size);
+ }
+#endif
+}
diff --git a/src/platformtheme/khintssettings.h b/src/platformtheme/khintssettings.h
index 281e24037b63706ca6af2843e3d38fb2dd10e73c..ec064d32c8516e3647b7731e643bc90d03e7a833 100644
--- a/src/platformtheme/khintssettings.h
+++ b/src/platformtheme/khintssettings.h
@@ -76,6 +76,7 @@ private:
void iconChanged(int group);
void updateQtSettings(KConfigGroup &cg);
Qt::ToolButtonStyle toolButtonStyle(const KConfigGroup &cg) const;
+ void updateCursorTheme();
QStringList xdgIconThemePaths() const;
QHash<QPlatformTheme::Palette, QPalette *> m_palettes;
--
2.2.2

View File

@ -0,0 +1,36 @@
From 52e25019011ef856809fd4317b197d5d37f56454 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Date: Tue, 13 Jan 2015 10:45:38 +0100
Subject: [PATCH 4/8] Only install color scheme on toplevel widgets
ColorSchemeFilter::installColorScheme sets/deletes an xproperty on the
QWidget to be read by the window manager. The window manager is only
interested in toplevel widgets and doesn't monitor child windows at
all. Thus it is not required to perform this method on non toplevel
windows.
The method so far created a native window for each QWidget it operated
on by calling winId. This broke QQuickWidgets when changing the color
scheme as it's not allowed to call QWindow::create on a QQuickWidget.
REVIEW: 122024
---
src/kstyle/kstyle.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kstyle/kstyle.cpp b/src/kstyle/kstyle.cpp
index b5f7363a27337d706beb73363dc0cffa38762ef4..a6c898a49b4f7597493ee31ef9381b8a8f8887df 100644
--- a/src/kstyle/kstyle.cpp
+++ b/src/kstyle/kstyle.cpp
@@ -103,7 +103,7 @@ bool ColorSchemeFilter::eventFilter(QObject *object, QEvent *event)
void ColorSchemeFilter::installColorScheme(QWidget *w)
{
- if (!w) {
+ if (!w || !w->isTopLevel()) {
return;
}
#if HAVE_X11
--
2.2.2

View File

@ -0,0 +1,58 @@
From 072679bd7044021b08a3ef04909719b5b3479f58 Mon Sep 17 00:00:00 2001
From: Martin Klapetek <mklapetek@kde.org>
Date: Wed, 14 Jan 2015 16:13:10 +0100
Subject: [PATCH 5/8] Properly check for systray being available
The "org.kde.StatusNotifierWatcher" is just a watcher/helper, not the
actual systray object, that's "org.kde.StatusNotifierHost-$PID". Because
Plasma appends the PID (as per the specification), we cannot check
directly for it being present on the bus, so we check the
org.kde.StatusNotifierWatcher.IsStatusNotifierHostRegistered property
that's meant to be used for this.
Plus QSystemTrayIcon::isSystemTrayAvailable() is actually returning
always true, because the Watcher is in kded and is /always/ present.
This also fixes many apps with KSNI crashing on plasma exit, bug 339707
(though I believe this is not the direct cause for that bug)
REVIEW: 121885
BUG: 339707
CHANGELOG
---
src/platformtheme/kdeplatformsystemtrayicon.cpp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/platformtheme/kdeplatformsystemtrayicon.cpp b/src/platformtheme/kdeplatformsystemtrayicon.cpp
index b5e207cbff0cf302ef142bb424d6dfbfcad9bbd3..d3a1d4fe2f135ea241e97598a2589558656c1099 100644
--- a/src/platformtheme/kdeplatformsystemtrayicon.cpp
+++ b/src/platformtheme/kdeplatformsystemtrayicon.cpp
@@ -24,9 +24,7 @@
#include <QMenu>
#include <QRect>
#include <QApplication>
-#include <QDBusConnection>
-#include <QDBusConnectionInterface>
-#include <QDBusReply>
+#include <QDBusInterface>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
SystemTrayMenu::SystemTrayMenu()
@@ -327,8 +325,12 @@ void KDEPlatformSystemTrayIcon::showMessage(const QString &msg, const QString &t
bool KDEPlatformSystemTrayIcon::isSystemTrayAvailable() const
{
- QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.StatusNotifierWatcher");
- return reply.value();
+ QDBusInterface systrayHost("org.kde.StatusNotifierWatcher", "/StatusNotifierWatcher", "org.kde.StatusNotifierWatcher");
+ if (systrayHost.isValid()) {
+ return systrayHost.property("IsStatusNotifierHostRegistered").toBool();
+ }
+
+ return false;
}
bool KDEPlatformSystemTrayIcon::supportsMessages() const
--
2.2.2

View File

@ -0,0 +1,38 @@
From 2211793a69115cb5d0e61c40e9333d43a80fc0af Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Wed, 28 Jan 2015 18:25:17 +0100
Subject: [PATCH 7/8] Use activate on single click setting from QPlatformTheme
Our QPlatformTheme already provide a hint as to whether items should
activate on single click and it updates when the setting changes
QCommonStyle by default uses the QPlatformTheme
This removes duplicating the lookup and also means we now update the
setting if it changes at runtime
REVIEW: 122293
BUG: 343418
---
src/kstyle/kstyle.cpp | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/kstyle/kstyle.cpp b/src/kstyle/kstyle.cpp
index a6c898a49b4f7597493ee31ef9381b8a8f8887df..3b8c8f314224a8240ff50a48164e81d2ba315554 100644
--- a/src/kstyle/kstyle.cpp
+++ b/src/kstyle/kstyle.cpp
@@ -416,11 +416,6 @@ QIcon KStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption */*op
int KStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
switch (hint) {
- case SH_ItemView_ActivateItemOnSingleClick: {
- KConfigGroup g(KSharedConfig::openConfig(), "KDE");
- return g.readEntry("SingleClick", true);
- }
-
case SH_DialogButtonBox_ButtonsHaveIcons: {
// was KGlobalSettings::showIconsOnPushButtons() :
KConfigGroup g(KSharedConfig::openConfig(), "KDE");
--
2.2.2

View File

@ -0,0 +1,49 @@
From a09034c57ee00e7c16c2db4fd43f1993ee2e686d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= <lukas@kde.org>
Date: Fri, 30 Jan 2015 00:05:43 +0100
Subject: [PATCH 8/8] Implement SystemTrayMenuItem::setMenu() correctly
REVIEW: 122171
---
src/platformtheme/kdeplatformsystemtrayicon.cpp | 5 +++--
src/platformtheme/kdeplatformsystemtrayicon.h | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/platformtheme/kdeplatformsystemtrayicon.cpp b/src/platformtheme/kdeplatformsystemtrayicon.cpp
index d3a1d4fe2f135ea241e97598a2589558656c1099..84dc6c06aa5d076990229edc00b500b26e41258b 100644
--- a/src/platformtheme/kdeplatformsystemtrayicon.cpp
+++ b/src/platformtheme/kdeplatformsystemtrayicon.cpp
@@ -144,7 +144,6 @@ QMenu *SystemTrayMenu::menu() const
SystemTrayMenuItem::SystemTrayMenuItem()
: QPlatformMenuItem()
, m_tag(0)
- , m_menu(Q_NULLPTR)
, m_action(new QAction(this))
{
connect(m_action, &QAction::triggered, this, &QPlatformMenuItem::activated);
@@ -187,7 +186,9 @@ void SystemTrayMenuItem::setIsSeparator(bool isSeparator)
void SystemTrayMenuItem::setMenu(QPlatformMenu *menu)
{
- m_menu = menu;
+ if (SystemTrayMenu *ourMenu = qobject_cast<SystemTrayMenu *>(menu)) {
+ m_action->setMenu(ourMenu->menu());
+ }
}
void SystemTrayMenuItem::setRole(QPlatformMenuItem::MenuRole role)
diff --git a/src/platformtheme/kdeplatformsystemtrayicon.h b/src/platformtheme/kdeplatformsystemtrayicon.h
index 3c1bbf71bc1e730754504a123c7bdfd8e1f19a24..e9e872e39e253b7cfbab6cb58cfbc7272e5046f5 100644
--- a/src/platformtheme/kdeplatformsystemtrayicon.h
+++ b/src/platformtheme/kdeplatformsystemtrayicon.h
@@ -82,7 +82,6 @@ public:
private:
quintptr m_tag;
- QPlatformMenu *m_menu;
QAction *m_action;
};
#endif
--
2.2.2

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Jan 30 02:06:30 UTC 2015 - hrvoje.senjan@gmail.com
- Added patches from upstream:
0001-Update-XCursor-settings.patch,
0005-Properly-check-for-systray-being-available.patch (kde#339707),
0004-Only-install-color-scheme-on-toplevel-widgets.patch,
0007-Use-activate-on-single-click-setting-from-QPlatformT.patch
(kde#343418) and
0008-Implement-SystemTrayMenuItem-setMenu-correctly.patch
- Added pkgconfig(x11) and pkgconfig(xcursor) BuildRequires, needed
for 0001-Update-XCursor-settings.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Jan 3 18:03:16 UTC 2015 - hrvoje.senjan@gmail.com Sat Jan 3 18:03:16 UTC 2015 - hrvoje.senjan@gmail.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package frameworkintegration # spec file for package frameworkintegration
# #
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -36,7 +36,9 @@ BuildRequires: libQt5Gui-private-headers-devel >= 5.2.0
BuildRequires: pkgconfig(Qt5DBus) >= 5.2.0 BuildRequires: pkgconfig(Qt5DBus) >= 5.2.0
BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0 BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0
BuildRequires: pkgconfig(Qt5X11Extras) >= 5.2.0 BuildRequires: pkgconfig(Qt5X11Extras) >= 5.2.0
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xcb) BuildRequires: pkgconfig(xcb)
BuildRequires: pkgconfig(xcursor)
Requires: kde-oxygen-fonts Requires: kde-oxygen-fonts
Summary: Plugins responsible for better integration of Qt applications in KDE Workspace Summary: Plugins responsible for better integration of Qt applications in KDE Workspace
License: LGPL-2.1+ License: LGPL-2.1+
@ -44,6 +46,16 @@ Group: System/GUI/KDE
Url: http://www.kde.org Url: http://www.kde.org
Source: http://download.kde.org/stable/frameworks/5.6/%{name}-%{version}.tar.xz Source: http://download.kde.org/stable/frameworks/5.6/%{name}-%{version}.tar.xz
Source1: baselibs.conf Source1: baselibs.conf
# PATCH-FIX-UPSTREAM 0001-Update-XCursor-settings.patch
Patch0: 0001-Update-XCursor-settings.patch
# PATCH-FIX-UPSTREAM 0004-Only-install-color-scheme-on-toplevel-widgets.patch
Patch1: 0004-Only-install-color-scheme-on-toplevel-widgets.patch
# PATCH-FIX-UPSTREAM 0005-Properly-check-for-systray-being-available.patch
Patch2: 0005-Properly-check-for-systray-being-available.patch
# PATCH-FIX-UPSTREAM 0007-Use-activate-on-single-click-setting-from-QPlatformT.patch
Patch3: 0007-Use-activate-on-single-click-setting-from-QPlatformT.patch
# PATCH-FIX-UPSTREAM 0008-Implement-SystemTrayMenuItem-setMenu-correctly.patch
Patch4: 0008-Implement-SystemTrayMenuItem-setMenu-correctly.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
@ -97,6 +109,11 @@ Applications do not need to link to this directly. Development files
%lang_package -n %lname %lang_package -n %lname
%prep %prep
%setup -q %setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build %build
%cmake_kf5 -d build %cmake_kf5 -d build