Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > media > main-release-src > by-pkgid > 6b6a59f2906ad4b4449229e0ccfab10e > files > 3

krandr-0.5.2.1-15mdv2009.0.src.rpm

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);