]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-base/xorg-server/files/0001-xfree86-Add-DontLie-server-flag.patch
Remove libeatmydata.
[gentoo-draconx.git] / x11-base / xorg-server / files / 0001-xfree86-Add-DontLie-server-flag.patch
1 From db1abe87be5b4bbe7db906ac3d56c69cf3785b23 Mon Sep 17 00:00:00 2001
2 From: Nick Bowler <nbowler@draconx.ca>
3 Date: Wed, 6 Jan 2010 10:42:17 -0500
4 Subject: [PATCH] xfree86: Add DontLie server flag.
5
6 Since commit fff00df94d7ebd18a8e24537ec96073717375a3f, RandR 1.2 drivers
7 lie about the resolution of the attached screen by default.  When the
8 reported resolution is wrong, fonts and other UI elements that use
9 physical units are not sized correctly.
10
11 This patch adds a new server flag, DontLie, which encourages the server
12 to be honest by default.
13
14 Signed-off-by: Nick Bowler <nbowler@draconx.ca>
15 ---
16  hw/xfree86/common/xf86Config.c  |    6 +++++-
17  hw/xfree86/common/xf86Globals.c |    1 +
18  hw/xfree86/common/xf86Privstr.h |    2 ++
19  hw/xfree86/man/xorg.conf.man    |    6 ++++++
20  hw/xfree86/modes/xf86RandR12.c  |   12 ++++++++++++
21  5 files changed, 26 insertions(+), 1 deletions(-)
22
23 diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
24 index 114bdc3..22391df 100644
25 --- a/hw/xfree86/common/xf86Config.c
26 +++ b/hw/xfree86/common/xf86Config.c
27 @@ -690,7 +690,8 @@ typedef enum {
28      FLAG_AUTO_ENABLE_DEVICES,
29      FLAG_GLX_VISUALS,
30      FLAG_DRI2,
31 -    FLAG_USE_SIGIO
32 +    FLAG_USE_SIGIO,
33 +    FLAG_DONTLIE
34  } FlagValues;
35  
36  /**
37 @@ -752,6 +753,8 @@ static OptionInfoRec FlagOptions[] = {
38         {0}, FALSE },
39    { FLAG_USE_SIGIO,            "UseSIGIO",                     OPTV_BOOLEAN,
40         {0}, FALSE },
41 +  { FLAG_DONTLIE,              "DontLie",                      OPTV_BOOLEAN,
42 +       {0}, FALSE },
43    { -1,                                NULL,                           OPTV_NONE,
44         {0}, FALSE },
45  };
46 @@ -809,6 +812,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
47      xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
48      xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
49      xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
50 +    xf86GetOptValBool(FlagOptions, FLAG_DONTLIE, &xf86Info.dontLie);
51  
52      xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
53      if (xf86Info.ignoreABI) {
54 diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
55 index 16d5557..b0f602a 100644
56 --- a/hw/xfree86/common/xf86Globals.c
57 +++ b/hw/xfree86/common/xf86Globals.c
58 @@ -105,6 +105,7 @@ xf86InfoRec xf86Info = {
59      .dontVTSwitch               = FALSE,
60      .dontZap                    = FALSE,
61      .dontZoom                   = FALSE,
62 +    .dontLie                    = FALSE,
63      .notrapSignals              = FALSE,
64      .caughtSignal               = FALSE,
65      .currentScreen              = NULL,
66 diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
67 index 608f9bd..d05f206 100644
68 --- a/hw/xfree86/common/xf86Privstr.h
69 +++ b/hw/xfree86/common/xf86Privstr.h
70 @@ -68,6 +68,8 @@ typedef struct {
71      Bool               dontVTSwitch;
72      Bool               dontZap;
73      Bool               dontZoom;
74 +    Bool               dontLie;
75 +
76      Bool               notrapSignals;  /* don't exit cleanly - die at fault */
77      Bool               caughtSignal;
78  
79 diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
80 index f406f82..a9d418c 100644
81 --- a/hw/xfree86/man/xorg.conf.man
82 +++ b/hw/xfree86/man/xorg.conf.man
83 @@ -544,6 +544,12 @@ When this option is enabled, those key sequences have no special meaning
84  and are passed to clients.
85  Default: off.
86  .TP 7
87 +.BI "Option \*qDontLie\*q  \*q" boolean \*q
88 +This option suggests that the server should avoid lying whenever possible.
89 +Currently this means that RandR 1.2 drivers will try to compute the proper DPI
90 +instead of making it up.
91 +Default: off.
92 +.TP 7
93  .BI "Option \*qDisableVidModeExtension\*q  \*q" boolean \*q
94  This disables the parts of the VidMode extension used by the xvidtune client
95  that can be used to change the video modes.
96 diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
97 index cb20d1c..65da9bf 100644
98 --- a/hw/xfree86/modes/xf86RandR12.c
99 +++ b/hw/xfree86/modes/xf86RandR12.c
100 @@ -805,6 +805,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
101         else
102         {
103             xf86OutputPtr   output = xf86CompatOutput(pScrn);
104 +           xf86CrtcPtr     crtc   = output->crtc;
105  
106             if (output &&
107                 output->conf_monitor &&
108 @@ -817,6 +818,17 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
109                 mmWidth = output->conf_monitor->mon_width;
110                 mmHeight = output->conf_monitor->mon_height;
111             }
112 +           else if (xf86Info.dontLie && crtc && crtc->mode.HDisplay &&
113 +                    output->mm_width && output->mm_height)
114 +           {
115 +               /*
116 +                * If the output has a mode and a declared size, use that
117 +                * to scale the screen size
118 +                */
119 +               DisplayModePtr  mode = &crtc->mode;
120 +               mmWidth = output->mm_width * width / mode->HDisplay;
121 +               mmHeight = output->mm_height * height / mode->VDisplay;
122 +           }
123             else
124             {
125                 /*
126 -- 
127 1.7.3.4
128