summaryrefslogtreecommitdiffstats
path: root/contrib/packages/rpm/sle11/SOURCES/fix-dpi-values.diff
blob: 2406b36084eb5749a5aaf7ce19499d2ed0da41be (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
Index: hw/xfree86/common/xf86Helper.c
================================================================================
--- hw/xfree86/common/xf86Helper.c
+++ hw/xfree86/common/xf86Helper.c
@@ -974,12 +974,22 @@
     } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
 	from = X_CONFIG;
 	if (pScrn->widthmm > 0) {
-	   pScrn->xDpi =
-		(int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+	   if (pScrn->modes && pScrn->modes->HDisplay > 0) {
+		pScrn->xDpi = 
+		    (int)((double) pScrn->modes->HDisplay * MMPERINCH / pScrn->widthmm);
+	   } else {
+		pScrn->xDpi =
+		    (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+	   }
 	}
 	if (pScrn->heightmm > 0) {
-	   pScrn->yDpi =
-		(int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+	   if (pScrn->modes && pScrn->modes->VDisplay > 0) {
+		pScrn->yDpi =
+		    (int)((double)pScrn->modes->VDisplay * MMPERINCH / pScrn->heightmm);
+	   } else {
+		pScrn->yDpi =
+		    (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+	   }
 	}
 	if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
 	    pScrn->yDpi = pScrn->xDpi;
@@ -1014,12 +1024,22 @@
 	pScrn->widthmm = ddcWidthmm;
 	pScrn->heightmm = ddcHeightmm;
 	if (pScrn->widthmm > 0) {
-	   pScrn->xDpi =
-		(int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+	    if (pScrn->modes && pScrn->modes->HDisplay > 0) {
+		pScrn->xDpi =
+                   (int)((double) pScrn->modes->HDisplay * MMPERINCH / pScrn->widthmm);
+	    } else {
+		pScrn->xDpi =
+		   (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+	    }
 	}
 	if (pScrn->heightmm > 0) {
-	   pScrn->yDpi =
-		(int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+	   if (pScrn->modes && pScrn->modes->VDisplay > 0) {
+		pScrn->yDpi =
+		   (int)((double)pScrn->modes->VDisplay * MMPERINCH / pScrn->heightmm);
+	   } else {
+		pScrn->yDpi =
+		   (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+	   }
 	}
 	if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
 	    pScrn->yDpi = pScrn->xDpi;