xorg-x11-server/N_fix-dpi-values.diff
Egbert Eich 63af0702ac - Changed patch numbering, reordered patches to group
SUSE specific and to-be-upstreamed patches.
- Added descriptions to a number of patches.
- Renamed some patches:
  * N_p_default-module-path.diff ->
    N_default-module-path.diff
  * n_xorg-x11-server-rpmmacros.patch ->
    N_xorg-x11-server-rpmmacros.patch

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=480
2013-12-12 14:33:35 +00:00

63 lines
2.4 KiB
Diff

From: Egbert Eich <eich@suse.de>
Fix calculation of DPI using mode data if present.
Index: hw/xfree86/common/xf86Helper.c
===================================================================
--- hw/xfree86/common/xf86Helper.c.orig
+++ hw/xfree86/common/xf86Helper.c
@@ -922,12 +922,22 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int
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;
@@ -966,12 +976,22 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int
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;