summaryrefslogtreecommitdiffstats
path: root/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-change_the_way_crtcs_are_set.patch
blob: 9a64c309e55a22d1f1827ca9a3ceb65b2e60213e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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);