From adad905d5cb839a4f31597a48c123bf468aaef75 Mon Sep 17 00:00:00 2001
From: Jon Nettleton <jon.nettleton@gmail.com>
Date: Thu, 16 Dec 2010 13:03:12 -0800
Subject: [PATCH] Change physical screen dimensions when rotating
If the physical screen dimensions are not changed when applying
a rotated mode then the DPI is calculated in correctly. Most
configs do not set this so the default calculated DPI is fine,
however configs that set a custom DisplaySize need this change
to preserve the DPI.
---
randr/rrscreen.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index e7eb75c..c53bd54 100644
|
a
|
b
|
|
| 766 | 766 | RRModePtr mode; |
| 767 | 767 | RR10DataPtr pData = NULL; |
| 768 | 768 | RRScreenSizePtr pSize; |
| 769 | | int width, height; |
| | 769 | int width, height, mmWidth, mmHeight; |
| 770 | 770 | |
| 771 | 771 | UpdateCurrentTime (); |
| 772 | 772 | |
| … |
… |
|
| 916 | 916 | */ |
| 917 | 917 | width = mode->mode.width; |
| 918 | 918 | height = mode->mode.height; |
| | 919 | mmWidth = pScreen->mmWidth; |
| | 920 | mmHeight = pScreen->mmHeight; |
| | 921 | |
| 919 | 922 | if (rotation & (RR_Rotate_90|RR_Rotate_270)) |
| 920 | 923 | { |
| 921 | 924 | width = mode->mode.height; |
| 922 | 925 | height = mode->mode.width; |
| | 926 | mmWidth = pScreen->mmHeight; |
| | 927 | mmHeight = pScreen->mmWidth; |
| 923 | 928 | } |
| 924 | 929 | if (width != pScreen->width || height != pScreen->height) |
| 925 | 930 | { |
| … |
… |
|
| 936 | 941 | } |
| 937 | 942 | } |
| 938 | 943 | if (!RRScreenSizeSet (pScreen, width, height, |
| 939 | | pScreen->mmWidth, pScreen->mmHeight)) |
| | 944 | mmWidth, mmHeight)) |
| 940 | 945 | { |
| 941 | 946 | rep.status = RRSetConfigFailed; |
| 942 | 947 | /* XXX recover from failure */ |