finally - xkbswitch into core e. needs some polishing work. what i
have done here beyond just "copy the code" is: 1. fix up some code that was useless (didnt need to be done). 2. reformat all the code to be closer to efl/e style guidelines 3. add flags to the gadget popup menu to change keyboard 4. fix lots of warnings 5. fix some correctness in c - () vs (void) 6. added q66 to AUTHORS 7. made it use _() intl macro, not D_() (needed) 8. put xkbswitch module stuff in theme (need some prettying/work) 9. added some XXX: comments on things to do right now xkbswithc is actually very powerful (thanks q66) but its not that user-friendly. it lets you add a short-list of "keyboard layouts" you nee/duse. the gagdet lets you quick-switch between them. this actually works. it has nice little flaggy things to try help you out. what we probably need to do is: 1. fix a buffer overflow waiting to happen in the kbdswitch changing. XXX'd 2. add a wizard page asking for kbd layout 3. double-check that "last used kbdlayout" is actually turned on 4. move xkbd config to core e config (not separate in module) 5. pretty up the gagdet (add a shadow around the flag, some placeholder if no flag is selected etc.) 6. go over the xkb parser - it looks fragile from a read :) SVN revision: 70531
1
AUTHORS
|
@ -32,3 +32,4 @@ Sthitha <iamsthitha@gmail>
|
|||
Doyoun Kang <doyoun.kang@samsung.com>
|
||||
Gwanglim Lee <gl77.lee@samsung.com>
|
||||
Thomas Gstädtner <thomas@gstaedtner.net>
|
||||
q66 <quaker66@gmail.com>
|
||||
|
|
|
@ -797,6 +797,7 @@ AC_E_OPTIONAL_MODULE([shot], true)
|
|||
AC_E_OPTIONAL_MODULE([backlight], true)
|
||||
AC_E_OPTIONAL_MODULE([tasks], true)
|
||||
AC_E_OPTIONAL_MODULE([conf_randr], true)
|
||||
AC_E_OPTIONAL_MODULE([xkbswitch], true)
|
||||
|
||||
SUSPEND=""
|
||||
HIBERNATE=""
|
||||
|
@ -951,9 +952,12 @@ src/modules/backlight/Makefile
|
|||
src/modules/backlight/module.desktop
|
||||
src/modules/tasks/Makefile
|
||||
src/modules/tasks/module.desktop
|
||||
src/modules/xkbswitch/Makefile
|
||||
src/modules/xkbswitch/module.desktop
|
||||
src/preload/Makefile
|
||||
data/Makefile
|
||||
data/images/Makefile
|
||||
data/flags/Makefile
|
||||
data/input_methods/Makefile
|
||||
data/themes/Makefile
|
||||
data/themes/images/Makefile
|
||||
|
|
|
@ -7,5 +7,5 @@ xsession \
|
|||
input_methods \
|
||||
etc \
|
||||
icons \
|
||||
backgrounds
|
||||
|
||||
backgrounds \
|
||||
flags
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
filesdir = $(datadir)/enlightenment/data/flags
|
||||
files_DATA = \
|
||||
ad_flag.png \
|
||||
af_flag.png \
|
||||
al_flag.png \
|
||||
am_flag.png \
|
||||
ara_flag.png \
|
||||
at_flag.png \
|
||||
az_flag.png \
|
||||
ba_flag.png \
|
||||
bd_flag.png \
|
||||
be_flag.png \
|
||||
bg_flag.png \
|
||||
brai_flag.png \
|
||||
br_flag.png \
|
||||
bt_flag.png \
|
||||
bw_flag.png \
|
||||
by_flag.png \
|
||||
ca_flag.png \
|
||||
cd_flag.png \
|
||||
ch_flag.png \
|
||||
cn_flag.png \
|
||||
cz_flag.png \
|
||||
de_flag.png \
|
||||
dk_flag.png \
|
||||
ee_flag.png \
|
||||
epo_flag.png \
|
||||
es_flag.png \
|
||||
et_flag.png \
|
||||
fi_flag.png \
|
||||
fo_flag.png \
|
||||
fr_flag.png \
|
||||
gb_flag.png \
|
||||
ge_flag.png \
|
||||
gh_flag.png \
|
||||
gn_flag.png \
|
||||
gr_flag.png \
|
||||
hr_flag.png \
|
||||
hu_flag.png \
|
||||
ie_flag.png \
|
||||
il_flag.png \
|
||||
in_flag.png \
|
||||
iq_flag.png \
|
||||
ir_flag.png \
|
||||
is_flag.png \
|
||||
it_flag.png \
|
||||
jp_flag.png \
|
||||
ke_flag.png \
|
||||
kg_flag.png \
|
||||
kh_flag.png \
|
||||
kr_flag.png \
|
||||
kz_flag.png \
|
||||
la_flag.png \
|
||||
latam_flag.png \
|
||||
lk_flag.png \
|
||||
lt_flag.png \
|
||||
lv_flag.png \
|
||||
ma_flag.png \
|
||||
mao_flag.png \
|
||||
me_flag.png \
|
||||
mk_flag.png \
|
||||
ml_flag.png \
|
||||
mm_flag.png \
|
||||
mn_flag.png \
|
||||
mt_flag.png \
|
||||
mv_flag.png \
|
||||
ng_flag.png \
|
||||
nl_flag.png \
|
||||
no_flag.png \
|
||||
np_flag.png \
|
||||
ph_flag.png \
|
||||
pk_flag.png \
|
||||
pl_flag.png \
|
||||
pt_flag.png \
|
||||
ro_flag.png \
|
||||
rs_flag.png \
|
||||
ru_flag.png \
|
||||
se_flag.png \
|
||||
si_flag.png \
|
||||
sk_flag.png \
|
||||
sn_flag.png \
|
||||
sy_flag.png \
|
||||
th_flag.png \
|
||||
tj_flag.png \
|
||||
tm_flag.png \
|
||||
tr_flag.png \
|
||||
tw_flag.png \
|
||||
tz_flag.png \
|
||||
ua_flag.png \
|
||||
unknown_flag.png \
|
||||
us_flag.png \
|
||||
uz_flag.png \
|
||||
vn_flag.png \
|
||||
za_flag.png
|
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 379 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 334 B |
After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 416 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 588 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 466 B |
After Width: | Height: | Size: 375 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 629 B |
After Width: | Height: | Size: 327 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 440 B |
After Width: | Height: | Size: 744 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 325 B |
After Width: | Height: | Size: 326 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 471 B |
After Width: | Height: | Size: 326 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 330 B |
After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 437 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 946 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 508 B |
After Width: | Height: | Size: 366 B |
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 320 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 327 B |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 409 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
|
@ -41314,4 +41314,139 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/xkbswitch/main";
|
||||
max: 148 128;
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "flag";
|
||||
type: SWALLOW;
|
||||
mouse_events: 0;
|
||||
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "event";
|
||||
type: RECT;
|
||||
mouse_events: 1;
|
||||
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "label";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
|
||||
rel1
|
||||
{
|
||||
relative: 0.5 0.5;
|
||||
offset: 0 0;
|
||||
}
|
||||
|
||||
rel2
|
||||
{
|
||||
relative: 0.5 0.5;
|
||||
offset: 0 0;
|
||||
}
|
||||
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 128;
|
||||
|
||||
text
|
||||
{
|
||||
text: "";
|
||||
font: "Sans";
|
||||
size: 9;
|
||||
align: 0.5 0.5;
|
||||
min: 1 1;
|
||||
text_class: "module_small";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group
|
||||
{
|
||||
name: "modules/xkbswitch/noflag";
|
||||
max: 148 128;
|
||||
|
||||
parts
|
||||
{
|
||||
part
|
||||
{
|
||||
name: "event";
|
||||
type: RECT;
|
||||
mouse_events: 1;
|
||||
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
}
|
||||
|
||||
part
|
||||
{
|
||||
name: "label";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
|
||||
rel1
|
||||
{
|
||||
relative: 0.5 0.5;
|
||||
offset: 0 0;
|
||||
}
|
||||
|
||||
rel2
|
||||
{
|
||||
relative: 0.5 0.5;
|
||||
offset: 0 0;
|
||||
}
|
||||
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 128;
|
||||
|
||||
text
|
||||
{
|
||||
text: "";
|
||||
font: "Sans";
|
||||
size: 9;
|
||||
align: 0.5 0.5;
|
||||
min: 1 1;
|
||||
text_class: "module_small";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,3 +246,10 @@ src/modules/mixer/conf_module.c
|
|||
src/modules/mixer/e_mod_main.c
|
||||
src/modules/connman/e_mod_main.c
|
||||
src/modules/systray/e_mod_main.c
|
||||
src/modules/shot/e_mod_main.c
|
||||
src/modules/tasks/e_mod_main.c
|
||||
src/modules/tasks/e_mod_config.c
|
||||
src/modules/xkbswitch/e_mod_main.c
|
||||
src/modules/xkbswitch/e_mod_config.c
|
||||
src/modules/xkbswitch/e_mod_keybindings.c
|
||||
src/modules/xkbswitch/e_mod_parse.c
|
||||
|
|
|
@ -191,6 +191,10 @@ if USE_MODULE_TASKS
|
|||
SUBDIRS += tasks
|
||||
endif
|
||||
|
||||
if USE_MODULE_XKBSWITCH
|
||||
SUBDIRS += xkbswitch
|
||||
endif
|
||||
|
||||
#if HAVE_WAYLAND_DRM
|
||||
# SUBDIRS += wl_drm
|
||||
#endif
|
||||
|
|
|
@ -5,14 +5,447 @@
|
|||
* Give list some icons.
|
||||
*/
|
||||
|
||||
#define RANDR_11 ((1 << 16) | 1)
|
||||
|
||||
static void _fill_data (E_Config_Dialog_Data *cfdata);
|
||||
static void *_create_data (E_Config_Dialog *cfd);
|
||||
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_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);
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
Evas_Object *scr_list;
|
||||
Evas_Object *res_list;
|
||||
Evas_Object *policy_list;
|
||||
|
||||
const char *cur_scr;
|
||||
|
||||
int restore;
|
||||
int orientation;
|
||||
int flip_x;
|
||||
int flip_y;
|
||||
};
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_display(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "screen/screen_resolution")) return NULL;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->basic.check_changed = _basic_check_changed;
|
||||
v->override_auto_apply = 1;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Screen Resolution Settings"),
|
||||
"E", "screen/screen_resolution",
|
||||
"preferences-system-screen-resolution", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata);
|
||||
cfdata->cfd = cfd;
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (cfdata->cur_scr) eina_stringshare_del(cfdata->cur_scr);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_res_get(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Randr_Output_Info *oi = NULL;
|
||||
Ecore_X_Randr_Mode_Info *mode;
|
||||
|
||||
e_widget_ilist_clear(cfdata->res_list);
|
||||
if (!cfdata->cur_scr) return;
|
||||
|
||||
if (e_randr_screen_info.rrvd_info.randr_info_12)
|
||||
{
|
||||
EINA_LIST_FOREACH
|
||||
(e_randr_screen_info.rrvd_info.randr_info_12->outputs, l, oi)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
strncpy(buf, oi->name, sizeof(buf) - 1);
|
||||
buf[oi->name_length] = 0;
|
||||
if (!strcmp(buf, cfdata->cur_scr)) break;
|
||||
oi = NULL;
|
||||
}
|
||||
}
|
||||
if (!oi) return;
|
||||
if (!oi->monitor) return;
|
||||
|
||||
switch (oi->policy)
|
||||
{
|
||||
case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE:
|
||||
printf(" policy: ABOVE\n"); break;
|
||||
case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT:
|
||||
printf(" policy: RIGHT\n"); break;
|
||||
case ECORE_X_RANDR_OUTPUT_POLICY_BELOW:
|
||||
printf(" policy: BELOW\n"); break;
|
||||
case ECORE_X_RANDR_OUTPUT_POLICY_LEFT:
|
||||
printf(" policy: LEFT\n"); break;
|
||||
case ECORE_X_RANDR_OUTPUT_POLICY_CLONE:
|
||||
printf(" policy: CLONE\n"); break;
|
||||
case ECORE_X_RANDR_OUTPUT_POLICY_NONE:
|
||||
printf(" policy: NONE\n"); break;
|
||||
default:
|
||||
printf(" policy: unknown\n"); break;
|
||||
break;
|
||||
}
|
||||
if (oi->crtc)
|
||||
{
|
||||
mode = oi->crtc->current_mode;
|
||||
if (mode)
|
||||
{
|
||||
if ((mode->hTotal > 0) && (mode->vTotal > 0) && (mode->dotClock > 0))
|
||||
{
|
||||
double hz = (double)mode->dotClock /
|
||||
(double)(mode->hTotal * mode->vTotal);
|
||||
printf( " %ix%i %1.1fHz\n", mode->width, mode->height, hz);
|
||||
}
|
||||
}
|
||||
printf(" geometry: %i %i %ix%i\n",
|
||||
oi->crtc->geometry.x, oi->crtc->geometry.y,
|
||||
oi->crtc->geometry.w, oi->crtc->geometry.h);
|
||||
if (oi->crtc->current_orientation & ECORE_X_RANDR_ORIENTATION_ROT_0)
|
||||
printf(" orient: 0\n");
|
||||
if (oi->crtc->current_orientation & ECORE_X_RANDR_ORIENTATION_ROT_90)
|
||||
printf(" orient: 90\n");
|
||||
if (oi->crtc->current_orientation & ECORE_X_RANDR_ORIENTATION_ROT_180)
|
||||
printf(" orient: 180\n");
|
||||
if (oi->crtc->current_orientation & ECORE_X_RANDR_ORIENTATION_ROT_270)
|
||||
printf(" orient: 270\n");
|
||||
if (oi->crtc->current_orientation & ECORE_X_RANDR_ORIENTATION_FLIP_X)
|
||||
printf(" orient: flip x\n");
|
||||
if (oi->crtc->current_orientation & ECORE_X_RANDR_ORIENTATION_FLIP_Y)
|
||||
printf(" orient: flip y\n");
|
||||
printf(" can do:\n");
|
||||
if (oi->crtc->orientations & ECORE_X_RANDR_ORIENTATION_ROT_0)
|
||||
printf(" orient: 0\n");
|
||||
if (oi->crtc->orientations & ECORE_X_RANDR_ORIENTATION_ROT_90)
|
||||
printf(" orient: 90\n");
|
||||
if (oi->crtc->orientations & ECORE_X_RANDR_ORIENTATION_ROT_180)
|
||||
printf(" orient: 180\n");
|
||||
if (oi->crtc->orientations & ECORE_X_RANDR_ORIENTATION_ROT_270)
|
||||
printf(" orient: 270\n");
|
||||
if (oi->crtc->orientations & ECORE_X_RANDR_ORIENTATION_FLIP_X)
|
||||
printf(" orient: flip x\n");
|
||||
if (oi->crtc->orientations & ECORE_X_RANDR_ORIENTATION_FLIP_Y)
|
||||
printf(" orient: flip y\n");
|
||||
}
|
||||
|
||||
printf(" monitor is %ix%i mm\n",
|
||||
oi->monitor->size_mm.width, oi->monitor->size_mm.height);
|
||||
|
||||
EINA_LIST_FOREACH(oi->monitor->modes, l, mode)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
if ((mode->hTotal > 0) && (mode->vTotal > 0) && (mode->dotClock > 0))
|
||||
{
|
||||
double hz = (double)mode->dotClock /
|
||||
(double)(mode->hTotal * mode->vTotal);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%ix%i %1.1fHz",
|
||||
mode->width, mode->height, hz);
|
||||
e_widget_ilist_append(cfdata->res_list, NULL, buf, NULL, cfdata, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_screens_select(void *data)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = data;
|
||||
_res_get(cfdata);
|
||||
}
|
||||
|
||||
static void
|
||||
_screens_get(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Randr_Output_Info *oi;
|
||||
|
||||
if (e_randr_screen_info.rrvd_info.randr_info_12)
|
||||
{
|
||||
EINA_LIST_FOREACH
|
||||
(e_randr_screen_info.rrvd_info.randr_info_12->outputs, l, oi)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
strncpy(buf, oi->name, sizeof(buf) - 1);
|
||||
buf[oi->name_length] = 0;
|
||||
printf("%s:\n", buf);
|
||||
switch (oi->connection_status)
|
||||
{
|
||||
case ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED:
|
||||
printf(" connect: connected\n"); break;
|
||||
case ECORE_X_RANDR_CONNECTION_STATUS_DISCONNECTED:
|
||||
printf(" connect: disconnected\n"); break;
|
||||
default:
|
||||
printf(" connect: unknown\n"); break;
|
||||
}
|
||||
switch (oi->connector_type)
|
||||
{
|
||||
case ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DVI:
|
||||
printf(" type DVI\n"); break;
|
||||
case ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_A:
|
||||
printf(" type HDMI_A\n"); break;
|
||||
case ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_B:
|
||||
printf(" type HDMI_B\n"); break;
|
||||
case ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_MDDI:
|
||||
printf(" type MDDI\n"); break;
|
||||
case ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT:
|
||||
printf(" type DISPLAY_PORT\n"); break;
|
||||
default:
|
||||
printf(" type unknown\n"); break;
|
||||
}
|
||||
e_widget_ilist_append(cfdata->scr_list, NULL, buf, _screens_select, cfdata, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob, *ot;
|
||||
E_Radio_Group *rg;
|
||||
|
||||
o = e_widget_table_add(evas, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Outputs"), 0);
|
||||
ob = e_widget_ilist_add(evas, 16, 16, &(cfdata->cur_scr));
|
||||
cfdata->scr_list = ob;
|
||||
e_widget_size_min_set(ob, 128, 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Modes"), 0);
|
||||
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
||||
cfdata->res_list = ob;
|
||||
e_widget_size_min_set(ob, 192, 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_table_object_append(o, of, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Restore on login"), &cfdata->restore);
|
||||
e_widget_table_object_append(o, ob, 1, 1, 2, 1, 1, 1, 0, 0);
|
||||
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
of = e_widget_framelist_add(evas, _("Policy"), 0);
|
||||
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
||||
cfdata->policy_list = ob;
|
||||
e_widget_size_min_set(ob, 100, 80);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Rotation"), 0);
|
||||
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);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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);
|
||||
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);
|
||||
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_table_object_append(ot, of, 0, 1, 1, 1, 1, 0, 1, 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));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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_table_object_append(ot, of, 0, 2, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
e_widget_table_object_append(o, ot, 2, 0, 1, 1, 1, 1, 1, 1);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
|
||||
_screens_get(cfdata);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
/*
|
||||
man = e_manager_current_get();
|
||||
sizes = ecore_x_randr_screen_primary_output_sizes_get(man->root, &s);
|
||||
cfdata->has_rates = EINA_FALSE;
|
||||
|
||||
if ((!sizes) || (s == 0))
|
||||
ecore_timer_add(0.5, _deferred_noxrandr_error, NULL);
|
||||
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);
|
||||
cfdata->orig_rate = ecore_x_randr_screen_primary_output_current_refresh_rate_get(man->root);
|
||||
|
||||
for (i = 0; i < (s - 1); i++)
|
||||
{
|
||||
Resolution * res;
|
||||
Ecore_X_Randr_Refresh_Rate * rates;
|
||||
int r = 0, j;
|
||||
|
||||
res = E_NEW(Resolution, 1);
|
||||
if (!res) continue;
|
||||
|
||||
res->size.width = sizes[i].width;
|
||||
res->size.height = sizes[i].height;
|
||||
res->size_index = i;
|
||||
rates = ecore_x_randr_screen_primary_output_refresh_rates_get(man->root, i, &r);
|
||||
for (j = 0; j < r; j++)
|
||||
{
|
||||
Ecore_X_Randr_Refresh_Rate * rt;
|
||||
|
||||
cfdata->has_rates = EINA_TRUE;
|
||||
rt = E_NEW(Ecore_X_Randr_Refresh_Rate, 1);
|
||||
if (!rt) continue;
|
||||
*rt = rates[j];
|
||||
res->rates = eina_list_append(res->rates, rt);
|
||||
}
|
||||
if (rates) E_FREE(rates);
|
||||
cfdata->resolutions = eina_list_append(cfdata->resolutions, res);
|
||||
}
|
||||
|
||||
cfdata->resolutions = eina_list_sort(cfdata->resolutions,
|
||||
eina_list_count(cfdata->resolutions), _sort_resolutions);
|
||||
cfdata->resolutions = eina_list_reverse(cfdata->resolutions);
|
||||
|
||||
_load_resolutions(cfdata);
|
||||
if (!cfdata->has_rates)
|
||||
ecore_timer_add(0.5, _deferred_norates_error, NULL);
|
||||
}
|
||||
|
||||
E_FREE(sizes);
|
||||
|
||||
_load_rates(cfdata);
|
||||
*/
|
||||
|
||||
# define RANDR_11 ((1 << 16) | 1)
|
||||
|
||||
static void _load_resolutions (E_Config_Dialog_Data *cfdata);
|
||||
static void _load_rates (E_Config_Dialog_Data *cfdata);
|
||||
static void _ilist_item_change (void *data);
|
||||
|
@ -40,192 +473,6 @@ struct _SureBox
|
|||
E_Config_Dialog_Data *cfdata;
|
||||
};
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
Eina_List *resolutions;
|
||||
Ecore_X_Randr_Screen_Size orig_size;
|
||||
int orig_size_index;
|
||||
Ecore_X_Randr_Refresh_Rate orig_rate;
|
||||
int orig_orientation;
|
||||
int orig_flip;
|
||||
int restore;
|
||||
int can_rotate;
|
||||
int can_flip;
|
||||
int orientation;
|
||||
int flip;
|
||||
int flip_x;
|
||||
int flip_y;
|
||||
Eina_Bool has_rates;
|
||||
|
||||
Evas_Object *rate_list;
|
||||
Evas_Object *res_list;
|
||||
SureBox *surebox;
|
||||
};
|
||||
|
||||
static void
|
||||
_surebox_dialog_cb_delete(E_Win *win)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
SureBox *sb;
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
dia = win->data;
|
||||
sb = dia->data;
|
||||
sb->cfdata->surebox = NULL;
|
||||
cfd = sb->cfdata->cfd;
|
||||
if (sb->timer) ecore_timer_del(sb->timer);
|
||||
sb->timer = NULL;
|
||||
free(sb);
|
||||
e_object_del(E_OBJECT(dia));
|
||||
e_object_unref(E_OBJECT(cfd));
|
||||
}
|
||||
|
||||
static void
|
||||
_surebox_dialog_cb_yes(void *data, E_Dialog *dia)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = data;
|
||||
|
||||
if (sb->cfdata->restore)
|
||||
e_randr_11_store_configuration(E_RANDR_CONFIGURATION_STORE_ALL);
|
||||
|
||||
_fill_data(sb->cfdata);
|
||||
_load_resolutions(sb->cfdata);
|
||||
/* No need to load rates as the currently selected resolution has not been
|
||||
* changed since last selection. */
|
||||
if (dia) _surebox_dialog_cb_delete(dia->win);
|
||||
}
|
||||
|
||||
static void
|
||||
_surebox_dialog_cb_no(void *data, E_Dialog *dia)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = data;
|
||||
ecore_x_randr_screen_primary_output_refresh_rate_set(sb->dia->win->container->manager->root,
|
||||
sb->cfdata->orig_size_index, sb->cfdata->orig_rate);
|
||||
_load_resolutions(sb->cfdata);
|
||||
_load_rates(sb->cfdata);
|
||||
_surebox_dialog_cb_delete(dia->win);
|
||||
}
|
||||
|
||||
static void
|
||||
_surebox_text_fill(SureBox *sb)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
if (!sb->dia) return;
|
||||
if (sb->iterations > 1)
|
||||
{
|
||||
if (sb->cfdata->has_rates)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d at %d Hz will be restored in %d seconds."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
|
||||
sb->cfdata->orig_rate, sb->iterations);
|
||||
else
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d will be restored in %d seconds."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
|
||||
sb->iterations);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sb->cfdata->has_rates)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d at %d Hz will be restored <hilight>IMMEDIATELY</hilight>."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
|
||||
sb->cfdata->orig_rate);
|
||||
else
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d will be restored <hilight>IMMEDIATELY</hilight>."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height);
|
||||
}
|
||||
e_dialog_text_set(sb->dia, buf);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_surebox_timer_cb(void *data)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = data;
|
||||
sb->iterations--;
|
||||
_surebox_text_fill(sb);
|
||||
if (sb->iterations == 0)
|
||||
{
|
||||
_surebox_dialog_cb_no(sb, sb->dia);
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static SureBox *
|
||||
_surebox_new(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = E_NEW(SureBox, 1);
|
||||
sb->dia = e_dialog_new(cfd->con, "E", "_display_res_sure_dialog");
|
||||
sb->timer = ecore_timer_add(1.0, _surebox_timer_cb, sb);
|
||||
sb->iterations = 15;
|
||||
sb->cfd = cfd;
|
||||
sb->cfdata = cfdata;
|
||||
cfdata->surebox = sb;
|
||||
sb->dia->data = sb;
|
||||
e_dialog_title_set(sb->dia, _("Resolution change"));
|
||||
e_dialog_icon_set(sb->dia, "preferences-system-screen-resolution", 48);
|
||||
_surebox_text_fill(sb);
|
||||
e_win_delete_callback_set(sb->dia->win, _surebox_dialog_cb_delete);
|
||||
e_dialog_button_add(sb->dia, _("Save"), NULL, _surebox_dialog_cb_yes, sb);
|
||||
e_dialog_button_add(sb->dia, _("Restore"), NULL, _surebox_dialog_cb_no, sb);
|
||||
e_dialog_button_focus_num(sb->dia, 1);
|
||||
e_win_centered_set(sb->dia->win, 1);
|
||||
e_win_borderless_set(sb->dia->win, 1);
|
||||
e_win_layer_set(sb->dia->win, 6);
|
||||
e_win_sticky_set(sb->dia->win, 1);
|
||||
e_dialog_show(sb->dia);
|
||||
e_object_ref(E_OBJECT(cfd));
|
||||
return sb;
|
||||
}
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_display(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (!ecore_x_randr_query())
|
||||
{
|
||||
ecore_timer_add(0.5, _deferred_noxrandr_error, NULL);
|
||||
fprintf(stderr, "XRandR not present on this display.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (e_config_dialog_find("E", "screen/screen_resolution")) return NULL;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->basic.check_changed = _basic_check_changed;
|
||||
v->override_auto_apply = 1;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Screen Resolution Settings"),
|
||||
"E", "screen/screen_resolution",
|
||||
"preferences-system-screen-resolution", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
|
@ -261,17 +508,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_fill_data(cfdata);
|
||||
cfdata->cfd = cfd;
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
|
@ -370,127 +606,9 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
cfdata->orig_orientation = cfdata->orientation;
|
||||
cfdata->orig_flip = cfdata->flip;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob, *ot;
|
||||
E_Radio_Group *rg;
|
||||
E_Manager *man;
|
||||
Ecore_X_Randr_Screen_Size_MM *sizes;
|
||||
int i, s;
|
||||
|
||||
o = e_widget_table_add(evas, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Resolution"), 0);
|
||||
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
||||
cfdata->res_list = ob;
|
||||
e_widget_size_min_set(ob, 170, 215);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Restore on login"), &cfdata->restore);
|
||||
e_widget_table_object_append(o, ob, 0, 1, 2, 1, 1, 1, 0, 0);
|
||||
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
of = e_widget_framelist_add(evas, _("Refresh"), 0);
|
||||
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
||||
cfdata->rate_list = ob;
|
||||
e_widget_size_min_set(ob, 100, 80);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
man = e_manager_current_get();
|
||||
sizes = ecore_x_randr_screen_primary_output_sizes_get(man->root, &s);
|
||||
cfdata->has_rates = EINA_FALSE;
|
||||
|
||||
if ((!sizes) || (s == 0))
|
||||
ecore_timer_add(0.5, _deferred_noxrandr_error, NULL);
|
||||
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);
|
||||
cfdata->orig_rate = ecore_x_randr_screen_primary_output_current_refresh_rate_get(man->root);
|
||||
|
||||
for (i = 0; i < (s - 1); i++)
|
||||
{
|
||||
Resolution * res;
|
||||
Ecore_X_Randr_Refresh_Rate * rates;
|
||||
int r = 0, j;
|
||||
|
||||
res = E_NEW(Resolution, 1);
|
||||
if (!res) continue;
|
||||
|
||||
res->size.width = sizes[i].width;
|
||||
res->size.height = sizes[i].height;
|
||||
res->size_index = i;
|
||||
rates = ecore_x_randr_screen_primary_output_refresh_rates_get(man->root, i, &r);
|
||||
for (j = 0; j < r; j++)
|
||||
{
|
||||
Ecore_X_Randr_Refresh_Rate * rt;
|
||||
|
||||
cfdata->has_rates = EINA_TRUE;
|
||||
rt = E_NEW(Ecore_X_Randr_Refresh_Rate, 1);
|
||||
if (!rt) continue;
|
||||
*rt = rates[j];
|
||||
res->rates = eina_list_append(res->rates, rt);
|
||||
}
|
||||
if (rates) E_FREE(rates);
|
||||
cfdata->resolutions = eina_list_append(cfdata->resolutions, res);
|
||||
}
|
||||
|
||||
cfdata->resolutions = eina_list_sort(cfdata->resolutions,
|
||||
eina_list_count(cfdata->resolutions), _sort_resolutions);
|
||||
cfdata->resolutions = eina_list_reverse(cfdata->resolutions);
|
||||
|
||||
_load_resolutions(cfdata);
|
||||
if (!cfdata->has_rates)
|
||||
ecore_timer_add(0.5, _deferred_norates_error, NULL);
|
||||
}
|
||||
|
||||
E_FREE(sizes);
|
||||
|
||||
_load_rates(cfdata);
|
||||
|
||||
if (cfdata->can_rotate)
|
||||
{
|
||||
of = e_widget_framelist_add(evas, _("Rotation"), 0);
|
||||
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);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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);
|
||||
}
|
||||
|
||||
if (cfdata->can_flip)
|
||||
{
|
||||
of = e_widget_framelist_add(evas, _("Mirroring"), 0);
|
||||
ob = e_widget_check_icon_add(evas, NULL, "preferences-screen-hflip", 24, 24, &(cfdata->flip_x));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
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));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
if (!(cfdata->can_flip & ECORE_X_RANDR_ORIENTATION_FLIP_Y))
|
||||
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(o, ot, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
return o;
|
||||
}
|
||||
|
||||
static int
|
||||
_sort_resolutions(const void *d1, const void *d2)
|
||||
{
|
||||
|
@ -642,3 +760,140 @@ _deferred_norates_error(void *data __UNUSED__)
|
|||
"the resolution, which may cause <hilight>damage</hilight> to your screen."));
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_surebox_dialog_cb_delete(E_Win *win)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
SureBox *sb;
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
dia = win->data;
|
||||
sb = dia->data;
|
||||
sb->cfdata->surebox = NULL;
|
||||
cfd = sb->cfdata->cfd;
|
||||
if (sb->timer) ecore_timer_del(sb->timer);
|
||||
sb->timer = NULL;
|
||||
free(sb);
|
||||
e_object_del(E_OBJECT(dia));
|
||||
e_object_unref(E_OBJECT(cfd));
|
||||
}
|
||||
|
||||
static void
|
||||
_surebox_dialog_cb_yes(void *data, E_Dialog *dia)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = data;
|
||||
|
||||
if (sb->cfdata->restore)
|
||||
e_randr_11_store_configuration(E_RANDR_CONFIGURATION_STORE_ALL);
|
||||
|
||||
_fill_data(sb->cfdata);
|
||||
_load_resolutions(sb->cfdata);
|
||||
/* No need to load rates as the currently selected resolution has not been
|
||||
* changed since last selection. */
|
||||
if (dia) _surebox_dialog_cb_delete(dia->win);
|
||||
}
|
||||
|
||||
static void
|
||||
_surebox_dialog_cb_no(void *data, E_Dialog *dia)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = data;
|
||||
ecore_x_randr_screen_primary_output_refresh_rate_set(sb->dia->win->container->manager->root,
|
||||
sb->cfdata->orig_size_index, sb->cfdata->orig_rate);
|
||||
_load_resolutions(sb->cfdata);
|
||||
_load_rates(sb->cfdata);
|
||||
_surebox_dialog_cb_delete(dia->win);
|
||||
}
|
||||
|
||||
static void
|
||||
_surebox_text_fill(SureBox *sb)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
if (!sb->dia) return;
|
||||
if (sb->iterations > 1)
|
||||
{
|
||||
if (sb->cfdata->has_rates)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d at %d Hz will be restored in %d seconds."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
|
||||
sb->cfdata->orig_rate, sb->iterations);
|
||||
else
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d will be restored in %d seconds."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
|
||||
sb->iterations);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sb->cfdata->has_rates)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d at %d Hz will be restored <hilight>IMMEDIATELY</hilight>."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height,
|
||||
sb->cfdata->orig_rate);
|
||||
else
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("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>"
|
||||
"%dx%d will be restored <hilight>IMMEDIATELY</hilight>."),
|
||||
sb->cfdata->orig_size.width, sb->cfdata->orig_size.height);
|
||||
}
|
||||
e_dialog_text_set(sb->dia, buf);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_surebox_timer_cb(void *data)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = data;
|
||||
sb->iterations--;
|
||||
_surebox_text_fill(sb);
|
||||
if (sb->iterations == 0)
|
||||
{
|
||||
_surebox_dialog_cb_no(sb, sb->dia);
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static SureBox *
|
||||
_surebox_new(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
SureBox *sb;
|
||||
|
||||
sb = E_NEW(SureBox, 1);
|
||||
sb->dia = e_dialog_new(cfd->con, "E", "_display_res_sure_dialog");
|
||||
sb->timer = ecore_timer_add(1.0, _surebox_timer_cb, sb);
|
||||
sb->iterations = 15;
|
||||
sb->cfd = cfd;
|
||||
sb->cfdata = cfdata;
|
||||
cfdata->surebox = sb;
|
||||
sb->dia->data = sb;
|
||||
e_dialog_title_set(sb->dia, _("Resolution change"));
|
||||
e_dialog_icon_set(sb->dia, "preferences-system-screen-resolution", 48);
|
||||
_surebox_text_fill(sb);
|
||||
e_win_delete_callback_set(sb->dia->win, _surebox_dialog_cb_delete);
|
||||
e_dialog_button_add(sb->dia, _("Save"), NULL, _surebox_dialog_cb_yes, sb);
|
||||
e_dialog_button_add(sb->dia, _("Restore"), NULL, _surebox_dialog_cb_no, sb);
|
||||
e_dialog_button_focus_num(sb->dia, 1);
|
||||
e_win_centered_set(sb->dia->win, 1);
|
||||
e_win_borderless_set(sb->dia->win, 1);
|
||||
e_win_layer_set(sb->dia->win, 6);
|
||||
e_win_sticky_set(sb->dia->win, 1);
|
||||
e_dialog_show(sb->dia);
|
||||
e_object_ref(E_OBJECT(cfd));
|
||||
return sb;
|
||||
}
|
||||
#endif
|
||||
|
|