[SCM] KDE Base Workspace module packaging branch, master, updated. debian/4.4.5-3-4-g27f06b8

Modestas Vainius modax at alioth.debian.org
Sun Oct 17 10:30:28 UTC 2010


The following commit has been merged in the master branch:
commit 27f06b84a2cb6c34a155f318a817a21355eaafe1
Author: Modestas Vainius <modestas at vainius.eu>
Date:   Sun Oct 17 13:21:04 2010 +0300

    Add patch which restores support for changing RandR settings on KDE startup
    
    KDE 3.5 used to have this feature. Actually, old code was still present in this
    version of KDE 4 but it was severily broken and has never worked with modern
    RandR 1.2 or higher. This patch attempts to address this problem. It's not very
    intrusive hence it would be a shame not to include it.
    
    Since Debian is pushing xorg.conf'less X now, so restoring non-Xorg-default
    RandR settings on startup becomes essential for users who have to deal with
    pretty frequent problems like:
    
    1) monitor reports incorrect or no EDID data to Xorg;
    2) users just want lower/higher resolution than default selected by Xorg;
    2) users have more complex setup like 2 monitors or monitor + TV.
    
    Original author of the patch is upstream developer Lubos Lunak. Thanks to Timo
    Boettcher for adapting (slight differences in startkde) and testing the patch
    on Debian's KDE 4.4. The patch also contains minor refactoring by me which aims
    to minimize the startkde diff.
    
    Bug: https://bugs.kde.org/show_bug.cgi?id=183143
    Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596473
    Origin: backport http://websvn.kde.org/?view=rev&revision=1170315
    Last-Update: 2010-10-17
    Applied-Upstream: 4.6
