formatting

SVN revision: 80851
This commit is contained in:
Mike Blumenkrantz 2012-12-13 13:42:50 +00:00
parent 006a014982
commit 1e75ff35e1
1 changed files with 247 additions and 246 deletions

View File

@ -3,64 +3,64 @@
/* TODO: /* TODO:
* *
* Give list some icons. * Give list some icons.
*/ */
#define RANDR_11 ((1 << 16) | 1) #define RANDR_11 ((1 << 16) | 1)
static void _fill_data (E_Config_Dialog_Data *cfdata); static void _fill_data(E_Config_Dialog_Data *cfdata);
static void *_create_data (E_Config_Dialog *cfd); static void *_create_data(E_Config_Dialog *cfd);
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_check_changed (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static void _load_resolutions (E_Config_Dialog_Data *cfdata); static void _load_resolutions(E_Config_Dialog_Data *cfdata);
static void _load_rates (E_Config_Dialog_Data *cfdata); static void _load_rates(E_Config_Dialog_Data *cfdata);
static void _ilist_item_change (void *data); static void _ilist_item_change(void *data);
static Eina_Bool _deferred_noxrandr_error (void *data); static Eina_Bool _deferred_noxrandr_error(void *data);
static Eina_Bool _deferred_norates_error (void *data); static Eina_Bool _deferred_norates_error(void *data);
static int _sort_resolutions (const void *d1, const void *d2); static int _sort_resolutions(const void *d1, const void *d2);
typedef struct _Resolution Resolution; typedef struct _Resolution Resolution;
typedef struct _SureBox SureBox; typedef struct _SureBox SureBox;
struct _Resolution struct _Resolution
{ {
int id; int id;
Ecore_X_Randr_Screen_Size size; Ecore_X_Randr_Screen_Size size;
int size_index; int size_index;
Eina_List *rates; Eina_List *rates;
}; };
struct _SureBox struct _SureBox
{ {
E_Dialog *dia; E_Dialog *dia;
Ecore_Timer *timer; Ecore_Timer *timer;
int iterations; int iterations;
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
}; };
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
Eina_List *resolutions; Eina_List *resolutions;
Ecore_X_Randr_Screen_Size orig_size; Ecore_X_Randr_Screen_Size orig_size;
int orig_size_index; int orig_size_index;
Ecore_X_Randr_Refresh_Rate orig_rate; Ecore_X_Randr_Refresh_Rate orig_rate;
int orig_orientation; int orig_orientation;
int orig_flip; int orig_flip;
int restore; int restore;
int can_rotate; int can_rotate;
int can_flip; int can_flip;
int orientation; int orientation;
int flip; int flip;
int flip_x; int flip_x;
int flip_y; int flip_y;
Eina_Bool has_rates; Eina_Bool has_rates;
Evas_Object *rate_list; Evas_Object *rate_list;
Evas_Object *res_list; Evas_Object *res_list;
SureBox *surebox; SureBox *surebox;
}; };
static void static void
@ -105,7 +105,7 @@ _surebox_dialog_cb_no(void *data, E_Dialog *dia)
sb = data; sb = data;
ecore_x_randr_screen_primary_output_refresh_rate_set(sb->dia->win->container->manager->root, ecore_x_randr_screen_primary_output_refresh_rate_set(sb->dia->win->container->manager->root,
sb->cfdata->orig_size_index, sb->cfdata->orig_rate); sb->cfdata->orig_size_index, sb->cfdata->orig_rate);
_load_resolutions(sb->cfdata); _load_resolutions(sb->cfdata);
_load_rates(sb->cfdata); _load_rates(sb->cfdata);
_surebox_dialog_cb_delete(dia->win); _surebox_dialog_cb_delete(dia->win);
@ -119,42 +119,42 @@ _surebox_text_fill(SureBox *sb)
if (!sb->dia) return; if (!sb->dia) return;
if (sb->iterations > 1) if (sb->iterations > 1)
{ {
if (sb->cfdata->has_rates) if (sb->cfdata->has_rates)
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
P_("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>" P_("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>"
"If you do not press a button, the old resolution of<br>" "If you do not press a button, the old resolution of<br>"
"%d×%d at %d Hz will be restored in %d second.", "%d×%d at %d Hz will be restored in %d second.",
"Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>" "Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>"
"If you do not press a button, the old resolution of<br>" "If you do not press a button, the old resolution of<br>"
"%d×%d at %d Hz will be restored in %d seconds.", sb->iterations), "%d×%d at %d Hz will be restored in %d seconds.", sb->iterations),
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height, sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
sb->cfdata->orig_rate, sb->iterations); sb->cfdata->orig_rate, sb->iterations);
else else
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
P_("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>" P_("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>"
"If you do not press a button, the old resolution of<br>" "If you do not press a button, the old resolution of<br>"
"%d×%d will be restored in %d second.", "%d×%d will be restored in %d second.",
"Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>" "Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>"
"If you do not press a button, the old resolution of<br>" "If you do not press a button, the old resolution of<br>"
"%d×%d will be restored in %d seconds.", sb->iterations), "%d×%d will be restored in %d seconds.", sb->iterations),
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height, sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
sb->iterations); sb->iterations);
} }
else else
{ {
if (sb->cfdata->has_rates) if (sb->cfdata->has_rates)
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
_("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>" _("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>"
"If you do not press a button, the old resolution of<br>" "If you do not press a button, the old resolution of<br>"
"%d×%d at %d Hz will be restored <hilight>IMMEDIATELY</hilight>."), "%d×%d at %d Hz will be restored <hilight>IMMEDIATELY</hilight>."),
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height, sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
sb->cfdata->orig_rate); sb->cfdata->orig_rate);
else else
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
_("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>" _("Does this look OK? <hilight>Save</hilight> if it does, or Restore if not.<br>"
"If you do not press a button, the old resolution of<br>" "If you do not press a button, the old resolution of<br>"
"%d×%d will be restored <hilight>IMMEDIATELY</hilight>."), "%d×%d will be restored <hilight>IMMEDIATELY</hilight>."),
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height); sb->cfdata->orig_size.width, sb->cfdata->orig_size.height);
} }
e_dialog_text_set(sb->dia, buf); e_dialog_text_set(sb->dia, buf);
} }
@ -169,8 +169,8 @@ _surebox_timer_cb(void *data)
_surebox_text_fill(sb); _surebox_text_fill(sb);
if (sb->iterations == 0) if (sb->iterations == 0)
{ {
_surebox_dialog_cb_no(sb, sb->dia); _surebox_dialog_cb_no(sb, sb->dia);
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }
@ -227,8 +227,8 @@ e_int_config_display(E_Container *con, const char *params __UNUSED__)
v->override_auto_apply = 1; v->override_auto_apply = 1;
cfd = e_config_dialog_new(con, _("Screen Resolution Settings"), cfd = e_config_dialog_new(con, _("Screen Resolution Settings"),
"E", "screen/screen_resolution", "E", "screen/screen_resolution",
"preferences-system-screen-resolution", 0, v, NULL); "preferences-system-screen-resolution", 0, v, NULL);
return cfd; return cfd;
} }
@ -245,25 +245,25 @@ _fill_data(E_Config_Dialog_Data *cfdata)
rots = ecore_x_randr_screen_primary_output_orientations_get(man->root); rots = ecore_x_randr_screen_primary_output_orientations_get(man->root);
if ((rots) && (rots != ECORE_X_RANDR_ORIENTATION_ROT_0)) if ((rots) && (rots != ECORE_X_RANDR_ORIENTATION_ROT_0))
{ {
cfdata->orientation = ecore_x_randr_screen_primary_output_orientation_get(man->root); cfdata->orientation = ecore_x_randr_screen_primary_output_orientation_get(man->root);
cfdata->can_flip = rots & (ECORE_X_RANDR_ORIENTATION_FLIP_X | ECORE_X_RANDR_ORIENTATION_FLIP_Y); cfdata->can_flip = rots & (ECORE_X_RANDR_ORIENTATION_FLIP_X | ECORE_X_RANDR_ORIENTATION_FLIP_Y);
cfdata->flip = cfdata->orientation & cfdata->flip = cfdata->orientation &
(ECORE_X_RANDR_ORIENTATION_FLIP_X | ECORE_X_RANDR_ORIENTATION_FLIP_Y); (ECORE_X_RANDR_ORIENTATION_FLIP_X | ECORE_X_RANDR_ORIENTATION_FLIP_Y);
cfdata->orig_flip = cfdata->flip; cfdata->orig_flip = cfdata->flip;
if (cfdata->orientation & (ECORE_X_RANDR_ORIENTATION_FLIP_X)) if (cfdata->orientation & (ECORE_X_RANDR_ORIENTATION_FLIP_X))
cfdata->flip_x = 1; cfdata->flip_x = 1;
if (cfdata->orientation & (ECORE_X_RANDR_ORIENTATION_FLIP_Y)) if (cfdata->orientation & (ECORE_X_RANDR_ORIENTATION_FLIP_Y))
cfdata->flip_y = 1; cfdata->flip_y = 1;
cfdata->can_rotate = cfdata->can_rotate =
rots & (ECORE_X_RANDR_ORIENTATION_ROT_0 | ECORE_X_RANDR_ORIENTATION_ROT_90 | rots & (ECORE_X_RANDR_ORIENTATION_ROT_0 | ECORE_X_RANDR_ORIENTATION_ROT_90 |
ECORE_X_RANDR_ORIENTATION_ROT_180 | ECORE_X_RANDR_ORIENTATION_ROT_270); ECORE_X_RANDR_ORIENTATION_ROT_180 | ECORE_X_RANDR_ORIENTATION_ROT_270);
cfdata->orientation = cfdata->orientation =
cfdata->orientation & cfdata->orientation &
(ECORE_X_RANDR_ORIENTATION_ROT_0 | ECORE_X_RANDR_ORIENTATION_ROT_90 | (ECORE_X_RANDR_ORIENTATION_ROT_0 | ECORE_X_RANDR_ORIENTATION_ROT_90 |
ECORE_X_RANDR_ORIENTATION_ROT_180 | ECORE_X_RANDR_ORIENTATION_ROT_270); ECORE_X_RANDR_ORIENTATION_ROT_180 | ECORE_X_RANDR_ORIENTATION_ROT_270);
cfdata->orig_orientation = cfdata->orientation; cfdata->orig_orientation = cfdata->orientation;
} }
} }
@ -288,12 +288,12 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
EINA_LIST_FREE(cfdata->resolutions, r) EINA_LIST_FREE(cfdata->resolutions, r)
{ {
Ecore_X_Randr_Refresh_Rate *rt; Ecore_X_Randr_Refresh_Rate *rt;
EINA_LIST_FREE(r->rates, rt) EINA_LIST_FREE(r->rates, rt)
E_FREE(rt); E_FREE(rt);
E_FREE(r); E_FREE(r);
} }
E_FREE(cfdata); E_FREE(cfdata);
} }
@ -314,16 +314,16 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
rt = eina_list_nth(res->rates, r); rt = eina_list_nth(res->rates, r);
if (!rt) return 0; if (!rt) return 0;
return ((res->size.width != cfdata->orig_size.width) || return (res->size.width != cfdata->orig_size.width) ||
(res->size.height != cfdata->orig_size.height) || (res->size.height != cfdata->orig_size.height) ||
(cfdata->has_rates && (*rt != cfdata->orig_rate)) || (cfdata->has_rates && (*rt != cfdata->orig_rate)) ||
(cfdata->can_rotate && (cfdata->can_rotate &&
(cfdata->orig_orientation != cfdata->orientation)) || (cfdata->orig_orientation != cfdata->orientation)) ||
(cfdata->can_flip && (cfdata->can_flip &&
(((!(cfdata->orig_flip & ECORE_X_RANDR_ORIENTATION_FLIP_X)) != (((!(cfdata->orig_flip & ECORE_X_RANDR_ORIENTATION_FLIP_X)) !=
(!cfdata->flip_x)) || (!cfdata->flip_x)) ||
((!(cfdata->orig_flip & ECORE_X_RANDR_ORIENTATION_FLIP_Y)) != ((!(cfdata->orig_flip & ECORE_X_RANDR_ORIENTATION_FLIP_Y)) !=
(!cfdata->flip_y))))); (!cfdata->flip_y))));
} }
static int static int
@ -342,39 +342,39 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
man = e_manager_current_get(); man = e_manager_current_get();
if (!((cfdata->orig_size.width == res->size.width) && if (!((cfdata->orig_size.width == res->size.width) &&
(cfdata->orig_size.height == res->size.height) && (cfdata->orig_size.height == res->size.height) &&
(cfdata->orig_rate == *rate || !cfdata->has_rates))) (cfdata->orig_rate == *rate || !cfdata->has_rates)))
{ {
if (cfdata->has_rates) if (cfdata->has_rates)
ecore_x_randr_screen_primary_output_refresh_rate_set(man->root, res->size_index, *rate); ecore_x_randr_screen_primary_output_refresh_rate_set(man->root, res->size_index, *rate);
else else
ecore_x_randr_screen_primary_output_size_set(man->root, res->size_index); ecore_x_randr_screen_primary_output_size_set(man->root, res->size_index);
if (e_config->cnfmdlg_disabled) if (e_config->cnfmdlg_disabled)
{ {
SureBox *sb; SureBox *sb;
sb = E_NEW(SureBox, 1); sb = E_NEW(SureBox, 1);
sb->cfd = cfd; sb->cfd = cfd;
sb->cfdata = cfdata; sb->cfdata = cfdata;
_surebox_dialog_cb_yes (sb, NULL); _surebox_dialog_cb_yes(sb, NULL);
} }
else else
_surebox_new(cfd, cfdata); _surebox_new(cfd, cfdata);
} }
if ((cfdata->can_rotate) || (cfdata->can_flip)) if ((cfdata->can_rotate) || (cfdata->can_flip))
{ {
cfdata->flip = cfdata->orientation; cfdata->flip = cfdata->orientation;
if (cfdata->flip_x) if (cfdata->flip_x)
cfdata->flip = (cfdata->flip | ECORE_X_RANDR_ORIENTATION_FLIP_X); cfdata->flip = (cfdata->flip | ECORE_X_RANDR_ORIENTATION_FLIP_X);
if (cfdata->flip_y) if (cfdata->flip_y)
cfdata->flip = (cfdata->flip | ECORE_X_RANDR_ORIENTATION_FLIP_Y); cfdata->flip = (cfdata->flip | ECORE_X_RANDR_ORIENTATION_FLIP_Y);
ecore_x_randr_screen_primary_output_orientation_set(man->root, ecore_x_randr_screen_primary_output_orientation_set(man->root,
(cfdata->orientation | cfdata->flip)); (cfdata->orientation | cfdata->flip));
cfdata->orig_orientation = cfdata->orientation; cfdata->orig_orientation = cfdata->orientation;
cfdata->orig_flip = cfdata->flip; cfdata->orig_flip = cfdata->flip;
} }
return 1; return 1;
@ -417,43 +417,43 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
ecore_timer_add(0.5, _deferred_noxrandr_error, NULL); ecore_timer_add(0.5, _deferred_noxrandr_error, NULL);
else else
{ {
ecore_x_randr_screen_primary_output_current_size_get(man->root, &cfdata->orig_size.width, &cfdata->orig_size.height, NULL, NULL, &cfdata->orig_size_index); ecore_x_randr_screen_primary_output_current_size_get(man->root, &cfdata->orig_size.width, &cfdata->orig_size.height, NULL, NULL, &cfdata->orig_size_index);
cfdata->orig_rate = ecore_x_randr_screen_primary_output_current_refresh_rate_get(man->root); cfdata->orig_rate = ecore_x_randr_screen_primary_output_current_refresh_rate_get(man->root);
for (i = 0; i < (s - 1); i++) for (i = 0; i < (s - 1); i++)
{ {
Resolution * res; Resolution *res;
Ecore_X_Randr_Refresh_Rate * rates; Ecore_X_Randr_Refresh_Rate *rates;
int r = 0, j; int r = 0, j;
res = E_NEW(Resolution, 1); res = E_NEW(Resolution, 1);
if (!res) continue; if (!res) continue;
res->size.width = sizes[i].width; res->size.width = sizes[i].width;
res->size.height = sizes[i].height; res->size.height = sizes[i].height;
res->size_index = i; res->size_index = i;
rates = ecore_x_randr_screen_primary_output_refresh_rates_get(man->root, i, &r); rates = ecore_x_randr_screen_primary_output_refresh_rates_get(man->root, i, &r);
for (j = 0; j < r; j++) for (j = 0; j < r; j++)
{ {
Ecore_X_Randr_Refresh_Rate * rt; Ecore_X_Randr_Refresh_Rate *rt;
cfdata->has_rates = EINA_TRUE; cfdata->has_rates = EINA_TRUE;
rt = E_NEW(Ecore_X_Randr_Refresh_Rate, 1); rt = E_NEW(Ecore_X_Randr_Refresh_Rate, 1);
if (!rt) continue; if (!rt) continue;
*rt = rates[j]; *rt = rates[j];
res->rates = eina_list_append(res->rates, rt); res->rates = eina_list_append(res->rates, rt);
} }
if (rates) E_FREE(rates); if (rates) E_FREE(rates);
cfdata->resolutions = eina_list_append(cfdata->resolutions, res); cfdata->resolutions = eina_list_append(cfdata->resolutions, res);
} }
cfdata->resolutions = eina_list_sort(cfdata->resolutions, cfdata->resolutions = eina_list_sort(cfdata->resolutions,
eina_list_count(cfdata->resolutions), _sort_resolutions); eina_list_count(cfdata->resolutions), _sort_resolutions);
cfdata->resolutions = eina_list_reverse(cfdata->resolutions); cfdata->resolutions = eina_list_reverse(cfdata->resolutions);
_load_resolutions(cfdata); _load_resolutions(cfdata);
if (!cfdata->has_rates) if (!cfdata->has_rates)
ecore_timer_add(0.5, _deferred_norates_error, NULL); ecore_timer_add(0.5, _deferred_norates_error, NULL);
} }
E_FREE(sizes); E_FREE(sizes);
@ -462,34 +462,34 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
if (cfdata->can_rotate) if (cfdata->can_rotate)
{ {
of = e_widget_framelist_add(evas, _("Rotation"), 0); of = e_widget_framelist_add(evas, _("Rotation"), 0);
rg = e_widget_radio_group_new(&(cfdata->orientation)); rg = e_widget_radio_group_new(&(cfdata->orientation));
ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-normal", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_0, rg); ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-normal", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_0, rg);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_0)) e_widget_disabled_set(ob, 1); if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_0)) e_widget_disabled_set(ob, 1);
ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-left", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_90, rg); ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-left", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_90, rg);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_90)) e_widget_disabled_set(ob, 1); if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_90)) e_widget_disabled_set(ob, 1);
ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-around", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_180, rg); ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-around", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_180, rg);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_180)) e_widget_disabled_set(ob, 1); if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_180)) e_widget_disabled_set(ob, 1);
ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-right", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_270, rg); ob = e_widget_radio_icon_add(evas, NULL, "preferences-screen-right", 24, 24, ECORE_X_RANDR_ORIENTATION_ROT_270, rg);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_270)) e_widget_disabled_set(ob, 1); if (!(cfdata->can_rotate & ECORE_X_RANDR_ORIENTATION_ROT_270)) e_widget_disabled_set(ob, 1);
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 0, 1, 0); e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 0, 1, 0);
} }
if (cfdata->can_flip) if (cfdata->can_flip)
{ {
of = e_widget_framelist_add(evas, _("Mirroring"), 0); of = e_widget_framelist_add(evas, _("Mirroring"), 0);
ob = e_widget_check_icon_add(evas, NULL, "preferences-screen-hflip", 24, 24, &(cfdata->flip_x)); ob = e_widget_check_icon_add(evas, NULL, "preferences-screen-hflip", 24, 24, &(cfdata->flip_x));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
if (!(cfdata->can_flip & ECORE_X_RANDR_ORIENTATION_FLIP_X)) e_widget_disabled_set(ob, 1); if (!(cfdata->can_flip & ECORE_X_RANDR_ORIENTATION_FLIP_X)) e_widget_disabled_set(ob, 1);
ob = e_widget_check_icon_add(evas, NULL, "preferences-screen-vflip", 24, 24, &(cfdata->flip_y)); ob = e_widget_check_icon_add(evas, NULL, "preferences-screen-vflip", 24, 24, &(cfdata->flip_y));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
if (!(cfdata->can_flip & ECORE_X_RANDR_ORIENTATION_FLIP_Y)) if (!(cfdata->can_flip & ECORE_X_RANDR_ORIENTATION_FLIP_Y))
e_widget_disabled_set(ob, 1); e_widget_disabled_set(ob, 1);
e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 0, 1, 0); e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 0, 1, 0);
} }
e_widget_table_object_append(o, ot, 1, 0, 1, 1, 1, 1, 1, 1); e_widget_table_object_append(o, ot, 1, 0, 1, 1, 1, 1, 1, 1);
@ -518,54 +518,54 @@ _load_resolutions(E_Config_Dialog_Data *cfdata)
evas = evas_object_evas_get(cfdata->res_list); evas = evas_object_evas_get(cfdata->res_list);
if (e_widget_ilist_count(cfdata->res_list) != if (e_widget_ilist_count(cfdata->res_list) !=
(int) eina_list_count(cfdata->resolutions)) (int)eina_list_count(cfdata->resolutions))
{ {
evas_event_freeze(evas); evas_event_freeze(evas);
edje_freeze(); edje_freeze();
e_widget_ilist_freeze(cfdata->res_list); e_widget_ilist_freeze(cfdata->res_list);
e_widget_ilist_clear(cfdata->res_list); e_widget_ilist_clear(cfdata->res_list);
for (l = cfdata->resolutions, i = 0; l; l = l->next, i++) for (l = cfdata->resolutions, i = 0; l; l = l->next, i++)
{ {
char buf[1024]; char buf[1024];
Resolution *res = l->data; Resolution *res = l->data;
Evas_Object *ob = NULL; Evas_Object *ob = NULL;
res->id = i; res->id = i;
snprintf(buf, sizeof(buf), _("%i×%i"), res->size.width, res->size.height); snprintf(buf, sizeof(buf), _("%i×%i"), res->size.width, res->size.height);
if ((res->size.width == cfdata->orig_size.width) && if ((res->size.width == cfdata->orig_size.width) &&
(res->size.height == cfdata->orig_size.height)) (res->size.height == cfdata->orig_size.height))
{ {
ob = e_icon_add(evas); ob = e_icon_add(evas);
e_util_icon_theme_set(ob, "dialog-ok-apply"); e_util_icon_theme_set(ob, "dialog-ok-apply");
sel = res->id; sel = res->id;
} }
e_widget_ilist_append(cfdata->res_list, ob, buf, e_widget_ilist_append(cfdata->res_list, ob, buf,
_ilist_item_change, cfdata, NULL); _ilist_item_change, cfdata, NULL);
} }
e_widget_ilist_go(cfdata->res_list); e_widget_ilist_go(cfdata->res_list);
e_widget_ilist_selected_set(cfdata->res_list, sel); e_widget_ilist_selected_set(cfdata->res_list, sel);
e_widget_ilist_thaw(cfdata->res_list); e_widget_ilist_thaw(cfdata->res_list);
edje_thaw(); edje_thaw();
evas_event_thaw(evas); evas_event_thaw(evas);
} }
else else
{ {
for (l = cfdata->resolutions; l; l = l->next) for (l = cfdata->resolutions; l; l = l->next)
{ {
Resolution *res = l->data; Resolution *res = l->data;
Evas_Object *ob = NULL; Evas_Object *ob = NULL;
if ((res->size.width == cfdata->orig_size.width) && if ((res->size.width == cfdata->orig_size.width) &&
(res->size.height == cfdata->orig_size.height)) (res->size.height == cfdata->orig_size.height))
{ {
ob = e_icon_add(evas); ob = e_icon_add(evas);
e_util_icon_theme_set(ob, "dialog-ok-apply"); e_util_icon_theme_set(ob, "dialog-ok-apply");
} }
e_widget_ilist_nth_icon_set(cfdata->res_list, res->id, ob); e_widget_ilist_nth_icon_set(cfdata->res_list, res->id, ob);
} }
} }
} }
@ -589,25 +589,25 @@ _load_rates(E_Config_Dialog_Data *cfdata)
EINA_LIST_FOREACH(cfdata->resolutions, l, res) EINA_LIST_FOREACH(cfdata->resolutions, l, res)
if (res->id == r) if (res->id == r)
{ {
Ecore_X_Randr_Refresh_Rate *rt; Ecore_X_Randr_Refresh_Rate *rt;
Eina_List *ll; Eina_List *ll;
EINA_LIST_FOREACH(res->rates, ll, rt) EINA_LIST_FOREACH(res->rates, ll, rt)
{ {
Evas_Object *ob = NULL; Evas_Object *ob = NULL;
snprintf(buf, sizeof(buf), "%i Hz", (int)*rt); snprintf(buf, sizeof(buf), "%i Hz", (int)*rt);
if (*rt == cfdata->orig_rate) if (*rt == cfdata->orig_rate)
{ {
ob = e_icon_add(evas); ob = e_icon_add(evas);
e_util_icon_theme_set(ob, "dialog-ok-apply"); e_util_icon_theme_set(ob, "dialog-ok-apply");
sel = k; sel = k;
} }
e_widget_ilist_append(cfdata->rate_list, ob, buf, NULL, NULL, NULL); e_widget_ilist_append(cfdata->rate_list, ob, buf, NULL, NULL, NULL);
k++; k++;
} }
break; break;
} }
e_widget_ilist_go(cfdata->rate_list); e_widget_ilist_go(cfdata->rate_list);
@ -627,12 +627,12 @@ static Eina_Bool
_deferred_noxrandr_error(void *data __UNUSED__) _deferred_noxrandr_error(void *data __UNUSED__)
{ {
e_util_dialog_show(_("Missing Features"), e_util_dialog_show(_("Missing Features"),
_("Your X Display Server is missing support for<br>" _("Your X Display Server is missing support for<br>"
"the <hilight>XRandR</hilight> (X Resize and Rotate) extension.<br>" "the <hilight>XRandR</hilight> (X Resize and Rotate) extension.<br>"
"You cannot change screen resolutions without<br>" "You cannot change screen resolutions without<br>"
"the support of this extension. It could also be<br>" "the support of this extension. It could also be<br>"
"that at the time <hilight>ecore</hilight> was built, there<br>" "that at the time <hilight>ecore</hilight> was built, there<br>"
"was no XRandR support detected.")); "was no XRandR support detected."));
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }
@ -640,10 +640,11 @@ static Eina_Bool
_deferred_norates_error(void *data __UNUSED__) _deferred_norates_error(void *data __UNUSED__)
{ {
e_util_dialog_show(_("No Refresh Rates Found"), e_util_dialog_show(_("No Refresh Rates Found"),
_("No refresh rates were reported by your X Display Server.<br>" _("No refresh rates were reported by your X Display Server.<br>"
"If you are running a nested X Display Server, then<br>" "If you are running a nested X Display Server, then<br>"
"this is to be expected. However, if you are not, then<br>" "this is to be expected. However, if you are not, then<br>"
"the current refresh rate will be used when setting<br>" "the current refresh rate will be used when setting<br>"
"the resolution, which may cause <hilight>damage</hilight> to your screen.")); "the resolution, which may cause <hilight>damage</hilight> to your screen."));
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }