summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-12-11 13:45:50 -0600
committerSlávek Banko <slavek.banko@axis.cz>2012-12-12 02:54:53 +0100
commitcbe0a27bbf33c03fc8b30404d9ecdf872ee94183 (patch)
treeb9d0304e76aa07e70288af30a6d00e5e93f20b67
parent5ae82a06c308960c66757b0a956500b05b83f002 (diff)
downloadqt3-cbe0a27bbf33c03fc8b30404d9ecdf872ee94183.tar.gz
qt3-cbe0a27bbf33c03fc8b30404d9ecdf872ee94183.zip
Ensure that a valid DPI is always set
(cherry picked from commit f19aa203c934d0f85862fdf810a87fe7c5777d17)
-rw-r--r--src/kernel/qpaintdevice_x11.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/kernel/qpaintdevice_x11.cpp b/src/kernel/qpaintdevice_x11.cpp
index a755c01..5941657 100644
--- a/src/kernel/qpaintdevice_x11.cpp
+++ b/src/kernel/qpaintdevice_x11.cpp
@@ -529,11 +529,16 @@ static void create_dpis()
Q_CHECK_PTR( dpisX );
Q_CHECK_PTR( dpisY );
for ( i = 0; i < screens; i++ ) {
- dpisX[ i ] = (DisplayWidth(dpy,i) * 254 + DisplayWidthMM(dpy,i)*5)
-
- / (DisplayWidthMM(dpy,i)*10);
- dpisY[ i ] = (DisplayHeight(dpy,i) * 254 + DisplayHeightMM(dpy,i)*5)
- / (DisplayHeightMM(dpy,i)*10);
+ if (DisplayWidthMM(dpy,i) < 1)
+ dpisX[ i ] = 75; // default the dpi to 75.
+ else
+ dpisX[ i ] = (DisplayWidth(dpy,i) * 254 + DisplayWidthMM(dpy,i)*5)
+ / (DisplayWidthMM(dpy,i)*10);
+ if (DisplayHeightMM(dpy,i) < 1)
+ dpisY[ i ] = 75; // default the dpi to 75.
+ else
+ dpisY[ i ] = (DisplayHeight(dpy,i) * 254 + DisplayHeightMM(dpy,i)*5)
+ / (DisplayHeightMM(dpy,i)*10);
}
}