[plasma-desktop] /: [Cursors] Remove Resolution Dependant option

Benjamin Port null at kde.org
Fri Apr 17 13:46:25 BST 2020


Git commit a68554d39c5c64cc1572cfd486064d06e6fc850a by Benjamin Port.
Committed on 17/04/2020 at 12:45.
Pushed by bport into branch 'master'.

[Cursors] Remove Resolution Dependant option

Summary:
This option don't work as expected for years on X, and current wayland protocol don't allow to have a proper size for all application (each framework came with this own solution for this option, that mean we will not have same cursor size on different application)

We set default size as 24

BUG: 385920
BUG: 413783

Reviewers: #plasma, meven, davidedmundson, ngraham

Reviewed By: ngraham

Subscribers: ngraham, plasma-devel, kde-doc-english

Tags: #plasma, #documentation

Maniphest Tasks: T12040

Differential Revision: https://phabricator.kde.org/D28652

M  +1    -1    doc/kcontrol/cursortheme/index.docbook
M  +1    -0    kcms/cursortheme/CMakeLists.txt
M  +1    -1    kcms/cursortheme/cursorthemesettings.kcfg
A  +10   -0    kcms/cursortheme/delete_cursor_old_default_size.pl
A  +8    -0    kcms/cursortheme/delete_cursor_old_default_size.upd
M  +1    -8    kcms/cursortheme/kcmcursortheme.cpp
M  +1    -1    kcms/krdb/krdb.cpp
M  +1    -1    kcms/lookandfeel/kcm.cpp
M  +4    -14   kcms/mouse/backends/x11/x11_backend.cpp

https://commits.kde.org/plasma-desktop/a68554d39c5c64cc1572cfd486064d06e6fc850a

diff --git a/doc/kcontrol/cursortheme/index.docbook b/doc/kcontrol/cursortheme/index.docbook
index 690bb8c19..2d4b0a8f6 100644
--- a/doc/kcontrol/cursortheme/index.docbook
+++ b/doc/kcontrol/cursortheme/index.docbook
@@ -53,7 +53,7 @@ displayed hoovering a theme.
 </para>
 
 <para>
-The size can be set to the <guilabel>Resolution dependent</guilabel> or one of the sizes available for your theme.
+The size can be set to one of the sizes available for your theme.
 </para>
 
 </article>
