summaryrefslogtreecommitdiffstats
path: root/mandriva/2010.2/applications/krandr/krandr-0.5.2.1-legacy_randr_on_single_output.patch
blob: 8b406daa5a203c0fb4829e613c51d60af950f284 (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
--- 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());
 }