RANDR 1.2: Fix initial mode aspect ratio match in a corner case.
Actually more like in the mainline case, where the ideal mode happens to be the very first aspect match on the first monitor. But let's not split hairs.
This commit is contained in:
parent
1b9878ffcf
commit
8248537722
|
@ -1683,14 +1683,19 @@ aspectMatch(float a, float b)
|
||||||
}
|
}
|
||||||
|
|
||||||
static DisplayModePtr
|
static DisplayModePtr
|
||||||
nextAspectMode(DisplayModePtr start, float aspect)
|
nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
|
||||||
{
|
{
|
||||||
DisplayModePtr m = start;
|
DisplayModePtr m = NULL;
|
||||||
|
|
||||||
if (!m)
|
if (!o)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (m = m->next; m; m = m->next)
|
if (!last)
|
||||||
|
m = o->probed_modes;
|
||||||
|
else
|
||||||
|
m = last->next;
|
||||||
|
|
||||||
|
for (; m; m = m->next)
|
||||||
if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
|
if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
|
||||||
return m;
|
return m;
|
||||||
|
|
||||||
|
@ -1700,12 +1705,11 @@ nextAspectMode(DisplayModePtr start, float aspect)
|
||||||
static DisplayModePtr
|
static DisplayModePtr
|
||||||
bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
|
bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
|
||||||
{
|
{
|
||||||
int o, p;
|
int o = -1, p;
|
||||||
DisplayModePtr mode, test = NULL, match = NULL;
|
DisplayModePtr mode = NULL, test = NULL, match = NULL;
|
||||||
|
|
||||||
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
nextEnabledOutput(config, enabled, &o);
|
||||||
mode = config->output[o]->probed_modes;
|
while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
|
||||||
while ((mode = nextAspectMode(mode, aspect))) {
|
|
||||||
for (p = o; nextEnabledOutput(config, enabled, &p); ) {
|
for (p = o; nextEnabledOutput(config, enabled, &p); ) {
|
||||||
test = xf86OutputFindClosestMode(config->output[p], mode);
|
test = xf86OutputFindClosestMode(config->output[p], mode);
|
||||||
if (!test)
|
if (!test)
|
||||||
|
@ -1725,7 +1729,6 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
|
||||||
if (!match || (test->HDisplay > match->HDisplay))
|
if (!match || (test->HDisplay > match->HDisplay))
|
||||||
match = test;
|
match = test;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* return the biggest one found */
|
/* return the biggest one found */
|
||||||
return match;
|
return match;
|
||||||
|
|
Loading…
Reference in New Issue