diff --git a/kcms/cursortheme/CMakeLists.txt b/kcms/cursortheme/CMakeLists.txt
index da2007614..a429ba906 100644
--- a/kcms/cursortheme/CMakeLists.txt
+++ b/kcms/cursortheme/CMakeLists.txt
@@ -54,6 +54,7 @@ kcoreaddons_desktop_to_json(kcm_cursortheme "kcm_cursortheme.desktop")
 ########### install files ###############
 
 install(FILES cursorthemesettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
+install(FILES delete_cursor_old_default_size.upd delete_cursor_old_default_size.pl DESTINATION ${KDE_INSTALL_DATADIR}/kconf_update)
 install( FILES kcm_cursortheme.desktop  DESTINATION  ${KDE_INSTALL_KSERVICES5DIR} )
 install( FILES xcursor/xcursor.knsrc DESTINATION  ${KDE_INSTALL_KNSRCDIR} )
 
diff --git a/kcms/cursortheme/cursorthemesettings.kcfg b/kcms/cursortheme/cursorthemesettings.kcfg
index c6a8810ff..2b0d93e25 100644
--- a/kcms/cursortheme/cursorthemesettings.kcfg
+++ b/kcms/cursortheme/cursorthemesettings.kcfg
@@ -11,7 +11,7 @@
     </entry>
     <entry name="cursorSize" type="Int">
       <label>Current cursor size</label>
-      <default>0</default>
+      <default>24</default>
     </entry>
   </group>
 </kcfg>
diff --git a/kcms/cursortheme/delete_cursor_old_default_size.pl b/kcms/cursortheme/delete_cursor_old_default_size.pl
new file mode 100644
index 000000000..7fec429e2
--- /dev/null
+++ b/kcms/cursortheme/delete_cursor_old_default_size.pl
@@ -0,0 +1,10 @@
+#! /usr/bin/perl
+
+use strict;
+
+while (<>)
+{
+    chomp;
+    s/cursorSize=0/# DELETE cursorSize/;
+    print "$_\n";
+}
diff --git a/kcms/cursortheme/delete_cursor_old_default_size.upd b/kcms/cursortheme/delete_cursor_old_default_size.upd
new file mode 100644
index 000000000..d615b4c85
--- /dev/null
+++ b/kcms/cursortheme/delete_cursor_old_default_size.upd
@@ -0,0 +1,8 @@
+Version=5
+
+# Delete cursor size if it's old default
+Id=DeleteCursorOldDefaultSize
+Options=overwrite
+File=kcminputrc
+Group=Mouse
+Script=delete_cursor_old_default_size.pl,perl
diff --git a/kcms/cursortheme/kcmcursortheme.cpp b/kcms/cursortheme/kcmcursortheme.cpp
index bb0ee9824..bee0e3024 100644
--- a/kcms/cursortheme/kcmcursortheme.cpp
+++ b/kcms/cursortheme/kcmcursortheme.cpp
@@ -217,11 +217,7 @@ void CursorThemeConfig::updateSizeComboBox()
             if (m_pixmap.height() > maxIconHeight) {
                 maxIconHeight = m_pixmap.height();
             }
-            QStandardItem *item = new QStandardItem(QIcon(m_pixmap),
-                i18nc("@item:inlistbox size", "Resolution dependent"));
-            item->setData(0);
-            m_sizesModel->appendRow(item);
-            comboBoxList << 0;
+
             foreach (i, sizes) {
                 m_pixmap = theme->createIcon(i);
                 if (m_pixmap.width() > maxIconWidth) {
@@ -332,9 +328,6 @@ bool CursorThemeConfig::applyTheme(const CursorTheme *theme, const int size)
 int CursorThemeConfig::cursorSizeIndex(int cursorSize) const
 {
     if (m_sizesModel->rowCount() > 0) {
-         if (cursorSize  == 0) {
-             return 0;
-         }
          const auto items = m_sizesModel->findItems(QString::number(cursorSize));
          if (items.count() == 1) {
              return items.first()->row();
diff --git a/kcms/krdb/krdb.cpp b/kcms/krdb/krdb.cpp
index 397edd849..902d813e7 100644
--- a/kcms/krdb/krdb.cpp
+++ b/kcms/krdb/krdb.cpp
@@ -488,7 +488,7 @@ void runRdb( uint flags )
   // Export the Xcursor theme & size settings
   KConfigGroup mousecfg(KSharedConfig::openConfig( QStringLiteral("kcminputrc") ), "Mouse" );
   QString theme = mousecfg.readEntry("cursorTheme", QString("breeze_cursors"));
-  QString size  = mousecfg.readEntry("cursorSize", QString("0"));
+  QString size  = mousecfg.readEntry("cursorSize", QString("24"));
   QString contents;
 
   if (!theme.isNull())
diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp
index 296725e6f..50e625982 100644
--- a/kcms/lookandfeel/kcm.cpp
+++ b/kcms/lookandfeel/kcm.cpp
@@ -478,7 +478,7 @@ void KCMLookandFeel::setCursorTheme(const QString themeName)
     // in previous versions the Xfixes code wasn't enabled due to a bug in the
     // build system (freedesktop bug #975).
 #if defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105
-    const int cursorSize = cg.readEntry("cursorSize", 0);
+    const int cursorSize = cg.readEntry("cursorSize", 24);
 
     QDir themeDir = cursorThemeDir(themeName, 0);
 
diff --git a/kcms/mouse/backends/x11/x11_backend.cpp b/kcms/mouse/backends/x11/x11_backend.cpp
index d256279a1..54d5d4e9f 100644
--- a/kcms/mouse/backends/x11/x11_backend.cpp
+++ b/kcms/mouse/backends/x11/x11_backend.cpp
@@ -127,30 +127,20 @@ void X11Backend::kcmInit()
     auto config = KSharedConfig::openConfig("kcminputrc", KConfig::NoGlobals);
     KConfigGroup group = config->group("Mouse");
     QString theme = group.readEntry("cursorTheme", QString());
-    QString size = group.readEntry("cursorSize", QString());
-
-    int intSize = -1;
-    if (size.isEmpty()) {
-        bool ok;
-        uint value = size.toUInt(&ok);
-        if (ok) {
-            intSize = value;
-        }
-    }
+    const int size = group.readEntry("cursorSize", 24);
+
     // Note: If you update this code, update kapplymousetheme as well.
 
     // use a default value for theme only if it's not configured at all, not even in X resources
     if (theme.isEmpty() && currentCursorTheme().isEmpty()) {
         theme = "breeze_cursors";
     }
-    applyCursorTheme(theme, intSize);
+    applyCursorTheme(theme, size);
 
     // Tell klauncher to set the XCURSOR_THEME and XCURSOR_SIZE environment
     // variables when launching applications.
     if (!theme.isEmpty()) {
         UpdateLaunchEnvJob launchEnvJob(QStringLiteral("XCURSOR_THEME"), theme);
     }
-    if (!size.isEmpty()) {
-        UpdateLaunchEnvJob launchEnvJob(QStringLiteral("XCURSOR_SIZE"), size);
-    }
+    UpdateLaunchEnvJob launchEnvJob(QStringLiteral("XCURSOR_SIZE"), QByteArray::number(size));
 }


More information about the kde-doc-english mailing list