summaryrefslogtreecommitdiffstats
path: root/mandriva/2010.2/applications/krandr
diff options
context:
space:
mode:
authorTim Williams <tmw@autotrain.org>2011-10-17 18:47:27 +0100
committerTim Williams <tmw@autotrain.org>2011-10-17 18:47:27 +0100
commit76ef832ce5348d12a871223d4c034c7daeaddb82 (patch)
tree7024a1f39a6114daa8c5ed24bb31a8687c832b9a /mandriva/2010.2/applications/krandr
parentec2515f058c60d2478a549f58376db628ba556b9 (diff)
downloadtde-packaging-76ef832ce5348d12a871223d4c034c7daeaddb82.tar.gz
tde-packaging-76ef832ce5348d12a871223d4c034c7daeaddb82.zip
Adding the remaining Mandriva patches and spec files
Diffstat (limited to 'mandriva/2010.2/applications/krandr')
-rw-r--r--mandriva/2010.2/applications/krandr/kde3-krandr.spec167
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2-display_switch.patch187
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-add-mandriva-translations.patch11
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-change_the_way_crtcs_are_set.patch131
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_autostart.patch62
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_rrate_display.patch28
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-flush_after_ungrab.patch43
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-grab_server_avoiding_crashes.patch74
-rw-r--r--mandriva/2010.2/applications/krandr/krandr-0.5.2.1-legacy_randr_on_single_output.patch30
9 files changed, 733 insertions, 0 deletions
diff --git a/mandriva/2010.2/applications/krandr/kde3-krandr.spec b/mandriva/2010.2/applications/krandr/kde3-krandr.spec
new file mode 100644
index 000000000..a7a8438bc
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/kde3-krandr.spec
@@ -0,0 +1,167 @@
+%define oname krandr
+Name: kde3-%{oname}
+Summary: Applet for configuring screen size and rotation
+Version: 0.5.2.1
+Release: %mkrel 19
+License: GPL
+Group: Graphical desktop/KDE3
+URL: http://git.mandriva.com/?p=projects/%{oname}.git
+Source0: %{oname}-%{version}.tar.gz
+Patch0: %{oname}-0.5.2.1-legacy_randr_on_single_output.patch
+Patch1: %{oname}-0.5.2-display_switch.patch
+Patch2: %{oname}-0.5.2.1-fix_rrate_display.patch
+Patch3: %{oname}-0.5.2.1-fix_autostart.patch
+Patch4: %{oname}-0.5.2.1-add-mandriva-translations.patch
+Patch5: %{oname}-0.5.2.1-change_the_way_crtcs_are_set.patch
+Patch6: %{oname}-0.5.2.1-grab_server_avoiding_crashes.patch
+Patch7: %{oname}-0.5.2.1-flush_after_ungrab.patch
+Patch8: kde-3.5.10-acinclude.patch
+Patch9: fix_autotools.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+BuildRequires: kde3-macros
+BuildRequires: automake >= 1.6.1
+%if %mdkversion < 201000
+BuildRequires: autoconf <= 1:2.63
+%else
+BuildRequires: autoconf >= 1:2.65
+%endif
+BuildRequires: qt3-devel >= 3.3.3
+BuildRequires: kdelibs-devel
+BuildRequires: kde3-macros
+Conflicts: kdebase-common <= 1:3.5.7-18mdv2008.0
+Conflicts: libkdebase4 <= 1:3.5.7-20mdv2008.0
+Provides: %{oname} = %version-%release
+Obsoletes: %{oname}
+
+%description
+KRandr is an applet for configuring screen size and rotation through the XRandR
+extension.
+
+%prep
+%setup -q -n %{oname}-%{version}
+%patch0 -p1 -b .legacyrandr
+%patch1 -p1 -b .displayswitch
+%patch2 -p1 -b .rrate_display
+%patch3 -p1 -b .fix_autostart
+%patch4 -p1 -b .test_translations
+%patch5 -p1 -b .crtc_set
+%patch6 -p1 -b .grab_server
+%patch7 -p1 -b .flush_after_ungrab
+%if %mdkversion >= 201000
+%patch8 -p1
+%patch9 -p1
+%endif
+
+%build
+%define _disable_ld_no_undefined 1
+make -f admin/Makefile.common cvs
+%configure_kde3
+%make
+
+%install
+rm -rf %buildroot
+%makeinstall_std
+
+# install %{oname}tray in kde autostart
+install -d -m 0755 %{buildroot}%{_kde3_datadir}/autostart
+cp -f %{buildroot}%{_kde3_datadir}/applications/kde/%{oname}tray.desktop %{buildroot}%{_kde3_datadir}/autostart/
+
+%files
+%defattr(-,root,root)
+%{_kde3_bindir}/%{oname}tray
+%{_kde3_libdir}/kde3/kcm_randr.*
+%{_kde3_datadir}/applications/kde/%{oname}tray.desktop
+%{_kde3_datadir}/applnk/.hidden/randr.desktop
+%{_kde3_datadir}/autostart/%{oname}tray.desktop
+# remove the non wanted files
+%exclude %{_kde3_datadir}/doc/HTML/en/%{oname}
+%exclude %{_kde3_datadir}/locale/*/LC_MESSAGES/%{oname}.mo
+
+
+%changelog
+* Mon Jul 19 2010 Tim Williams <tim@my-place.org.uk> 0.5.2.1-19mdv2010.1
++ Rebuild for MDV 2010.2/Trinity
+
+* Mon Jul 19 2010 Tim Williams <tim@my-place.org.uk> 0.5.2.1-18mdv2010.1
++ Rebuild for MDV 2010.1
+
+* Fri Feb 12 2010 Atilla ÖNTAŞ <atilla_ontas@mandriva.org> 0.5.2.1-17mdv2010.0
++ KDE builds with autoconf 2.65, add patch for this and
+ set autoconf to version 2.65
+- Rename package name and group to avoid possible future kde4 conflicts
+
+* Fri Nov 13 2009 Tim Williams <tim@my-place.org.uk> 0.5.2.1-16mdv2010.0
++ Rebuild for MDV 2010.0
+
+* Tue Jul 22 2008 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-15mdv2009.0
++ Revision: 240518
+- Flush the X calls after calling XUngrabServer to avoid deadlocks
+
+* Sat Jun 14 2008 Anssi Hannula <anssi@mandriva.org> 0.5.2.1-14mdv2009.0
++ Revision: 219126
+- rebuild to get higher evr than 2008.1 updates (needed for kde4 conflicts)
+
+* Mon May 05 2008 Helio Chissini de Castro <helio@mandriva.com> 0.5.2.1-13mdv2009.0
++ Revision: 201520
+- Update %{oname} to new build of moved kde3
+
+* Mon Mar 31 2008 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-12mdv2008.1
++ Revision: 191318
+- Grab the X server in order for the changes to be atomic
+
+* Fri Mar 28 2008 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-11mdv2008.1
++ Revision: 190977
+- Fix the way the screen are upper-sized when the resolution of the CRTC is
+ changed. This avoids kicker and kwin getting lost on parsing X events.
+
+* Mon Mar 10 2008 Thierry Vignaud <tvignaud@mandriva.com> 0.5.2.1-10mdv2008.1
++ Revision: 183618
+- fix description
+
+* Mon Mar 10 2008 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-9mdv2008.1
++ Revision: 183512
+- Use the correct autostart condition so that it is actually started (#38455)
+
+* Fri Feb 22 2008 Nicolas Lécureuil <neoclust@mandriva.org> 0.5.2.1-8mdv2008.1
++ Revision: 174021
+- Add translations for mandriva strings
+
+* Thu Jan 03 2008 Oden Eriksson <oeriksson@mandriva.com> 0.5.2.1-7mdv2008.1
++ Revision: 141739
+- rebuilt against openldap-2.4.7 libs
+
+ + Olivier Blin <oblin@mandriva.com>
+ - restore BuildRoot
+
+ + Thierry Vignaud <tvignaud@mandriva.com>
+ - kill re-definition of %%buildroot on Pixel's request
+
+* Wed Oct 03 2007 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-6mdv2008.0
++ Revision: 94865
+- Make it possible to disable %{oname} autostart (#34378)
+
+* Fri Sep 28 2007 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-5mdv2008.0
++ Revision: 93579
+- Make %{oname} start at session startup (#34047)
+- Remove the dummy documentation files
+
+* Mon Sep 17 2007 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-4mdv2008.0
++ Revision: 89338
+- Fix displaying of refresh rates (#33710)
+
+* Thu Sep 13 2007 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-3mdv2008.0
++ Revision: 85303
+- add a display switch shortcut
+- add proper conflicts to libkdebase4 (#32957)
+
+* Wed Sep 12 2007 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-2mdv2008.0
++ Revision: 84651
+- Use the legacy randr interface when there is only one output available
+ (mostly drivers that do not support RandR1.2 yet)
+
+* Tue Aug 28 2007 Gustavo Pichorim Boiko <boiko@mandriva.com> 0.5.2.1-1mdv2008.0
++ Revision: 72849
+- Fix group and point the URL to the git repository of %{oname}
+- Import %{oname}
+
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2-display_switch.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2-display_switch.patch
new file mode 100644
index 000000000..366b6685c
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2-display_switch.patch
@@ -0,0 +1,187 @@
+--- krandr-0.5.2.1/randr/krandrtray.h.orig 2007-09-03 18:05:43.000000000 -0300
++++ krandr-0.5.2.1/randr/krandrtray.h 2007-09-03 18:29:15.000000000 -0300
+@@ -37,6 +37,9 @@ public:
+
+ void configChanged();
+
++public slots:
++ void slotSwitchDisplay();
++
+ protected slots:
+ void slotScreenActivated();
+ void slotResolutionChanged(int parameter);
+--- krandr-0.5.2.1/randr/randrdisplay.h.orig 2007-09-03 18:05:43.000000000 -0300
++++ krandr-0.5.2.1/randr/randrdisplay.h 2007-09-03 18:31:43.000000000 -0300
+@@ -51,6 +51,8 @@ public:
+
+ void refresh();
+
++ void switchOutput();
++
+ /**
+ * Loads saved settings.
+ *
+--- krandr-0.5.2.1/randr/randrscreen.h.orig 2007-09-03 18:05:43.000000000 -0300
++++ krandr-0.5.2.1/randr/randrscreen.h 2007-09-03 18:32:51.000000000 -0300
+@@ -40,6 +40,8 @@ public:
+
+ int index() const;
+
++ void switchOutput();
++
+ XRRScreenResources* resources() const;
+ Window rootWindow() const;
+
+--- krandr-0.5.2.1/randr/krandrtray.cpp.orig 2007-09-03 18:05:43.000000000 -0300
++++ krandr-0.5.2.1/randr/krandrtray.cpp 2007-09-04 10:12:05.000000000 -0300
+@@ -17,6 +17,7 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
++#include <kglobalaccel.h>
+ #include <kapplication.h>
+ #include <kpopupmenu.h>
+ #include <khelpmenu.h>
+@@ -33,6 +34,7 @@
+ #include "randroutput.h"
+ #include "randrmode.h"
+
++#include <kdebug.h>
+ KRandRSystemTray::KRandRSystemTray(RandRDisplay *dpy, QWidget* parent, const char *name)
+ : KSystemTray(parent, name)
+ , m_popupUp(false), m_display(dpy)
+@@ -43,6 +45,16 @@ KRandRSystemTray::KRandRSystemTray(RandR
+ connect(this, SIGNAL(quitSelected()), kapp, SLOT(quit()));
+ QToolTip::add(this, i18n("Screen resize & rotate"));
+
++ KConfig cfg("kcmrandrrc");
++ cfg.setGroup("General");
++
++ KGlobalAccel *accel = new KGlobalAccel(this);
++ accel->insert( "DisplaySwitch", i18n("Switch displays"),
++ i18n("Switch between active displays."),
++ CTRL+SHIFT+Key_S, KKey::QtWIN+CTRL+Key_S, this, SLOT(slotSwitchDisplay()) );
++
++ accel->readSettings(&cfg);
++ accel->updateConnections();
+ }
+
+ void KRandRSystemTray::mousePressEvent(QMouseEvent* e)
+@@ -456,3 +468,8 @@ void KRandRSystemTray::slotPrefs()
+ kcm->setPlainCaption( i18n( "Configure Display" ) );
+ kcm->exec();
+ }
++
++void KRandRSystemTray::slotSwitchDisplay()
++{
++ m_display->switchOutput();
++}
+--- krandr-0.5.2.1/randr/randrdisplay.cpp.orig 2007-09-03 18:05:43.000000000 -0300
++++ krandr-0.5.2.1/randr/randrdisplay.cpp 2007-09-03 18:32:35.000000000 -0300
+@@ -300,3 +300,10 @@ void RandRDisplay::applyProposed(bool co
+ }
+ }
+
++void RandRDisplay::switchOutput()
++{
++#ifdef HAS_RANDR_1_2
++ if (RandR::has_1_2)
++ currentScreen()->switchOutput();
++#endif
++}
+--- krandr-0.5.2.1/randr/randrscreen.cpp.orig 2007-09-03 18:05:43.000000000 -0300
++++ krandr-0.5.2.1/randr/randrscreen.cpp 2007-09-04 12:45:23.000000000 -0300
+@@ -581,6 +581,93 @@ void RandRScreen::slotOutputChanged(RROu
+ emit configChanged();
+ }
+
++void RandRScreen::switchOutput()
++{
++ //refresh settings so that the new monitor gets detected
++ loadSettings();
++
++ // if there is just one connected output, do not switch
++ if (connectedCount() < 2)
++ return;
++
++ // disable all outputs and activate the first connected one
++ if (activeCount() > 1)
++ {
++ bool first = true;
++ slotUnifyOutputs(0);
++ OutputMap::iterator it;
++ for(it = m_outputs.begin(); it != m_outputs.end(); ++it)
++ {
++ RandROutput *output = *it;
++ if (first && output->isActive())
++ first = false;
++ else if (first && output->isConnected())
++ {
++ SizeList sizes = output->sizes();
++ if (!sizes.count())
++ continue;
++
++ output->proposeRect(QRect(QPoint(0,0), sizes.first()));
++ if (output->applyProposed(false))
++ first = false;
++ else
++ output->slotDisable();
++ }
++ else
++ output->slotDisable();
++ }
++
++ for(it = m_outputs.begin(); it != m_outputs.end(); ++it)
++ {
++ RandROutput *output = *it;
++ if (output->isConnected())
++ {
++ SizeList sizes = output->sizes();
++ if (!sizes.count())
++ continue;
++
++ output->proposeRect(QRect(QPoint(0,0), sizes.first()));
++ if (output->applyProposed(RandR::ChangeRect, false))
++ break;
++ }
++ }
++ }
++ else
++ {
++ OutputMap::iterator it;
++ // first disable the currently active output and try to active the next
++ // connected one
++ bool found_active = false, found_connected = false;
++ for(it = m_outputs.begin(); it != m_outputs.end(); ++it)
++ {
++ RandROutput *output = *it;
++ if (!found_active && output->isActive())
++ {
++ output->slotDisable();
++ found_active = true;
++ }
++ else if (found_active && output->isConnected())
++ {
++ SizeList sizes = output->sizes();
++ if (!sizes.count())
++ continue;
++
++ output->proposeRect(QRect(QPoint(0,0), sizes.first()));
++ if (output->applyProposed(RandR::ChangeRect, false))
++ {
++ found_connected = true;
++ break;
++ }
++ }
++ }
++
++ // if we could not find the next connected output after the active one,
++ // activate all
++ if (!found_connected)
++ slotUnifyOutputs(1);
++ } // if activeCount < 2
++}
++
+ #include "randrscreen.moc"
+
+ #endif
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-add-mandriva-translations.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-add-mandriva-translations.patch
new file mode 100644
index 000000000..043bae478
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-add-mandriva-translations.patch
@@ -0,0 +1,11 @@
+--- krandr-0.5.2.1/randr/krandrtray.cpp~ 2008-02-22 22:45:54.000000000 +0100
++++ krandr-0.5.2.1/randr/krandrtray.cpp 2008-02-22 22:59:44.000000000 +0100
+@@ -111,7 +111,7 @@
+ }
+
+ menu->insertSeparator();
+-
++ KGlobal::locale()->insertCatalogue("mandriva-kde-translation");
+ lastIndex = menu->insertItem(i18n( "Start KRandR when KDE starts" ));
+ menu->connectItem(lastIndex, this, SLOT(slotToggleRunStartup()));
+ menu->setItemChecked( lastIndex, m_runStartup );
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-change_the_way_crtcs_are_set.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-change_the_way_crtcs_are_set.patch
new file mode 100644
index 000000000..9a64c309e
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-change_the_way_crtcs_are_set.patch
@@ -0,0 +1,131 @@
+diff -p -up krandr-0.5.2.1/randr/randrcrtc.cpp.orig krandr-0.5.2.1/randr/randrcrtc.cpp
+--- krandr-0.5.2.1/randr/randrcrtc.cpp.orig 2008-03-28 13:56:38.000000000 -0300
++++ krandr-0.5.2.1/randr/randrcrtc.cpp 2008-03-28 16:15:57.000000000 -0300
+@@ -30,6 +30,13 @@ RandRCrtc::RandRCrtc(RandRScreen *parent
+ Q_ASSERT(m_screen);
+
+ m_id = id;
++
++ // just to make sure it gets initialized
++ m_proposedRect = m_currentRect;
++ m_proposedRotation = m_currentRotation;
++ m_proposedRate = m_currentRate;
++
++
+ loadSettings();
+ }
+
+@@ -116,11 +123,6 @@ void RandRCrtc::loadSettings(bool notify
+ changes |= RandR::ChangeRate;
+ }
+
+- // just to make sure it gets initialized
+- m_proposedRect = m_currentRect;
+- m_proposedRotation = m_currentRotation;
+- m_proposedRate = m_currentRate;
+-
+ // free the info
+ XRRFreeCrtcInfo(info);
+
+@@ -130,6 +132,7 @@ void RandRCrtc::loadSettings(bool notify
+
+ void RandRCrtc::handleEvent(XRRCrtcChangeNotifyEvent *event)
+ {
++#if 0
+ kdDebug() << "[CRTC] Event..." << endl;
+ int changed = 0;
+
+@@ -164,6 +167,7 @@ void RandRCrtc::handleEvent(XRRCrtcChang
+
+ if (changed)
+ emit crtcChanged(m_id, changed);
++#endif
+ }
+
+ RRMode RandRCrtc::mode() const
+@@ -241,6 +245,7 @@ bool RandRCrtc::applyProposed()
+ return false;
+
+ RROutput *outputs = new RROutput[m_connectedOutputs.count()];
++ int connectedCount = m_connectedOutputs.count();
+ for (int i = 0; i < m_connectedOutputs.count(); ++i)
+ outputs[i] = m_connectedOutputs[i];
+
+@@ -261,7 +266,7 @@ bool RandRCrtc::applyProposed()
+ if (!m_screen->rect().contains(r))
+ {
+ // try to adjust the screen size
+- if (!m_screen->adjustSize(r))
++ if (!adjustScreenSize(r, true))
+ return false;
+ }
+
+@@ -279,7 +284,7 @@ bool RandRCrtc::applyProposed()
+
+ // adjust the screen size
+ r = r.unite(m_currentRect);
+- if (!m_screen->adjustSize(r))
++ if (!adjustScreenSize(r,true))
+ return false;
+ }
+ }
+@@ -287,7 +292,7 @@ bool RandRCrtc::applyProposed()
+
+ Status s = XRRSetCrtcConfig(qt_xdisplay(), m_screen->resources(), m_id,
+ RandR::timestamp, m_proposedRect.x(), m_proposedRect.y(), mode.id(),
+- m_proposedRotation, outputs, m_connectedOutputs.count());
++ m_proposedRotation, outputs, connectedCount);
+
+ bool ret;
+ if (s == RRSetConfigSuccess)
+@@ -424,6 +429,19 @@ ModeList RandRCrtc::modes() const
+ return modeList;
+ }
+
++bool RandRCrtc::adjustScreenSize(const QRect &rect, bool disable)
++{
++ if (disable)
++ {
++ // disable the crtc before changing screen size
++ Status s = XRRSetCrtcConfig(qt_xdisplay(), m_screen->resources(), m_id,
++ RandR::timestamp, 0, 0, None,
++ RandR::Rotate0, NULL, 0);
++ }
++
++ return m_screen->adjustSize(rect);
++}
++
+ #include "randrcrtc.moc"
+
+ #endif
+diff -p -up krandr-0.5.2.1/randr/randroutput.cpp.orig krandr-0.5.2.1/randr/randroutput.cpp
+--- krandr-0.5.2.1/randr/randroutput.cpp.orig 2008-03-28 16:14:56.000000000 -0300
++++ krandr-0.5.2.1/randr/randroutput.cpp 2008-03-28 16:15:18.000000000 -0300
+@@ -107,6 +107,7 @@ void RandROutput::loadSettings(bool noti
+
+ void RandROutput::handleEvent(XRROutputChangeNotifyEvent *event)
+ {
++#if 0
+ int changed = 0;
+
+ if (event->crtc != m_currentCrtc)
+@@ -141,6 +142,7 @@ void RandROutput::handleEvent(XRROutputC
+
+ if (changed)
+ emit outputChanged(m_id, changed);
++#endif
+ }
+
+ void RandROutput::handlePropertyEvent(XRROutputPropertyNotifyEvent *event)
+diff -p -up krandr-0.5.2.1/randr/randrcrtc.h.orig krandr-0.5.2.1/randr/randrcrtc.h
+--- krandr-0.5.2.1/randr/randrcrtc.h.orig 2008-03-28 14:24:07.000000000 -0300
++++ krandr-0.5.2.1/randr/randrcrtc.h 2008-03-28 14:27:15.000000000 -0300
+@@ -62,6 +62,8 @@ public:
+
+ ModeList modes() const;
+
++ bool adjustScreenSize(const QRect &rect, bool disableCrtc = false);
++
+ signals:
+ void crtcChanged(RRCrtc c, int changes);
+
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_autostart.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_autostart.patch
new file mode 100644
index 000000000..6937687b1
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_autostart.patch
@@ -0,0 +1,62 @@
+--- krandr-0.5.2.1/randr/krandrtray.cpp.run_startup 2007-10-02 20:22:50.000000000 -0300
++++ krandr-0.5.2.1/randr/krandrtray.cpp 2007-10-02 20:29:49.000000000 -0300
+@@ -48,6 +48,7 @@ KRandRSystemTray::KRandRSystemTray(RandR
+ KConfig cfg("kcmrandrrc");
+ cfg.setGroup("General");
+
++ m_runStartup = cfg.readBoolEntry("AutoStart", true);
+ KGlobalAccel *accel = new KGlobalAccel(this);
+ accel->insert( "DisplaySwitch", i18n("Switch displays"),
+ i18n("Switch between active displays."),
+@@ -111,6 +112,10 @@ void KRandRSystemTray::contextMenuAboutT
+
+ menu->insertSeparator();
+
++ lastIndex = menu->insertItem(i18n( "Start KRandR when KDE starts" ));
++ menu->connectItem(lastIndex, this, SLOT(slotToggleRunStartup()));
++ menu->setItemChecked( lastIndex, m_runStartup );
++
+ KAction *actPrefs = new KAction( i18n( "Configure Display..." ),
+ SmallIconSet( "configure" ), KShortcut(), this, SLOT( slotPrefs() ),
+ actionCollection() );
+@@ -469,6 +474,15 @@ void KRandRSystemTray::slotPrefs()
+ kcm->exec();
+ }
+
++void KRandRSystemTray::slotToggleRunStartup()
++{
++ m_runStartup = !m_runStartup;
++ KConfig cfg("kcmrandrrc");
++
++ cfg.setGroup("General");
++ cfg.writeEntry("AutoStart", m_runStartup);
++}
++
+ void KRandRSystemTray::slotSwitchDisplay()
+ {
+ m_display->switchOutput();
+--- krandr-0.5.2.1/randr/krandrtray.h.run_startup 2007-10-02 20:22:50.000000000 -0300
++++ krandr-0.5.2.1/randr/krandrtray.h 2007-10-02 20:22:50.000000000 -0300
+@@ -46,6 +46,7 @@ protected slots:
+ void slotOrientationChanged(int parameter);
+ void slotRefreshRateChanged(int parameter);
+ void slotPrefs();
++ void slotToggleRunStartup();
+
+ protected:
+ void mousePressEvent( QMouseEvent *e );
+@@ -62,6 +63,7 @@ private:
+ bool m_popupUp;
+ QValueList<KPopupMenu*> m_screenPopups;
+ RandRDisplay *m_display;
++ bool m_runStartup;
+ };
+
+ #endif
+--- krandr-0.5.2.1/randr/krandrtray.desktop.run_startup 2007-10-02 20:42:22.000000000 -0300
++++ krandr-0.5.2.1/randr/krandrtray.desktop 2007-10-02 20:29:27.000000000 -0300
+@@ -116,3 +116,4 @@ Icon=randr
+ Type=Application
+ OnlyShowIn=KDE;
+ Categories=Qt;KDE;System;
++X-KDE-autostart-condition=kcmrandrrc:General:AutoStart:true
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_rrate_display.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_rrate_display.patch
new file mode 100644
index 000000000..455298711
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-fix_rrate_display.patch
@@ -0,0 +1,28 @@
+--- krandr-0.5.2.1/randr/krandrtray.cpp.orig 2007-09-17 17:12:03.000000000 -0300
++++ krandr-0.5.2.1/randr/krandrtray.cpp 2007-09-17 17:16:35.000000000 -0300
+@@ -383,7 +383,7 @@ void KRandRSystemTray::populateRates(KPo
+ RateList::const_iterator it;
+ for (it = rates.begin(); it != rates.end(); ++it)
+ {
+- lastIndex = menu->insertItem(i18n("%1 Hz", QString::number(*it, 'f', 1)));
++ lastIndex = menu->insertItem(i18n("%1 Hz").arg(QString::number(*it, 'f', 1)));
+ menu->setItemParameter(lastIndex, i);
+ if (*it == rate)
+ menu->setItemChecked(lastIndex, true);
+--- krandr-0.5.2.1/randr/legacyrandrscreen.cpp.orig 2007-09-17 17:24:23.000000000 -0300
++++ krandr-0.5.2.1/randr/legacyrandrscreen.cpp 2007-09-17 17:25:12.000000000 -0300
+@@ -246,12 +246,12 @@ QStringList LegacyRandRScreen::refreshRa
+
+ QString LegacyRandRScreen::refreshRateDirectDescription(int rate) const
+ {
+- return i18n("Refresh rate in Hertz (Hz)", "%1 Hz", rate);
++ return i18n("%1 Hz").arg(rate);
+ }
+
+ QString LegacyRandRScreen::refreshRateIndirectDescription(int size, int index) const
+ {
+- return i18n("Refresh rate in Hertz (Hz)", "%1 Hz", refreshRateIndexToHz(size, index));
++ return i18n("%1 Hz").arg(refreshRateIndexToHz(size, index));
+ }
+
+ QString LegacyRandRScreen::refreshRateDescription(int size, int index) const
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-flush_after_ungrab.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-flush_after_ungrab.patch
new file mode 100644
index 000000000..feea4ce8e
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-flush_after_ungrab.patch
@@ -0,0 +1,43 @@
+diff -p -up krandr-0.5.2.1/randr/randrcrtc.cpp.orig krandr-0.5.2.1/randr/randrcrtc.cpp
+--- krandr-0.5.2.1/randr/randrcrtc.cpp.orig 2008-05-15 13:45:35.000000000 -0300
++++ krandr-0.5.2.1/randr/randrcrtc.cpp 2008-05-15 13:44:02.000000000 -0300
+@@ -202,6 +202,7 @@ bool RandRCrtc::applyProposed()
+
+ // Grab server while messing around
+ XGrabServer(qt_xdisplay());
++ XFlush(qt_xdisplay());
+
+ RandRMode mode;
+ if (m_proposedRect.size() == m_currentRect.size() && m_proposedRate == m_currentRate)
+@@ -248,6 +249,7 @@ bool RandRCrtc::applyProposed()
+ else if (!mode.isValid())
+ {
+ XUngrabServer(qt_xdisplay());
++ XFlush(qt_xdisplay());
+ return false;
+ }
+
+@@ -268,6 +270,7 @@ bool RandRCrtc::applyProposed()
+ if (r.width() > m_screen->maxSize().width() || r.height() > m_screen->maxSize().height())
+ {
+ XUngrabServer(qt_xdisplay());
++ XFlush(qt_xdisplay());
+ return false;
+ }
+
+@@ -279,6 +282,7 @@ bool RandRCrtc::applyProposed()
+ if (!adjustScreenSize(r, true))
+ {
+ XUngrabServer(qt_xdisplay());
++ XFlush(qt_xdisplay());
+ return false;
+ }
+ }
+@@ -331,6 +335,7 @@ bool RandRCrtc::applyProposed()
+
+ m_screen->adjustSize();
+ XUngrabServer(qt_xdisplay());
++ XFlush(qt_xdisplay());
+ return ret;
+ }
+
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-grab_server_avoiding_crashes.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-grab_server_avoiding_crashes.patch
new file mode 100644
index 000000000..57faa1cf6
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-grab_server_avoiding_crashes.patch
@@ -0,0 +1,74 @@
+diff -p -up krandr-0.5.2.1/randr/randrcrtc.cpp.orig krandr-0.5.2.1/randr/randrcrtc.cpp
+--- krandr-0.5.2.1/randr/randrcrtc.cpp.orig 2008-03-31 15:52:59.000000000 -0300
++++ krandr-0.5.2.1/randr/randrcrtc.cpp 2008-03-31 15:56:11.000000000 -0300
+@@ -199,6 +199,10 @@ bool RandRCrtc::applyProposed()
+ for (int i = 0; i < m_connectedOutputs.count(); ++i)
+ kdDebug() << " - " << m_screen->output(m_connectedOutputs[i])->name() << endl;
+ #endif
++
++ // Grab server while messing around
++ XGrabServer(qt_xdisplay());
++
+ RandRMode mode;
+ if (m_proposedRect.size() == m_currentRect.size() && m_proposedRate == m_currentRate)
+ {
+@@ -242,7 +246,10 @@ bool RandRCrtc::applyProposed()
+ if (!m_connectedOutputs.count())
+ mode = RandRMode();
+ else if (!mode.isValid())
++ {
++ XUngrabServer(qt_xdisplay());
+ return false;
++ }
+
+ RROutput *outputs = new RROutput[m_connectedOutputs.count()];
+ int connectedCount = m_connectedOutputs.count();
+@@ -259,7 +266,10 @@ bool RandRCrtc::applyProposed()
+ {
+ QRect r = QRect(0,0,0,0).unite(m_proposedRect);
+ if (r.width() > m_screen->maxSize().width() || r.height() > m_screen->maxSize().height())
++ {
++ XUngrabServer(qt_xdisplay());
+ return false;
++ }
+
+ // if the desired mode is bigger than the current screen size, first change the
+ // screen size, and then the crtc size
+@@ -267,7 +277,10 @@ bool RandRCrtc::applyProposed()
+ {
+ // try to adjust the screen size
+ if (!adjustScreenSize(r, true))
++ {
++ XUngrabServer(qt_xdisplay());
+ return false;
++ }
+ }
+
+ }
+@@ -280,12 +293,18 @@ bool RandRCrtc::applyProposed()
+ // check if the rotated rect is smaller than the max screen size
+ r = m_screen->rect().unite(r);
+ if (r.width() > m_screen->maxSize().width() || r.height() > m_screen->maxSize().height())
++ {
++ XUngrabServer(qt_xdisplay());
+ return false;
++ }
+
+ // adjust the screen size
+ r = r.unite(m_currentRect);
+ if (!adjustScreenSize(r,true))
++ {
++ XUngrabServer(qt_xdisplay());
+ return false;
++ }
+ }
+ }
+ }
+@@ -311,6 +330,7 @@ bool RandRCrtc::applyProposed()
+ }
+
+ m_screen->adjustSize();
++ XUngrabServer(qt_xdisplay());
+ return ret;
+ }
+
diff --git a/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-legacy_randr_on_single_output.patch b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-legacy_randr_on_single_output.patch
new file mode 100644
index 000000000..8b406daa5
--- /dev/null
+++ b/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-legacy_randr_on_single_output.patch
@@ -0,0 +1,30 @@
+--- krandr-0.5.2.1/randr/randrdisplay.cpp.orig 2007-09-12 11:00:50.000000000 -0300
++++ krandr-0.5.2.1/randr/randrdisplay.cpp 2007-09-12 11:05:15.000000000 -0300
+@@ -64,6 +64,27 @@ RandRDisplay::RandRDisplay()
+ m_legacyScreens.append(new LegacyRandRScreen(i));
+ }
+
++#ifdef HAS_RANDR_1_2
++ // check if we have more than one output, if no, revert to the legacy behavior
++ if (RandR::has_1_2)
++ {
++ int count = 0;
++ for (int i = 0; i < m_numScreens; ++i)
++ count += m_screens[i]->outputs().count();
++
++ if (count < 2)
++ {
++ RandR::has_1_2 = false;
++ for (int i = 0; i < m_numScreens; ++i)
++ {
++ delete m_screens[i];
++ m_legacyScreens.append(new LegacyRandRScreen(i));
++ }
++ m_screens.clear();
++ }
++ }
++#endif
++
+ setCurrentScreen(QApplication::desktop()->primaryScreen());
+ }
+