]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-base/xorg-server/files/xorg-server-dont-lie.patch
Add xorg-server with DontLie support.
[gentoo-draconx.git] / x11-base / xorg-server / files / xorg-server-dont-lie.patch
1 diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
2 index 6fbf613..88c8a56 100644
3 --- a/hw/xfree86/common/xf86Config.c
4 +++ b/hw/xfree86/common/xf86Config.c
5 @@ -703,7 +703,8 @@ typedef enum {
6      FLAG_AUTO_ENABLE_DEVICES,
7      FLAG_GLX_VISUALS,
8      FLAG_DRI2,
9 -    FLAG_USE_SIGIO
10 +    FLAG_USE_SIGIO,
11 +    FLAG_DONTLIE
12  } FlagValues;
13  
14  /**
15 @@ -767,6 +768,8 @@ static OptionInfoRec FlagOptions[] = {
16         {0}, FALSE },
17    { FLAG_USE_SIGIO,            "UseSIGIO",                     OPTV_BOOLEAN,
18         {0}, FALSE },
19 +  { FLAG_DONTLIE,              "DontLie",                      OPTV_BOOLEAN,
20 +       {0}, FALSE },
21    { -1,                                NULL,                           OPTV_NONE,
22         {0}, FALSE },
23  };
24 @@ -824,6 +827,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
25      xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
26      xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
27      xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
28 +    xf86GetOptValBool(FlagOptions, FLAG_DONTLIE, &xf86Info.dontLie);
29  
30      xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
31      if (xf86Info.ignoreABI) {
32 diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
33 index 98f8284..c7d03a4 100644
34 --- a/hw/xfree86/common/xf86Globals.c
35 +++ b/hw/xfree86/common/xf86Globals.c
36 @@ -110,6 +110,7 @@ xf86InfoRec xf86Info = {
37      .dontVTSwitch               = FALSE,
38      .dontZap                    = FALSE,
39      .dontZoom                   = FALSE,
40 +    .dontLie                    = FALSE,
41      .notrapSignals              = FALSE,
42      .caughtSignal               = FALSE,
43      .currentScreen              = NULL,
44 diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
45 index b2095aa..05166f9 100644
46 --- a/hw/xfree86/common/xf86Privstr.h
47 +++ b/hw/xfree86/common/xf86Privstr.h
48 @@ -68,6 +68,8 @@ typedef struct {
49      Bool               dontVTSwitch;
50      Bool               dontZap;
51      Bool               dontZoom;
52 +    Bool               dontLie;
53 +
54      Bool               notrapSignals;  /* don't exit cleanly - die at fault */
55      Bool               caughtSignal;
56  
57 diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
58 index 942c397..dd1269c 100644
59 --- a/hw/xfree86/doc/man/xorg.conf.man.pre
60 +++ b/hw/xfree86/doc/man/xorg.conf.man.pre
61 @@ -490,6 +490,12 @@ When this option is enabled, those key sequences have no special meaning
62  and are passed to clients.
63  Default: off.
64  .TP 7
65 +.BI "Option \*qDontLie\*q  \*q" boolean \*q
66 +This option suggests that the server should avoid lying whenever possible.
67 +Currently this means that RandR 1.2 drivers will try to compute the proper DPI
68 +instead of making it up.
69 +Default: off.
70 +.TP 7
71  .BI "Option \*qDisableVidModeExtension\*q  \*q" boolean \*q
72  This disables the parts of the VidMode extension used by the xvidtune client
73  that can be used to change the video modes.
74 diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
75 index 1fc63c4..5d8bc29 100644
76 --- a/hw/xfree86/modes/xf86RandR12.c
77 +++ b/hw/xfree86/modes/xf86RandR12.c
78 @@ -806,6 +806,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
79         else
80         {
81             xf86OutputPtr   output = config->output[config->compat_output];
82 +           xf86CrtcPtr     crtc   = output->crtc;
83  
84             if (output->conf_monitor &&
85                 (output->conf_monitor->mon_width  > 0 &&
86 @@ -817,6 +818,17 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
87                 mmWidth = output->conf_monitor->mon_width;
88                 mmHeight = output->conf_monitor->mon_height;
89             }
90 +           else if (xf86Info.dontLie && crtc && crtc->mode.HDisplay &&
91 +                    output->mm_width && output->mm_height)
92 +           {
93 +               /*
94 +                * If the output has a mode and a declared size, use that
95 +                * to scale the screen size
96 +                */
97 +               DisplayModePtr  mode = &crtc->mode;
98 +               mmWidth = output->mm_width * width / mode->HDisplay;
99 +               mmHeight = output->mm_height * height / mode->VDisplay;
100 +           }
101             else
102             {
103                 /*