rpms/kcm-gtk/devel kcm-gtk-0.5.3-cursortheme.patch, NONE, 1.1 kcm-gtk.spec, 1.4, 1.5

Ville Skyttä scop at fedoraproject.org
Tue Jul 6 21:10:06 UTC 2010


Author: scop

Update of /cvs/pkgs/rpms/kcm-gtk/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv29384

Modified Files:
	kcm-gtk.spec 
Added Files:
	kcm-gtk-0.5.3-cursortheme.patch 
Log Message:
* Wed Jul  7 2010 Ville Skyttä <ville.skytta at iki.fi> - 0.5.3-4
- Apply modified upstream patch to add cursor theme support (#600976).


kcm-gtk-0.5.3-cursortheme.patch:
 gtkrcfile.cpp   |    9 +++++++++
 gtkrcfile.h     |    3 +++
 kcmgtk.cpp      |   44 ++++++++++++++++++++++++++++++++++++++++++++
 kcmgtk.h        |    3 +++
 kcmgtkwidget.ui |   41 ++++++++++++++++++++++++++++++++++-------
 5 files changed, 93 insertions(+), 7 deletions(-)

--- NEW FILE kcm-gtk-0.5.3-cursortheme.patch ---
https://bugs.launchpad.net/kcm-gtk/+bug/505988
https://bugs.launchpad.net/kcm-gtk/+bug/505988/comments/4

diff -up kcm-gtk-0.5.3/gtkrcfile.cpp.cursortheme kcm-gtk-0.5.3/gtkrcfile.cpp
--- kcm-gtk-0.5.3/gtkrcfile.cpp.cursortheme	2010-07-06 21:53:45.363892421 +0300
+++ kcm-gtk-0.5.3/gtkrcfile.cpp	2010-07-06 21:54:28.198889669 +0300
@@ -44,6 +44,7 @@ void GtkRcFile::load()
 	
 	QRegExp includeRe("include\\s*\"([^\"]*)\"");
 	QRegExp fontRe("gtk-font-name\\s*=\\s*\"([^\"]*)\"");
+	QRegExp cursorRe("gtk-cursor-theme-name\\s*=\\s*\"([^\"]*)\"");
 	
 	
 	QStringList includes;
@@ -75,6 +76,13 @@ void GtkRcFile::load()
 			// Assume there will only be one font line
 			parseFont(fontRe.cap(1));
 		}
+		if (line.startsWith("gtk-cursor-theme-name"))
+		{
+			if (cursorRe.indexIn(line) == -1)
+				continue;
+			// Assume there will only be one cursor theme line
+			setCursor(cursorRe.cap(1));
+		}
 	}
 	
 	file.close();
@@ -136,6 +144,7 @@ void GtkRcFile::save()
 	stream << "\n";
 	stream << "gtk-theme-name=\"" << m_themeName << "\"\n";
 	stream << "gtk-font-name=\"" << fontName << "\"\n";
+	stream << "gtk-cursor-theme-name = \"" << m_cursorName << "\"\n";
 	
 	QByteArray gtkrc = getenv("GTK2_RC_FILES");
 	QStringList list = QFile::decodeName(gtkrc).split( ':');
diff -up kcm-gtk-0.5.3/gtkrcfile.h.cursortheme kcm-gtk-0.5.3/gtkrcfile.h
--- kcm-gtk-0.5.3/gtkrcfile.h.cursortheme	2009-10-23 16:07:44.000000000 +0300
+++ kcm-gtk-0.5.3/gtkrcfile.h	2010-07-06 21:54:55.959889181 +0300
@@ -34,10 +34,12 @@ public:
 	
 	QString fileName() const { return m_fileName; }
 	QString themeName() const { return m_themeName; }
+	QString cursorName() const { return m_cursorName; }
 	QString themePath() const { return m_themePath; }
 	QFont font() const { return m_font; }
 	
 	void setTheme(const QString& path);
+	void setCursor(const QString& cursor) { m_cursorName = cursor; };
 	void setFont(const QFont& font) { m_font = font; }
 	void setFont(const QString& family, int pointSize, bool bold, bool italic);
 	
@@ -46,6 +48,7 @@ private:
 	
 	QString m_fileName;
 	QString m_themeName;
+	QString m_cursorName;
 	QString m_themePath;
 	QFont m_font;
 	
