forked from enlightenment/enlightenment
conf_randr: hide refresh rates when none to show
This commit is contained in:
parent
d9acc5a5c2
commit
c994e235f9
|
@ -1242,6 +1242,7 @@ _e_smart_monitor_mode_refresh_rates_fill(Evas_Object *obj)
|
||||||
Ecore_X_Randr_Mode_Info *cmode = NULL, *mode = NULL;
|
Ecore_X_Randr_Mode_Info *cmode = NULL, *mode = NULL;
|
||||||
E_Radio_Group *rg = NULL;
|
E_Radio_Group *rg = NULL;
|
||||||
Evas_Coord mw = 0, mh = 0;
|
Evas_Coord mw = 0, mh = 0;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
|
@ -1268,18 +1269,21 @@ _e_smart_monitor_mode_refresh_rates_fill(Evas_Object *obj)
|
||||||
/* loop the modes and find the current one */
|
/* loop the modes and find the current one */
|
||||||
EINA_LIST_FOREACH(sd->modes, m, mode)
|
EINA_LIST_FOREACH(sd->modes, m, mode)
|
||||||
{
|
{
|
||||||
|
double rate = 0.0;
|
||||||
|
|
||||||
|
rate = e_randr_mode_refresh_rate_get(mode);
|
||||||
|
if (rate == 0.0) continue;
|
||||||
|
|
||||||
/* compare mode IDs */
|
/* compare mode IDs */
|
||||||
if (cmode->xid == mode->xid)
|
if (cmode->xid == mode->xid)
|
||||||
{
|
{
|
||||||
Evas_Object *ow;
|
Evas_Object *ow;
|
||||||
double rate = 0.0;
|
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
|
|
||||||
/* create new radio group if needed */
|
/* create new radio group if needed */
|
||||||
if (!rg) rg = e_widget_radio_group_new(&sd->current.refresh_rate);
|
if (!rg) rg = e_widget_radio_group_new(&sd->current.refresh_rate);
|
||||||
|
|
||||||
/* get the refresh rate for this mode */
|
/* get the refresh rate for this mode */
|
||||||
rate = e_randr_mode_refresh_rate_get(mode);
|
|
||||||
snprintf(buff, sizeof(buff), "%.1fHz", rate);
|
snprintf(buff, sizeof(buff), "%.1fHz", rate);
|
||||||
|
|
||||||
/* create radio widget */
|
/* create radio widget */
|
||||||
|
@ -1291,12 +1295,15 @@ _e_smart_monitor_mode_refresh_rates_fill(Evas_Object *obj)
|
||||||
|
|
||||||
/* add this radio to the list */
|
/* add this radio to the list */
|
||||||
e_widget_list_object_append(sd->o_refresh, ow, 1, 0, 0.5);
|
e_widget_list_object_append(sd->o_refresh, ow, 1, 0, 0.5);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free any memory allocated from ecore_x_randr */
|
/* free any memory allocated from ecore_x_randr */
|
||||||
if (cmode) ecore_x_randr_mode_info_free(cmode);
|
if (cmode) ecore_x_randr_mode_info_free(cmode);
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
/* calculate min size for refresh list and set */
|
/* calculate min size for refresh list and set */
|
||||||
e_widget_size_min_get(sd->o_refresh, &mw, &mh);
|
e_widget_size_min_get(sd->o_refresh, &mw, &mh);
|
||||||
edje_extern_object_min_size_set(sd->o_refresh, mw, mh);
|
edje_extern_object_min_size_set(sd->o_refresh, mw, mh);
|
||||||
|
@ -1304,6 +1311,13 @@ _e_smart_monitor_mode_refresh_rates_fill(Evas_Object *obj)
|
||||||
/* swallow refresh list */
|
/* swallow refresh list */
|
||||||
edje_object_part_swallow(sd->o_frame, "e.swallow.refresh", sd->o_refresh);
|
edje_object_part_swallow(sd->o_frame, "e.swallow.refresh", sd->o_refresh);
|
||||||
evas_object_show(sd->o_refresh);
|
evas_object_show(sd->o_refresh);
|
||||||
|
edje_object_signal_emit(sd->o_frame, "e,state,refresh,enabled", "e");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
E_FREE_FUNC(sd->o_refresh, evas_object_del);
|
||||||
|
edje_object_signal_emit(sd->o_frame, "e,state,refresh,disabled", "e");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue