From 2027734141fa9d27e01886d7e81ea413ff57c8ce Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sat, 15 Aug 2020 16:54:22 +0100 Subject: [PATCH] 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. --- src/bin/e_comp_x_randr.c | 1 + src/bin/e_randr2.h | 1 + src/modules/conf_randr/e_int_config_randr2.c | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/e_comp_x_randr.c b/src/bin/e_comp_x_randr.c index fd9f3f650..f0070fabe 100644 --- a/src/bin/e_comp_x_randr.c +++ b/src/bin/e_comp_x_randr.c @@ -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); diff --git a/src/bin/e_randr2.h b/src/bin/e_randr2.h index 5abccf8e6..2c44a205f 100644 --- a/src/bin/e_randr2.h +++ b/src/bin/e_randr2.h @@ -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? }; diff --git a/src/modules/conf_randr/e_int_config_randr2.c b/src/modules/conf_randr/e_int_config_randr2.c index f12b29920..5ce8714aa 100644 --- a/src/modules/conf_randr/e_int_config_randr2.c +++ b/src/modules/conf_randr/e_int_config_randr2.c @@ -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); */