---
 debian/changelog                                   |    2 +
 ...29_backport_fix_krandr_support_in_startkde.diff |  391 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 3 files changed, 394 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4dec951..2dc54ca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ kdebase-workspace (4:4.4.5-4~pre1) UNRELEASED; urgency=low
   [ Modestas Vainius ]
   * Backport oneliner patch which is likely to fix dual head support in plasma
     (KDE bug #156475).
+  * Add back support for changing RandR settings on KDE startup (patch
+    29_backport_fix_krandr_support_in_startkde.diff). (Closes: #596473)
 
  -- Frederik Schwarzer <schwarzerf at gmail.com>  Sun, 26 Sep 2010 16:17:42 +0200
 
diff --git a/debian/patches/29_backport_fix_krandr_support_in_startkde.diff b/debian/patches/29_backport_fix_krandr_support_in_startkde.diff
new file mode 100644
index 0000000..0bb3342
--- /dev/null
+++ b/debian/patches/29_backport_fix_krandr_support_in_startkde.diff
@@ -0,0 +1,391 @@
+From: Lubos Lunak <l.lunak at kde.org>
+From: Timo Boettcher <debian at timoboettcher.name>
+From: Modestas Vainius <modax at debian.org>
+Subject: Add back support for changing RandR settings on KDE startup
+Bug: https://bugs.kde.org/show_bug.cgi?id=183143
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596473
+Origin: backport http://websvn.kde.org/?view=rev&revision=1170315
+Last-Update: 2010-10-17
+Applied-Upstream: 4.6
+
+KDE 3.5 used to have this feature. Actually, old code was still present in this
+version of KDE 4 but it was severily broken and has never worked with modern
+RandR 1.2 or higher. This patch attempts to address this problem. It's not very
+intrusive hence it would be a shame not to include it.
+
+Since Debian is pushing xorg.conf'less X now, so restoring non-Xorg-default
+RandR settings on startup becomes essential for users who have to deal with
+pretty frequent problems like:
+
+1) monitor reports incorrect or no EDID data to Xorg;
+2) users just want lower/higher resolution than default selected by Xorg;
+2) users have more complex setup like 2 monitors or monitor + TV.
+
+Original author of the patch is upstream developer Lubos Lunak. Thanks to Timo
+Boettcher for adapting (slight differences in startkde) and testing the patch
+on Debian's KDE 4.4. The patch also contains minor refactoring by me which aims
+to minimize the startkde diff.
+--- a/kcontrol/randr/legacyrandrconfig.cpp
++++ b/kcontrol/randr/legacyrandrconfig.cpp
+@@ -92,7 +92,11 @@ void LegacyRandRConfig::save()
+ 	m_oldApply = applyOnStartup->isChecked();
+ 	m_oldSyncTrayApp = syncTrayApp->isChecked();
+ 	KConfig config("krandrrc");
+-	m_display->saveDisplay(config, m_oldApply, m_oldSyncTrayApp);
++	m_display->saveDisplay(config, m_oldSyncTrayApp);
++	if(m_oldApply)
++		m_display->saveStartup(config);
++	else
++		m_display->disableStartup(config);
+ 
+ 	setChanged();
+ }
+--- a/kcontrol/randr/legacyrandrscreen.cpp
++++ b/kcontrol/randr/legacyrandrscreen.cpp
+@@ -388,6 +388,28 @@ void LegacyRandRScreen::save(KConfig& co
+ 	group.writeEntry("reflectY", (bool)(rotation() & RandR::ReflectMask) == RandR::ReflectY);
+ }
+ 
++QStringList LegacyRandRScreen::startupCommands() const
++{
++	QString command = QString("xrandr -s %1x%2 -r %3 ").arg( currentPixelSize().width(),
++	    currentPixelSize().height(), refreshRateIndexToHz(size(), refreshRate()));
++	switch( rotation()) {
++		case RR_Rotate_90:
++			command += " -o 1 ";
++			break;
++		case RR_Rotate_180:
++			command += " -o 2 ";
++			break;
++		case RR_Rotate_270:
++			command += " -o 3 ";
++			break;
++	}
++	if((rotation() & RandR::ReflectMask) == RandR::ReflectX)
++		command += " -x ";
++	if((bool)(rotation() & RandR::ReflectMask) == RandR::ReflectY)
++		command += " -y ";
++	return QStringList() << command;
++}
++
+ int LegacyRandRScreen::pixelCount( int index ) const
+ {
+ 	QSize sz = pixelSize(index);
+--- a/kcontrol/randr/legacyrandrscreen.h
++++ b/kcontrol/randr/legacyrandrscreen.h
+@@ -130,6 +130,7 @@ public:
+ 	 */
+ 	void load(KConfig& config);
+ 	void save(KConfig& config) const;
++	QStringList startupCommands() const;
+ 
+ private:
+ 	XRRScreenConfiguration*	m_config;
+--- a/kcontrol/randr/randrconfigbase.ui
++++ b/kcontrol/randr/randrconfigbase.ui
+@@ -44,6 +44,13 @@
+          </property>
+         </widget>
+        </item>
++       <item>
++        <widget class="QPushButton" name="saveAsDefaultButton">
++         <property name="text">
++          <string>Save as Default</string>
++         </property>
++        </widget>
++       </item>
+       </layout>
+      </widget>
+      <widget class="QGraphicsView" name="screenView"/>
+--- a/kcontrol/randr/randrconfig.cpp
++++ b/kcontrol/randr/randrconfig.cpp
+@@ -31,6 +31,8 @@
+ #include <kglobalsettings.h>
+ #include <kmessagebox.h>
+ #include <kprocess.h>
++#include <kshell.h>
++#include <qmenu.h>
+ 
+ RandRConfig::RandRConfig(QWidget *parent, RandRDisplay *display)
+ 	: QWidget(parent), Ui::RandRConfigBase()
+@@ -54,6 +56,12 @@ RandRConfig::RandRConfig(QWidget *parent
+ 	identifyTimer.setSingleShot( true );
+ 	compressUpdateViewTimer.setSingleShot( true );
+ 
++	connect( saveAsDefaultButton, SIGNAL( clicked()), SLOT( saveStartup()));
++	QMenu* saveMenu = new QMenu(saveAsDefaultButton);
++	saveMenu->addAction(i18n("Save as Default"),this, SLOT(saveStartup()));
++	saveMenu->addAction(i18n("Reset"),this, SLOT(disableStartup()));
++	saveAsDefaultButton->setMenu(saveMenu);
++
+ 	// create the container for the settings widget
+ 	QHBoxLayout *layout = new QHBoxLayout(outputList);
+ 	layout->setSpacing(0);
+@@ -214,6 +222,25 @@ void RandRConfig::update()
+ 	emit changed(false);
+ }
+ 
++void RandRConfig::saveStartup()
++{
++	if (!m_display->isValid())
++		return;
++	KConfig config("krandrrc");
++	m_display->saveStartup(config);
++	KMessageBox::information( window(), i18n( "Configuration has been set as the desktop default." ));
++}
++
++void RandRConfig::disableStartup()
++{
++	if (!m_display->isValid())
++		return;
++	KConfig config("krandrrc");
++	m_display->disableStartup(config);
++	KMessageBox::information( window(), i18n( "Default desktop setup has been reset." ));
++}
++
++
+ bool RandRConfig::eventFilter(QObject *obj, QEvent *event)
+ {
+ 	if ( obj == screenView && event->type() == QEvent::Resize ) {
+--- a/kcontrol/randr/randrconfig.h
++++ b/kcontrol/randr/randrconfig.h
+@@ -57,6 +57,8 @@ protected slots:
+ 	void slotAdjustOutput(OutputGraphicsItem *o);
+ 	void identifyOutputs();
+ 	void clearIndicators();
++	void saveStartup();
++	void disableStartup();
+ 
+ signals:
+ 	void changed(bool change);
+--- a/kcontrol/randr/randrdisplay.cpp
++++ b/kcontrol/randr/randrdisplay.cpp
+@@ -290,10 +290,9 @@ bool RandRDisplay::syncTrayApp(KConfig&
+ 	return config.group("Display").readEntry("SyncTrayApp", false);
+ }
+ 
+-void RandRDisplay::saveDisplay(KConfig& config, bool applyOnStartup, bool syncTrayApp)
++void RandRDisplay::saveDisplay(KConfig& config, bool syncTrayApp)
+ {
+ 	KConfigGroup group = config.group("Display");
+-	group.writeEntry("ApplyOnStartup", applyOnStartup);
+ 	group.writeEntry("SyncTrayApp", syncTrayApp);
+ 
+ #ifdef HAS_RANDR_1_2
+@@ -310,6 +309,36 @@ void RandRDisplay::saveDisplay(KConfig&
+ 	}
+ }
+ 
++// to be used during desktop startup, make all screens provide the shell commands
++// (using xrandr cli tool), save them here and a script will perform these commands
++// early during desktop startup
++void RandRDisplay::saveStartup(KConfig& config)
++{
++	KConfigGroup group = config.group("Display");
++	group.writeEntry("ApplyOnStartup", true);
++	QStringList commands;
++#ifdef HAS_RANDR_1_2
++	if (RandR::has_1_2)
++	{
++		foreach(RandRScreen *s, m_screens)
++			commands += s->startupCommands();
++	}
++	else
++#endif
++	{
++		foreach(LegacyRandRScreen *s, m_legacyScreens)
++			commands += s->startupCommands();
++	}
++	group.writeEntry( "StartupCommands", commands.join( "\n" ));
++}
++
++void RandRDisplay::disableStartup(KConfig& config)
++{
++	KConfigGroup group = config.group("Display");
++	group.writeEntry("ApplyOnStartup", false);
++	group.deleteEntry( "StartupCommands" );
++}
++
+ void RandRDisplay::applyProposed(bool confirm)
+ {
+ 
+--- a/kcontrol/randr/randrdisplay.h
++++ b/kcontrol/randr/randrdisplay.h
+@@ -63,7 +63,9 @@ public:
+ 	 * @retuns true if the settings should be applied on KDE startup.
+ 	 */
+ 	bool loadDisplay(KConfig& config, bool loadScreens = true);
+-	void saveDisplay(KConfig& config, bool applyOnStartup, bool syncTrayApp);
++	void saveDisplay(KConfig& config, bool syncTrayApp);
++	void saveStartup(KConfig& config);
++	void disableStartup(KConfig& config);
+ 
+ 	static bool applyOnStartup(KConfig& config);
+ 	static bool syncTrayApp(KConfig& config);
+--- a/kcontrol/randr/randroutput.cpp
++++ b/kcontrol/randr/randroutput.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <KConfig>
+ #include <KConfigGroup>
++#include <KShell>
+ #include <QX11Info>
+ #include <QAction>
+ 
+@@ -424,6 +425,36 @@ void RandROutput::save(KConfig &config)
+ 	cg.writeEntry("RefreshRate", (double)m_crtc->refreshRate());
+ }
+ 
++QStringList RandROutput::startupCommands() const
++{
++	if (!m_connected)
++		return QStringList();
++	if (m_crtc->id() == None)
++	     return QStringList();	
++	QString command = QString( "xrandr --output \"%1\"" ).arg( KShell::quoteArg( m_name ));
++	// if the outputs are unified, do not save size and rotation
++	// this allow us to set back the size and rotation being used
++	// when the outputs are not unified.
++	if (!m_screen->outputsUnified() || m_screen->connectedCount() <=1)
++	{
++		command += QString( " --pos %1x%2 --mode %3x%4" ).arg( m_crtc->rect().x())
++		    .arg( m_crtc->rect().y()).arg( m_crtc->rect().width()).arg( m_crtc->rect().height());
++		switch( m_crtc->rotation()) {
++			case RandR::Rotate90:
++				command += " --rotate right";
++				break;
++			case RandR::Rotate180:
++				command += " --rotate inverted";
++				break;
++			case RandR::Rotate270:
++				command += " --rotate left";
++				break;
++		}
++	}
++	command += QString(" --refresh %1").arg( m_crtc->refreshRate());
++	return QStringList() << command;
++}
++
+ void RandROutput::proposeRefreshRate(float rate)
+ {
+ 	if (!m_crtc->isValid())
+--- a/kcontrol/randr/randroutput.h
++++ b/kcontrol/randr/randroutput.h
+@@ -118,6 +118,7 @@ public:
+ 
+ 	void load(KConfig &config);
+ 	void save(KConfig &config);
++	QStringList startupCommands() const;
+ 
+ public slots:
+ 	void slotChangeSize(QAction *action);
+--- a/kcontrol/randr/randrscreen.cpp
++++ b/kcontrol/randr/randrscreen.cpp
+@@ -424,6 +424,17 @@ void RandRScreen::save()
+ 	save(cfg);
+ }
+ 
++QStringList RandRScreen::startupCommands() const
++{
++	QStringList commands;
++	foreach(RandROutput *output, m_outputs)
++	{
++		if (output->isConnected())
++			commands += output->startupCommands();
++	}
++	return commands;
++}
++
+ void RandRScreen::load()
+ {
+ 	KConfig cfg("krandrrc");
+--- a/kcontrol/randr/randrscreen.h
++++ b/kcontrol/randr/randrscreen.h
+@@ -84,6 +84,7 @@ public:
+ 
+ 	void load(KConfig &config);
+ 	void save(KConfig &config);
++	QStringList startupCommands() const;
+ 
+ public slots:
+ 	void slotUnifyOutputs(bool unify);
+--- a/startkde.cmake
++++ b/startkde.cmake
+@@ -91,11 +91,12 @@ kcminputrc Mouse cursorTheme 'Oxygen_Bla
+ kcminputrc Mouse cursorSize ''
+ ksplashrc KSplash Theme Default
+ ksplashrc KSplash Engine KSplashX
+-kcmrandrrc Display ApplyOnStartup false
+-kcmrandrrc [Screen0]
+-kcmrandrrc [Screen1]
+-kcmrandrrc [Screen2]
+-kcmrandrrc [Screen3]
++krandrrc Display ApplyOnStartup false
++krandrrc Display StartupCommands ''
++krandrrc [Screen0]
++krandrrc [Screen1]
++krandrrc [Screen2]
++krandrrc [Screen3]
+ kcmfonts General forceFontDPI 0
+ kdeglobals Locale Language '' # trigger requesting languages from KLocale
+ EOF
+@@ -125,20 +126,20 @@ if test -n "$kcminputrc_mouse_cursorthem
+     fi
+ fi
+ 
+-if test "$kcmrandrrc_display_applyonstartup" = "true"; then
++krandr_backwards_compatibility() {
+     # 4 screens is hopefully enough
+     for scrn in 0 1 2 3; do
+         args=
+-        width="\$kcmrandrrc_screen${scrn}_width" ; eval "width=$width"
+-        height="\$kcmrandrrc_screen${scrn}_height" ; eval "height=$height"
++        width="\$krandrrc_screen${scrn}_width" ; eval "width=$width"
++        height="\$krandrrc_screen${scrn}_height" ; eval "height=$height"
+         if test -n "${width}" -a -n "${height}"; then
+             args="$args -s ${width}x${height}"
+         fi
+-        refresh="\$kcmrandrrc_screen${scrn}_refresh" ; eval "refresh=$refresh"
++        refresh="\$krandrrc_screen${scrn}_refresh" ; eval "refresh=$refresh"
+         if test -n "${refresh}"; then
+             args="$args -r ${refresh}"
+         fi
+-        rotation="\$kcmrandrrc_screen${scrn}_rotation" ; eval "rotation=$rotation"
++        rotation="\$krandrrc_screen${scrn}_rotation" ; eval "rotation=$rotation"
+         if test -n "${rotation}"; then
+             case "${rotation}" in
+                 0)
+@@ -155,11 +156,11 @@ if test "$kcmrandrrc_display_applyonstar
+                     ;;
+             esac
+         fi
+-        reflectx="\$kcmrandrrc_screen${scrn}_reflectx" ; eval "reflectx=$reflectx"
++        reflectx="\$krandrrc_screen${scrn}_reflectx" ; eval "reflectx=$reflectx"
+         if test "${refrectx}" = "true"; then
+             args="$args -x"
+         fi
+-        reflecty="\$kcmrandrrc_screen${scrn}_reflecty" ; eval "reflecty=$reflecty"
++        reflecty="\$krandrrc_screen${scrn}_reflecty" ; eval "reflecty=$reflecty"
+         if test "${refrecty}" = "true"; then
+             args="$args -y"
+         fi
+@@ -167,6 +168,19 @@ if test "$kcmrandrrc_display_applyonstar
+             xrandr $args
+         fi
+     done
++}
++
++if test "$krandrrc_display_applyonstartup" = "true"; then
++    if test -n "$krandrrc_display_startupcommands"; then
++        # new way of simply storing the commands
++        echo "$krandrrc_display_startupcommands" | \
++        while read command; do
++            eval "$command"
++        done
++    else
++        # backwards compatibility
++        krandr_backwards_compatibility
++    fi
+ fi
+ 
+ if test "$kcmfonts_general_forcefontdpi" -eq 120; then
diff --git a/debian/patches/series b/debian/patches/series
index 50a6452..4e0e7f5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,6 +13,7 @@
 22_kdm_xreset_hook_framework.diff
 26_run_kaboom_when_starting_kde.diff
 28_backport_bug156475_dualhead_support.diff
+29_backport_fix_krandr_support_in_startkde.diff
 97_fix_target_link_libraries.diff
 27_ld_exclude_libs_qtuitools.diff
 99_solid_network_use_ntrack.diff

-- 
KDE Base Workspace module packaging



More information about the pkg-kde-commits mailing list