--- qpaintdevice_x11.cpp 2006-03-08 10:47:51.000000000 -0600 +++ qpaintdevice_x11.cpp.new 2007-03-29 19:28:55.000000000 -0500 @@ -526,11 +526,26 @@ Q_CHECK_PTR( dpisX ); Q_CHECK_PTR( dpisY ); for ( i = 0; i < screens; i++ ) { - dpisX[ i ] = (DisplayWidth(dpy,i) * 254 + DisplayWidthMM(dpy,i)*5) + + //qWarning( "f: The index cannot be negative" ); +#if defined(DEBUG) + qDebug( "Screen Details: %d\n\tWidth: %d\tWidth MM: %d", i, DisplayWidth(dpy,i), DisplayWidthMM(dpy,i) ); + qDebug( "\tHeight:%d\t Height %d", DisplayHeight(dpy,i), DisplayHeightMM(dpy,i) ); +#endif + 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); - dpisY[ i ] = (DisplayHeight(dpy,i) * 254 + DisplayHeightMM(dpy,i)*5) + if (DisplayWidthMM(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); +#if defined(DEBUG) + qDebug( "\tDPI: %dx%d", dpisX[ i ], dpisY[ i ] ); +#endif } }