conf_randr: List modes using double scan correctly.

As we can detect for double scan (since randr 1.2), list the mode
as valid, and also ensure the refresh rate is displayed correctly.
Each line is rendered twice, doubles the dot clock, so divide the
settings view by 2 so that it makes "sense". Can always add
flags to settings if deemed necessary.
This commit is contained in:
Alastair Poole 2020-08-15 16:54:22 +01:00
parent 5737eeb993
commit 2027734141
3 changed files with 6 additions and 1 deletions

View File

@ -791,6 +791,7 @@ e_comp_x_randr_create(void)
m->refresh =
(double)minfo->dotClock /
(double)(minfo->hTotal * minfo->vTotal);
m->flags = minfo->modeFlags;
if (j == (modes_pref - 1))
m->preferred = EINA_TRUE;
s->info.modes = eina_list_append(s->info.modes, m);

View File

@ -50,6 +50,7 @@ struct _E_Randr2_Mode
{
int w, h; // resolution width and height
double refresh; // refresh in hz
unsigned int flags; // randr mode flags.
Eina_Bool preferred E_BITFIELD; // is this the preferred mode for the device?
};

View File

@ -387,7 +387,10 @@ _basic_screen_info_fill(E_Config_Dialog_Data *cfdata, E_Config_Randr2_Screen *cs
{
mode_cbdata->cfdata = cfdata;
mode_cbdata->mode = *m;
snprintf(buf, sizeof(buf), "%ix%i @ %1.2fHz", m->w, m->h, m->refresh);
if (m->flags & ECORE_X_RANDR_MODE_DOUBLE_SCAN)
snprintf(buf, sizeof(buf), "%ix%i @ %1.2fHz", m->w, m->h, m->refresh / 2);
else
snprintf(buf, sizeof(buf), "%ix%i @ %1.2fHz", m->w, m->h, m->refresh);
it = elm_list_item_append(cfdata->modes_obj, buf, NULL, NULL, _cb_mode_set, mode_cbdata);
cfdata->freelist = eina_list_append(cfdata->freelist, mode_cbdata);
/* printf("mode add %p %p %p\n", mode_cbdata, cfdata->modes_obj, it); */