diff -up kcm-gtk-0.5.3/kcmgtk.cpp.cursortheme kcm-gtk-0.5.3/kcmgtk.cpp
--- kcm-gtk-0.5.3/kcmgtk.cpp.cursortheme	2009-10-23 16:07:44.000000000 +0300
+++ kcm-gtk-0.5.3/kcmgtk.cpp	2010-07-06 21:54:55.960890384 +0300
@@ -51,11 +51,13 @@ KcmGtk::KcmGtk(QWidget* parent, const QV
 	connect(m_ui.fontChange, SIGNAL(clicked()), SLOT(fontChangeClicked()));
 	connect(m_ui.fontKde, SIGNAL(clicked(bool)), SLOT(fontKdeClicked()));
 	connect(m_ui.styleBox, SIGNAL(activated(int)), SLOT(styleChanged()));
+	connect(m_ui.cursorBox, SIGNAL(activated(int)), SLOT(cursorChanged()));
 	
 	m_gtkRc = new GtkRcFile(k_gtkRcFileName);
 	
 	m_searchPaths = new SearchPaths(this);
 	connect(m_searchPaths, SIGNAL(accepted()), SLOT(getInstalledThemes()));
+	connect(m_searchPaths, SIGNAL(accepted()), SLOT(getInstalledCursors()));
 	connect(m_ui.warning3, SIGNAL(clicked()), m_searchPaths, SLOT(exec()));
 	
 	// Load icons
@@ -72,6 +74,7 @@ KcmGtk::KcmGtk(QWidget* parent, const QV
 	
 	// Load GTK settings
 	getInstalledThemes();
+	getInstalledCursors();
 	load();
 	setButtons(Apply);
 }
@@ -89,6 +92,7 @@ void KcmGtk::load()
 	checkQtCurve();
 
 	m_ui.styleBox->setCurrentIndex(m_themes.keys().indexOf(m_gtkRc->themeName()));
+	m_ui.cursorBox->setCurrentIndex(m_cursors.keys().indexOf(m_gtkRc->cursorName()));
 	
 	QFont defaultFont;
 	bool usingKdeFont = (m_gtkRc->font().family() == defaultFont.family() &&
@@ -117,6 +121,40 @@ void KcmGtk::defaults()
 {
 }
 
+void KcmGtk::getInstalledCursors()
+{
+	m_cursors.clear();
+	Q_FOREACH (QString path, m_searchPaths->paths())
+	{
+		path += "/share/icons/";
+		Q_FOREACH (QString subdir, QDir(path).entryList(QDir::Dirs, QDir::Unsorted))
+		{
+			if (subdir.startsWith('.'))
+				continue;
+			if (m_cursors.contains(subdir))
+				continue;
+			if (QFile::exists(path + subdir + "/cursors"))
+				m_cursors[subdir] = subdir;
+		}
+	}
+
+	/* search user home dir for any custom icons too. user changes
+     * override the system cursor icons if the same exists in user home dir */
+	QString apath = QDir::homePath() + "/.icons/";
+	Q_FOREACH (QString subdir, QDir(apath).entryList(QDir::Dirs, QDir::Unsorted))
+		{
+			if (subdir.startsWith('.'))
+				continue;
+			if (m_cursors.contains(subdir))
+				continue;
+			if (QFile::exists(apath + subdir + "/cursors"))
+				m_cursors[subdir] = subdir;
+		}
+
+	m_ui.cursorBox->clear();
+	m_ui.cursorBox->addItems(m_cursors.keys());
+}
+
 void KcmGtk::getInstalledThemes()
 {
 	m_themes.clear();
@@ -157,6 +195,12 @@ void KcmGtk::fontKdeClicked()
 	updateFontPreview();
 	changed(true);
 }
+ 
+void KcmGtk::cursorChanged()
+{
+	m_gtkRc->setCursor(m_cursors[m_ui.cursorBox->currentText()]);
+	changed(true);
+}
 
 void KcmGtk::styleChanged()
 {
diff -up kcm-gtk-0.5.3/kcmgtk.h.cursortheme kcm-gtk-0.5.3/kcmgtk.h
--- kcm-gtk-0.5.3/kcmgtk.h.cursortheme	2009-10-23 16:07:44.000000000 +0300
+++ kcm-gtk-0.5.3/kcmgtk.h	2010-07-06 21:54:55.961889910 +0300
@@ -45,7 +45,9 @@ private Q_SLOTS:
 	void fontChangeClicked();
 	void fontKdeClicked();
 	void styleChanged();
+	void cursorChanged();
 	void getInstalledThemes();
+	void getInstalledCursors();
 
 private:
 	void updateFontPreview();
@@ -55,6 +57,7 @@ private:
 	
 	GtkRcFile* m_gtkRc;
 	QMap<QString, QString> m_themes;
+	QMap<QString, QString> m_cursors;
 	SearchPaths* m_searchPaths;
 	
 	static const QString k_gtkRcFileName;
diff -up kcm-gtk-0.5.3/kcmgtkwidget.ui.cursortheme kcm-gtk-0.5.3/kcmgtkwidget.ui
--- kcm-gtk-0.5.3/kcmgtkwidget.ui.cursortheme	2009-10-23 16:07:44.000000000 +0300
+++ kcm-gtk-0.5.3/kcmgtkwidget.ui	2010-07-06 21:54:55.962890275 +0300
@@ -6,11 +6,12 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>543</width>
+    <width>549</width>
     <height>429</height>
    </rect>
   </property>
   <property name="windowTitle">
+   <string/>
   </property>
   <layout class="QVBoxLayout">
    <item>
@@ -19,7 +20,7 @@
       <string>GTK+ Styles</string>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0" rowspan="2">
+      <item row="0" column="0" rowspan="4">
        <layout class="QVBoxLayout">
         <item>
          <widget class="QLabel" name="styleIcon"/>
@@ -39,7 +40,7 @@
         </item>
        </layout>
       </item>
-      <item row="0" column="1">
+      <item row="0" column="2">
        <widget class="QLabel" name="label">
         <property name="text">
          <string>&amp;Widget style:</string>
@@ -49,10 +50,10 @@
         </property>
        </widget>
       </item>
-      <item row="0" column="2">
+      <item row="0" column="3">
        <widget class="QComboBox" name="styleBox"/>
       </item>
-      <item row="0" column="3">
+      <item row="0" column="5">
        <spacer>
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
@@ -65,14 +66,14 @@
         </property>
        </spacer>
       </item>
-      <item row="1" column="1" colspan="2">
+      <item row="3" column="2" colspan="2">
        <widget class="QPushButton" name="warning3">
         <property name="text">
          <string>Change search paths...</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="3">
+      <item row="3" column="5">
        <spacer>
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
@@ -85,6 +86,32 @@
         </property>
        </spacer>
       </item>
+      <item row="1" column="2">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>&amp;Cursor Style</string>
+        </property>
+        <property name="buddy">
+         <cstring>cursorBox</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="3">
+       <widget class="QComboBox" name="cursorBox"/>
+      </item>
+      <item row="1" column="5">
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
      </layout>
     </widget>
    </item>


Index: kcm-gtk.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kcm-gtk/devel/kcm-gtk.spec,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- kcm-gtk.spec	25 Dec 2009 22:01:10 -0000	1.4
+++ kcm-gtk.spec	6 Jul 2010 21:10:06 -0000	1.5
@@ -8,7 +8,7 @@
 Summary: Configure the appearance of GTK apps in KDE 
 Name:    kcm-gtk 
 Version: 0.5.3
-Release: 3%{?dist}
+Release: 4%{?dist}
 
 License: GPLv2+
 Group:   User Interface/Desktops
@@ -28,6 +28,10 @@ Patch51: kcm-gtk-0.5.3-gtkrc_setenv.patc
 # fix missing umlauts and sharp s in the German translation
 # The translations need a lot more fixing than that, but this looks very broken!
 Patch52: kcm-gtk-0.5.3-fix-de.patch
+# https://bugs.launchpad.net/kcm-gtk/+bug/505988, already upstream
+# Modified so that it applies over the setenv patch, and removed index.theme
+# existence check: https://bugs.launchpad.net/kcm-gtk/+bug/505988/comments/4
+Patch53: kcm-gtk-0.5.3-cursortheme.patch
 
 %if 0%{?fedora} > 11
 Obsoletes: gtk-qt-engine <= 1:1.1
@@ -48,6 +52,7 @@ appearance of GTK apps in KDE.
 %patch50 -p1 -b .settings_category
 %patch51 -p1 -b .gtkrc_setenv
 %patch52 -p1 -b .fix-de
+%patch53 -p1 -b .cursortheme
 
 
 %build
@@ -84,6 +89,9 @@ rm -rf %{buildroot} 
 
 
 %changelog
+* Wed Jul  7 2010 Ville Skyttä <ville.skytta at iki.fi> - 0.5.3-4
+- Apply modified upstream patch to add cursor theme support (#600976).
+
 * Fri Dec 25 2009 Rex Dieter <rdieter at fedoraproject.org> 0.5.3-3
 - GTK2_RC_FILES handling moved to kde-settings (#547700)
 



More information about the scm-commits mailing list