per-desk profiles - move to per screen and use elm derived profiles

this removes the per desktop profile config and replaces it with a
per-screen one that is tied to a specific display so it is far more
logical than per desktop. this allows e to set up different scaling
per screen for apps that use elementary for example via this derived
profile.

this of course is slightly problematic for e itself since it now uses
elm - as this will cause e to go kind-of-crazy with differing profiles
as it fights with itself and elm if 2 screens have different profiles.
this requires elm to be fixed to allow custom profiles per window.

this also currently won't switch profile of a window when you
reconfigure screens.

@feature

xx
This commit is contained in:
Carsten Haitzler 2016-01-04 18:03:36 +09:00
parent 8215777848
commit e1369a24bd
16 changed files with 471 additions and 199 deletions

1
src/bin/.gitignore vendored
View File

@ -13,5 +13,6 @@
/enlightenment_sys
/enlightenment_thumb
/enlightenment_open
/enlightenment_elm_cfgtool
/e_fm/enlightenment_fm

View File

@ -31,6 +31,7 @@ src/bin/enlightenment_backlight \
src/bin/enlightenment_fm_op \
src/bin/enlightenment_sys \
src/bin/enlightenment_thumb \
src/bin/enlightenment_elm_cfgtool \
src/bin/enlightenment_static_grabber
if ! HAVE_WAYLAND_ONLY
@ -407,6 +408,12 @@ src/bin/e_user.c
src_bin_enlightenment_thumb_LDADD = @E_THUMB_LIBS@
src_bin_enlightenment_thumb_CPPFLAGS = $(E_CPPFLAGS)
src_bin_enlightenment_elm_cfgtool_SOURCES = \
src/bin/e_elm_cfgtool_main.c
src_bin_enlightenment_elm_cfgtool_LDADD = @e_libs@ -lm
src_bin_enlightenment_elm_cfgtool_CPPFLAGS = $(E_CPPFLAGS)
src_bin_enlightenment_fm_op_SOURCES = \
src/bin/e_fm_op.c

View File

@ -2673,14 +2673,17 @@ e_client_desk_set(E_Client *ec, E_Desk *desk)
E_OBJECT_CHECK(desk);
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
if (ec->desk == desk) return;
if ((e_config->use_desktop_window_profile) &&
(ec->e.state.profile.use))
if (ec->e.state.profile.use)
{
if (e_util_strcmp(ec->e.state.profile.name, desk->window_profile))
const char *profile = desk->window_profile;
// XXX: have default profile config
if (!profile) profile = "standard";
if (e_util_strcmp(ec->e.state.profile.name, profile))
{
if (e_client_desk_window_profile_available_check(ec, desk->window_profile))
if (e_client_desk_window_profile_available_check(ec, profile))
{
eina_stringshare_replace(&ec->e.state.profile.set, desk->window_profile);
eina_stringshare_replace(&ec->e.state.profile.set, profile);
eina_stringshare_replace(&ec->e.state.profile.wait, NULL);
ec->e.state.profile.wait_for_done = 0;
e_client_desk_window_profile_wait_desk_set(ec, desk);

View File

@ -272,6 +272,7 @@ e_comp_canvas_init(int w, int h)
E_Zone *zone = e_zone_new(scr->screen, scr->escreen,
scr->x, scr->y, scr->w, scr->h);
if (scr->id) zone->randr2_id = strdup(scr->id);
e_desk_window_profile_update(zone);
}
}
else
@ -484,12 +485,14 @@ e_comp_canvas_update(void)
free(zone->randr2_id);
zone->randr2_id = NULL;
if (scr->id) zone->randr2_id = strdup(scr->id);
e_desk_window_profile_update(zone);
}
else
{
zone = e_zone_new(scr->screen, scr->escreen,
scr->x, scr->y, scr->w, scr->h);
if (scr->id) zone->randr2_id = strdup(scr->id);
e_desk_window_profile_update(zone);
printf("@@@ NEW ZONE = %p\n", zone);
changed = EINA_TRUE;
}

View File

@ -4304,7 +4304,7 @@ _e_comp_x_hook_client_fetch(void *d EINA_UNUSED, E_Client *ec)
cd->fetch_exe = 0;
}
if ((e_config->use_desktop_window_profile) && (need_desk_set))
if (need_desk_set)
{
E_Desk *desk = NULL;
const char *p, *p2;
@ -5199,7 +5199,7 @@ _e_comp_x_setup(Ecore_X_Window root, int w, int h)
E_OBJECT_DEL_SET(e_comp, _e_comp_x_del);
e_comp_x = e_comp->x_comp_data = E_NEW(E_Comp_X_Data, 1);
ecore_x_e_window_profile_supported_set(root, e_config->use_desktop_window_profile);
ecore_x_e_window_profile_supported_set(root, EINA_TRUE);
e_comp->cm_selection = ecore_x_window_input_new(root, 0, 0, 1, 1);
if (!e_comp->cm_selection) return EINA_FALSE;
ecore_x_icccm_name_class_set(e_comp->cm_selection, "comp", "cm_selection");

View File

@ -824,6 +824,14 @@ e_comp_x_randr_create(void)
s->info.can_rot_180 = EINA_TRUE;
if (info->rotations & ECORE_X_RANDR_ORIENTATION_ROT_270)
s->info.can_rot_270 = EINA_TRUE;
if (cs)
{
if (cs->profile)
s->config.profile = strdup(cs->profile);
else
s->config.profile = NULL;
s->config.scale_multiplier = cs->scale_multiplier;
}
}
ecore_x_randr_crtc_info_free(info);
}

View File

@ -38,7 +38,6 @@ static E_Config_DD *_e_config_path_append_edd = NULL;
static E_Config_DD *_e_config_desktop_bg_edd = NULL;
static E_Config_DD *_e_config_desklock_bg_edd = NULL;
static E_Config_DD *_e_config_desktop_name_edd = NULL;
static E_Config_DD *_e_config_desktop_window_profile_edd = NULL;
static E_Config_DD *_e_config_menu_applications_edd = NULL;
static E_Config_DD *_e_config_color_class_edd = NULL;
static E_Config_DD *_e_config_gadcon_edd = NULL;
@ -135,7 +134,6 @@ _e_config_edd_shutdown(void)
E_CONFIG_DD_FREE(_e_config_desktop_bg_edd);
E_CONFIG_DD_FREE(_e_config_desklock_bg_edd);
E_CONFIG_DD_FREE(_e_config_desktop_name_edd);
E_CONFIG_DD_FREE(_e_config_desktop_window_profile_edd);
E_CONFIG_DD_FREE(e_remember_edd);
E_CONFIG_DD_FREE(_e_config_menu_applications_edd);
E_CONFIG_DD_FREE(_e_config_gadcon_edd);
@ -147,6 +145,7 @@ _e_config_edd_shutdown(void)
E_CONFIG_DD_FREE(_e_config_env_var_edd);
E_CONFIG_DD_FREE(_e_config_xkb_layout_edd);
E_CONFIG_DD_FREE(_e_config_xkb_option_edd);
E_CONFIG_DD_FREE(_e_config_xkb_option_edd);
}
static void
@ -243,16 +242,6 @@ _e_config_edd_init(Eina_Bool old)
E_CONFIG_VAL(D, T, desk_y, INT);
E_CONFIG_VAL(D, T, name, STR);
_e_config_desktop_window_profile_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Window_Profile", E_Config_Desktop_Window_Profile);
#undef T
#undef D
#define T E_Config_Desktop_Window_Profile
#define D _e_config_desktop_window_profile_edd
E_CONFIG_VAL(D, T, zone, INT);
E_CONFIG_VAL(D, T, desk_x, INT);
E_CONFIG_VAL(D, T, desk_y, INT);
E_CONFIG_VAL(D, T, profile, STR);
_e_config_path_append_edd = E_CONFIG_DD_NEW("E_Path_Dir", E_Path_Dir);
#undef T
#undef D
@ -434,6 +423,14 @@ _e_config_edd_init(Eina_Bool old)
#define D _e_config_xkb_option_edd
E_CONFIG_VAL(D, T, name, STR);
_e_config_xkb_option_edd = E_CONFIG_DD_NEW("E_Config_XKB_Option",
E_Config_XKB_Option);
#undef T
#undef D
#define T E_Config_XKB_Option
#define D _e_config_xkb_option_edd
E_CONFIG_VAL(D, T, name, STR);
_e_config_edd = E_CONFIG_DD_NEW("E_Config", E_Config);
#undef T
#undef D
@ -445,10 +442,8 @@ _e_config_edd_init(Eina_Bool old)
E_CONFIG_VAL(D, T, show_splash, INT); /**/
E_CONFIG_VAL(D, T, desktop_default_background, STR); /**/
E_CONFIG_VAL(D, T, desktop_default_name, STR); /**/
E_CONFIG_VAL(D, T, desktop_default_window_profile, STR); /**/
E_CONFIG_LIST(D, T, desktop_backgrounds, _e_config_desktop_bg_edd); /**/
E_CONFIG_LIST(D, T, desktop_names, _e_config_desktop_name_edd); /**/
E_CONFIG_LIST(D, T, desktop_window_profiles, _e_config_desktop_window_profile_edd);
E_CONFIG_VAL(D, T, menus_scroll_speed, DOUBLE); /**/
E_CONFIG_VAL(D, T, menus_fast_mouse_move_threshhold, DOUBLE); /**/
E_CONFIG_VAL(D, T, menus_click_drag_timeout, DOUBLE); /**/
@ -775,8 +770,6 @@ _e_config_edd_init(Eina_Bool old)
//E_CONFIG_VAL(D, T, xkb.cur_group, INT);
E_CONFIG_VAL(D, T, exe_always_single_instance, UCHAR);
E_CONFIG_VAL(D, T, use_desktop_window_profile, INT);
}
/* externally accessible functions */
@ -2182,17 +2175,10 @@ _e_config_free(E_Config *ecf)
E_Remember *rem;
E_Config_Env_Var *evr;
E_Config_XKB_Option *op;
E_Config_Desktop_Window_Profile *wp;
E_Int_Menu_Applications *ema;
if (!ecf) return;
EINA_LIST_FREE(ecf->desktop_window_profiles, wp)
{
eina_stringshare_del(wp->profile);
E_FREE(wp);
}
eina_stringshare_del(ecf->xkb.default_model);
E_FREE_LIST(ecf->xkb.used_layouts, e_config_xkb_layout_free);
@ -2282,7 +2268,6 @@ _e_config_free(E_Config *ecf)
}
if (ecf->desktop_default_background) eina_stringshare_del(ecf->desktop_default_background);
if (ecf->desktop_default_name) eina_stringshare_del(ecf->desktop_default_name);
if (ecf->desktop_default_window_profile) eina_stringshare_del(ecf->desktop_default_window_profile);
if (ecf->language) eina_stringshare_del(ecf->language);
eina_stringshare_del(ecf->desklock_language);
eina_stringshare_del(ecf->xkb.selected_layout);

View File

@ -13,7 +13,6 @@ typedef struct _E_Config_Binding_Acpi E_Config_Binding_Acpi;
typedef struct _E_Config_Desktop_Background E_Config_Desktop_Background;
typedef struct _E_Config_Desklock_Background E_Config_Desklock_Background;
typedef struct _E_Config_Desktop_Name E_Config_Desktop_Name;
typedef struct _E_Config_Desktop_Window_Profile E_Config_Desktop_Window_Profile;
typedef struct _E_Config_Gadcon E_Config_Gadcon;
typedef struct _E_Config_Gadcon_Client E_Config_Gadcon_Client;
typedef struct _E_Config_Shelf E_Config_Shelf;
@ -60,9 +59,7 @@ struct _E_Config
const char *desktop_default_background; // GUI
Eina_List *desktop_backgrounds; // GUI
const char *desktop_default_name;
const char *desktop_default_window_profile;
Eina_List *desktop_names; // GUI
Eina_List *desktop_window_profiles; // GUI
double menus_scroll_speed; // GUI
double menus_fast_mouse_move_threshhold; // GUI
double menus_click_drag_timeout; // GUI
@ -439,7 +436,7 @@ struct _E_Config
Eina_List *menu_applications;
unsigned char exe_always_single_instance; // GUI
int use_desktop_window_profile; // GUI
Eina_List *screen_profiles;
};
struct E_Config_Bindings
@ -559,14 +556,6 @@ struct _E_Config_Desktop_Name
const char *name;
};
struct _E_Config_Desktop_Window_Profile
{
int zone;
int desk_x;
int desk_y;
const char *profile;
};
struct _E_Config_Gadcon
{
const char *name;

View File

@ -44,13 +44,52 @@ e_desk_shutdown(void)
return 1;
}
static void
_do_profile(E_Desk *desk, E_Randr2_Screen *sc)
{
int scale = 100;
char buf[PATH_MAX], buf2[PATH_MAX];
eina_stringshare_del(desk->window_profile);
desk->window_profile = NULL;
if (sc->config.scale_multiplier > 0.0)
{
scale = (int)(sc->config.scale_multiplier * 100.0);
}
else if (e_config->scale.use_dpi)
{
double dpi = e_randr2_screen_dpi_get(sc);
if ((dpi > 0.0) && (e_config->scale.base_dpi > 0))
scale = (int)((100.0 * dpi) / (double)e_config->scale.base_dpi);
}
if (scale == 100)
snprintf(buf, sizeof(buf), "%s", sc->config.profile);
else
{
snprintf(buf, sizeof(buf), ".scale-%04i-%s",
scale, sc->config.profile);
if (!elm_config_profile_exists(buf))
{
snprintf(buf2, sizeof(buf2),
"%s/enlightenment/utils/enlightenment_elm_cfgtool "
"set %s %s 'scale-mul %i'",
e_prefix_lib_get(), sc->config.profile, buf, scale);
system(buf2);
}
}
desk->window_profile = eina_stringshare_add(buf);
}
E_API E_Desk *
e_desk_new(E_Zone *zone, int x, int y)
{
E_Desk *desk;
Eina_List *l;
E_Config_Desktop_Name *cfname;
E_Config_Desktop_Window_Profile *cfprof;
char name[40];
int ok = 0;
@ -60,6 +99,8 @@ e_desk_new(E_Zone *zone, int x, int y)
desk = E_OBJECT_ALLOC(E_Desk, E_DESK_TYPE, _e_desk_free);
if (!desk) return NULL;
_e_desk_window_profile_change_protocol_set();
desk->zone = zone;
desk->x = x;
desk->y = y;
@ -81,21 +122,15 @@ e_desk_new(E_Zone *zone, int x, int y)
snprintf(name, sizeof(name), _(e_config->desktop_default_name), x, y);
desk->name = eina_stringshare_add(name);
}
/* Get window profile name for current desktop */
ok = 0;
EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
if (zone->randr2_id)
{
if ((cfprof->zone >= 0) &&
((int)zone->num != cfprof->zone)) continue;
if ((cfprof->desk_x != desk->x) || (cfprof->desk_y != desk->y))
continue;
desk->window_profile = eina_stringshare_ref(cfprof->profile);
ok = 1;
break;
E_Randr2_Screen *sc = e_randr2_screen_id_find(zone->randr2_id);
if ((sc) && (sc->config.profile)) _do_profile(desk, sc);
}
if (!ok)
desk->window_profile = eina_stringshare_ref(e_config->desktop_default_window_profile);
return desk;
}
@ -550,85 +585,20 @@ e_desk_window_profile_set(E_Desk *desk,
}
E_API void
e_desk_window_profile_add(int zone,
int desk_x,
int desk_y,
const char *profile)
e_desk_window_profile_update(E_Zone *zone)
{
E_Config_Desktop_Window_Profile *cfprof;
e_desk_window_profile_del(zone, desk_x, desk_y);
cfprof = E_NEW(E_Config_Desktop_Window_Profile, 1);
cfprof->zone = zone;
cfprof->desk_x = desk_x;
cfprof->desk_y = desk_y;
cfprof->profile = eina_stringshare_add(profile);
e_config->desktop_window_profiles = eina_list_append(e_config->desktop_window_profiles, cfprof);
}
E_API void
e_desk_window_profile_del(int zone,
int desk_x,
int desk_y)
{
Eina_List *l = NULL;
E_Config_Desktop_Window_Profile *cfprof = NULL;
EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
if (zone->randr2_id)
{
if (!((cfprof->zone == zone) &&
(cfprof->desk_x == desk_x) &&
(cfprof->desk_y == desk_y)))
continue;
E_Randr2_Screen *sc = e_randr2_screen_id_find(zone->randr2_id);
e_config->desktop_window_profiles =
eina_list_remove_list(e_config->desktop_window_profiles, l);
eina_stringshare_del(cfprof->profile);
free(cfprof);
break;
}
}
E_API void
e_desk_window_profile_update(void)
{
const Eina_List *z, *l;
E_Zone *zone;
E_Desk *desk;
E_Config_Desktop_Window_Profile *cfprof;
int d_x, d_y, ok;
_e_desk_window_profile_change_protocol_set();
if (!(e_config->use_desktop_window_profile))
return;
EINA_LIST_FOREACH(e_comp->zones, z, zone)
{
for (d_x = 0; d_x < zone->desk_x_count; d_x++)
if ((sc) && (sc->config.profile))
{
for (d_y = 0; d_y < zone->desk_y_count; d_y++)
int x, y;
for (y = 0; y < zone->desk_y_count; y++)
{
desk = zone->desks[d_x + zone->desk_x_count * d_y];
ok = 0;
EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof)
{
if ((cfprof->zone >= 0) &&
((int)zone->num != cfprof->zone)) continue;
if ((cfprof->desk_x != d_x) ||
(cfprof->desk_y != d_y)) continue;
e_desk_window_profile_set(desk, cfprof->profile);
ok = 1;
break;
}
if (!ok)
{
e_desk_window_profile_set
(desk, e_config->desktop_default_window_profile);
}
for (x = 0; x < zone->desk_x_count; x++)
_do_profile(zone->desks[x + (y * zone->desk_x_count)], sc);
}
}
}
@ -890,6 +860,15 @@ static void
_e_desk_window_profile_change_protocol_set(void)
{
#ifndef HAVE_WAYLAND_ONLY
ecore_x_e_window_profile_supported_set(e_comp->root, e_config->use_desktop_window_profile);
static Eina_Bool is_set = EINA_FALSE;
if (!is_set)
{
if (e_comp->root)
{
is_set = EINA_TRUE;
ecore_x_e_window_profile_supported_set(e_comp->root, EINA_TRUE);
}
}
#endif
}

View File

@ -86,9 +86,7 @@ E_API void e_desk_row_remove(E_Zone *zone);
E_API void e_desk_col_add(E_Zone *zone);
E_API void e_desk_col_remove(E_Zone *zone);
E_API void e_desk_window_profile_set(E_Desk *desk, const char *profile);
E_API void e_desk_window_profile_add(int zone, int desk_x, int desk_y, const char *profile);
E_API void e_desk_window_profile_del(int zone, int desk_x, int desk_y);
E_API void e_desk_window_profile_update(void);
E_API void e_desk_window_profile_update(E_Zone *zone);
E_API void e_desk_flip_cb_set(E_Desk_Flip_Cb cb, const void *data);
E_API void e_desk_flip_end(E_Desk *desk);

View File

@ -0,0 +1,44 @@
#include "config.h"
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
const char *src_profile;
const char *derive_profile;
const char *derive_options;
if (argc < 4)
{
printf("This is an internal tool for enlightenment\n"
" enlightenment_elm_cfgtool set SRCPROFILE DERIVEDPROFILE DERIVEOPTIONS\n"
" enlightenment_elm_cfgtool del SRCPROFILE DERIVEDPROFILE\n"
"\n"
"e.g.\n"
" enlightenment_elm_cfgtool set standard .scale-0150-standard 'scale-mul 150'\n"
"\n");
return 0;
}
if (!strcmp(argv[1], "set"))
{
src_profile = argv[2];
derive_profile = argv[3];
derive_options = argv[4];
elm_config_profile_set(src_profile);
elm_config_profile_derived_del(derive_profile);
elm_config_profile_derived_add(derive_profile, derive_options);
}
else if (!strcmp(argv[1], "del"))
{
src_profile = argv[2];
derive_profile = argv[3];
elm_config_profile_set(src_profile);
elm_config_profile_derived_del(derive_profile);
}
else
{
printf("Unknown command '%s'\n", argv[1]);
}
return 0;
}
ELM_MAIN()

View File

@ -63,6 +63,8 @@ e_randr2_init(void)
E_CONFIG_VAL(D, T, priority, INT);
E_CONFIG_VAL(D, T, rel_mode, UCHAR);
E_CONFIG_VAL(D, T, enabled, UCHAR);
E_CONFIG_VAL(D, T, profile, STR);
E_CONFIG_VAL(D, T, scale_multiplier, DOUBLE);
_e_randr2_cfg_edd = E_CONFIG_DD_NEW("E_Config_Randr2", E_Config_Randr2);
#undef T
@ -306,6 +308,7 @@ _info_free(E_Randr2 *r)
free(s->info.edid);
EINA_LIST_FREE(s->info.modes, m) free(m);
free(s->config.relative.to);
free(s->config.profile);
free(s);
}
free(r);
@ -350,7 +353,13 @@ _config_free(E_Config_Randr2 *cfg)
if (!cfg) return;
// free config data
EINA_LIST_FREE(cfg->screens, cs) free(cs);
EINA_LIST_FREE(cfg->screens, cs)
{
eina_stringshare_del(cs->id);
eina_stringshare_del(cs->rel_to);
eina_stringshare_del(cs->profile);
free(cs);
}
free(cfg);
}
@ -387,7 +396,7 @@ _config_update(E_Randr2 *r, E_Config_Randr2 *cfg)
if (cs)
{
if (s->config.relative.to)
cs->rel_to = strdup(s->config.relative.to);
cs->rel_to = eina_stringshare_add(s->config.relative.to);
cs->rel_align = s->config.relative.align;
cs->mode_refresh = s->config.mode.refresh;
cs->mode_w = s->config.mode.w;
@ -396,6 +405,19 @@ _config_update(E_Randr2 *r, E_Config_Randr2 *cfg)
cs->priority = s->config.priority;
cs->rel_mode = s->config.relative.mode;
cs->enabled = s->config.enabled;
if (cs->profile)
{
printf("RRR: store config profile '%s'\n", cs->profile);
free(s->config.profile);
s->config.profile = strdup(cs->profile);
}
else
{
free(s->config.profile);
s->config.profile = NULL;
}
printf("RRR: store scale mul %1.5f\n", cs->scale_multiplier);
s->config.scale_multiplier = cs->scale_multiplier;
}
}
printf("--------------------------------------------------\n");
@ -418,6 +440,10 @@ _config_really_apply(E_Randr2_Screen *s, E_Config_Randr2_Screen *cs)
else s->config.relative.to = NULL;
s->config.relative.mode = cs->rel_mode;
s->config.relative.align = cs->rel_align;
free(s->config.profile);
if (cs->profile) s->config.profile = strdup(cs->profile);
else s->config.profile = NULL;
s->config.scale_multiplier = cs->scale_multiplier;
}
else
{
@ -436,6 +462,9 @@ _config_really_apply(E_Randr2_Screen *s, E_Config_Randr2_Screen *cs)
s->config.relative.to = NULL;
s->config.relative.mode = E_RANDR2_RELATIVE_NONE;
s->config.relative.align = 0.0;
free(s->config.profile);
s->config.profile = NULL;
s->config.scale_multiplier = 0.0;
}
}
@ -867,7 +896,7 @@ _screen_config_do(E_Randr2_Screen *s)
printf("RRR: screen do '%s'\n", s->info.name);
if (_config_do_recurse > 5)
{
ERR("screen config loop!");
printf("RRR: screen config loop!\n");
return;
}
_config_do_recurse++;

View File

@ -83,6 +83,9 @@ struct _E_Randr2_Screen
int priority; // larger num == more important
Eina_Bool enabled : 1; // should this monitor be enabled?
Eina_Bool configured : 1; // has screen been configured by e?
char *profile; // profile name to use on this screen
double scale_multiplier; // if 0.0 - then dont multiply scale
} config;
};
@ -97,16 +100,19 @@ struct _E_Config_Randr2
struct _E_Config_Randr2_Screen
{
const char *id;
const char *rel_to;
double rel_align;
double mode_refresh;
int mode_w;
int mode_h;
int rotation;
int priority;
unsigned char rel_mode;
unsigned char enabled;
const char *id;
const char *rel_to;
double rel_align;
double mode_refresh;
int mode_w;
int mode_h;
int rotation;
int priority;
unsigned char rel_mode;
unsigned char enabled;
const char *profile;
double scale_multiplier;
};
extern E_API E_Config_Randr2 *e_randr2_cfg;

View File

@ -14,7 +14,6 @@ struct _E_Config_Dialog_Data
int desk_y;
Eina_Stringshare *bg;
char *name;
char *profile;
Evas_Object *preview;
Ecore_Event_Handler *hdl;
};
@ -58,7 +57,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
Eina_List *l;
char name[40];
int ok = 0;
E_Config_Desktop_Window_Profile *prof;
cfdata->bg = e_bg_file_get(cfdata->zone_num, cfdata->desk_x, cfdata->desk_y);
for (l = e_config->desktop_names; l; l = l->next)
@ -81,22 +80,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
snprintf(name, sizeof(name), _(e_config->desktop_default_name), cfdata->desk_x, cfdata->desk_y);
cfdata->name = strdup(name);
}
ok = 0;
EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, prof)
{
if (!((prof->zone == cfdata->zone_num) &&
(prof->desk_x == cfdata->desk_x) &&
(prof->desk_y == cfdata->desk_y)))
continue;
if (prof->profile)
cfdata->profile = strdup(prof->profile);
ok = 1;
break;
}
if (!ok)
cfdata->profile = strdup(e_config->desktop_default_window_profile);
}
static void *
@ -117,7 +100,6 @@ _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
ecore_event_handler_del(cfdata->hdl);
eina_stringshare_del(cfdata->bg);
E_FREE(cfdata->name);
E_FREE(cfdata->profile);
E_FREE(cfdata);
}
@ -134,19 +116,12 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
cfdata->name = strdup(name);
}
if (!cfdata->profile[0])
cfdata->profile = strdup(e_config->desktop_default_window_profile);
e_desk_name_del(cfdata->zone_num,
cfdata->desk_x, cfdata->desk_y);
e_desk_name_add(cfdata->zone_num,
cfdata->desk_x, cfdata->desk_y, cfdata->name);
e_desk_name_update();
e_desk_window_profile_del(cfdata->zone_num,
cfdata->desk_x, cfdata->desk_y);
e_desk_window_profile_add(cfdata->zone_num,
cfdata->desk_x, cfdata->desk_y, cfdata->profile);
e_desk_window_profile_update();
e_bg_del(cfdata->zone_num, cfdata->desk_x, cfdata->desk_y);
e_bg_add(cfdata->zone_num,
cfdata->desk_x, cfdata->desk_y, cfdata->bg);
@ -172,13 +147,6 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
ob = e_widget_entry_add(cfd->dia->win, &(cfdata->name), NULL, NULL, NULL);
e_widget_list_object_append(ol, ob, 1, 1, 0.5);
e_widget_list_object_append(o, ol, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Desktop Window Profile"), 0);
ob = e_widget_label_add(evas, _("Profile name"));
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 0, 0);
ob = e_widget_entry_add(cfd->dia->win, &(cfdata->profile), NULL, NULL, NULL);
e_widget_disabled_set(ob, !(e_config->use_desktop_window_profile));
e_widget_frametable_object_append(of, ob, 1, 0, 2, 1, 1, 1, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Wallpaper"), 0);
ob = e_widget_preview_add(evas, 240, (240 * zone->h) / zone->w);
cfdata->preview = ob;

View File

@ -16,7 +16,6 @@ struct _E_Config_Dialog_Data
int y;
int edge_flip_dragging;
int flip_wrap;
int use_desktop_window_profile;
int flip_mode;
int flip_interp;
@ -63,7 +62,6 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->y = e_config->zone_desks_y_count;
cfdata->edge_flip_dragging = e_config->edge_flip_dragging;
cfdata->flip_wrap = e_config->desk_flip_wrap;
cfdata->use_desktop_window_profile = e_config->use_desktop_window_profile;
cfdata->flip_interp = e_config->desk_flip_animate_interpolation;
cfdata->flip_mode = 0;
@ -132,11 +130,6 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata
e_config->edge_flip_dragging = cfdata->edge_flip_dragging;
e_config->desk_flip_wrap = cfdata->flip_wrap;
if (e_config->use_desktop_window_profile != cfdata->use_desktop_window_profile)
{
e_config->use_desktop_window_profile = cfdata->use_desktop_window_profile;
e_desk_window_profile_update();
}
e_config_save_queue();
return 1; /* Apply was OK */
}
@ -159,9 +152,7 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
return ((e_util_strcasecmp(eina_list_nth(cfdata->comp_effects, cfdata->flip_mode), e_config->desk_flip_animate_type)) ||
(e_config->desk_flip_animate_interpolation != cfdata->flip_interp) ||
(e_config->edge_flip_dragging != cfdata->edge_flip_dragging) ||
(e_config->desk_flip_wrap != cfdata->flip_wrap) ||
(e_config->use_desktop_window_profile != cfdata->use_desktop_window_profile)
);
(e_config->desk_flip_wrap != cfdata->flip_wrap));
}
/**--GUI--**/
@ -209,14 +200,6 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
&(cfdata->flip_wrap));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 0, 0.5);
of = e_widget_framelist_add(evas, _("Desktop Window Profile"), 0);
ob = e_widget_check_add(evas, _("Use desktop window profile"),
&(cfdata->use_desktop_window_profile));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 0, 0.5);
e_widget_toolbook_page_append(otb, NULL, _("Desktops"), o, 1, 1, 1, 1,
0.5, 0.0);

View File

@ -23,6 +23,10 @@ struct _E_Config_Dialog_Data
Evas_Object *rel_mode_obj;
Evas_Object *rel_to_obj;
Evas_Object *rel_align_obj;
Evas_Object *use_profile_obj;
Evas_Object *profile_list_obj;
Evas_Object *scale_custom_obj;
Evas_Object *scale_value_obj;
int restore;
int hotplug;
int acpi;
@ -101,6 +105,7 @@ _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
{
eina_stringshare_del(cs->id);
eina_stringshare_del(cs->rel_to);
eina_stringshare_del(cs->profile);
free(cs);
}
free(cfdata->params);
@ -215,13 +220,126 @@ _cb_rot_set(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
e_config_dialog_changed_set(cfdata->cfd, EINA_TRUE);
}
typedef struct _Profile_Item
{
char *profile;
E_Config_Dialog_Data *cfdata;
} Profile_Item;
static void
_profiles_list_selected_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Profile_Item *p = data;
E_Config_Randr2_Screen *cs = _config_screen_find(p->cfdata);
if (!cs) return;
eina_stringshare_del(cs->profile);
cs->profile = eina_stringshare_add(p->profile);
e_config_dialog_changed_set(p->cfdata->cfd, EINA_TRUE);
}
static void
_profiles_list_item_del_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Profile_Item *p = data;
free(p->profile);
free(p);
}
static void
_basic_profile_list_fill(E_Config_Dialog_Data *cfdata, const char *prof_sel)
{
Evas_Object *list = cfdata->profile_list_obj;
Eina_List *names = elm_config_profile_list_get();
Eina_List *l;
Elm_Object_Item *sel_it = NULL;
const char *profile;
if (!names) return;
elm_list_clear(list);
if (!prof_sel)
{
elm_list_go(list);
elm_config_profile_list_free(names);
return;
}
EINA_LIST_FOREACH(names, l, profile)
{
Efreet_Desktop *desk = NULL;
const char *label, *ext, *pdir;
char buf[PATH_MAX];
Elm_Object_Item *list_it;
Evas_Object *ic;
Profile_Item *p;
pdir = elm_config_profile_dir_get(profile, EINA_TRUE);
if (!pdir) pdir = elm_config_profile_dir_get(profile, EINA_FALSE);
snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
desk = efreet_desktop_new(buf);
if ((desk) && (desk->name)) label = desk->name;
else
{
if (desk) efreet_desktop_free(desk);
if (pdir) elm_config_profile_dir_free(pdir);
pdir = elm_config_profile_dir_get(profile, EINA_FALSE);
snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
desk = efreet_desktop_new(buf);
if ((desk) && (desk->name)) label = desk->name;
else label = profile;
}
buf[0] = 0;
if (pdir) snprintf(buf, sizeof(buf), "%s/icon.edj", pdir);
if ((desk) && (desk->icon) && (pdir))
snprintf(buf, sizeof(buf), "%s/%s", pdir, desk->icon);
ic = elm_icon_add(list);
ext = strrchr(buf, '.');
if (ext)
{
if (!strcmp(ext, ".edj")) elm_image_file_set(ic, buf, "icon");
else elm_image_file_set(ic, buf, NULL);
}
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL,
1, 1);
evas_object_show(ic);
p = malloc(sizeof(Profile_Item));
p->profile = strdup(profile);
p->cfdata = cfdata;
list_it = elm_list_item_append(list, label, ic, NULL,
_profiles_list_selected_cb, p);
elm_object_item_del_cb_set(list_it, _profiles_list_item_del_cb);
if ((prof_sel) && (!strcmp(profile, prof_sel))) sel_it = list_it;
elm_config_profile_dir_free(pdir);
if (desk) efreet_desktop_free(desk);
}
elm_list_go(list);
if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE);
elm_config_profile_list_free(names);
}
static void
_basic_screen_info_fill(E_Config_Dialog_Data *cfdata, E_Config_Randr2_Screen *cs, E_Randr2_Screen *s)
{
char buf[100];
Eina_List *l;
Eina_List *items, *l;
E_Randr2_Mode *m;
Elm_Object_Item *it, *it_sel;
Elm_Widget_Item *iwt;
void *dt;
if (!s) return;
@ -332,6 +450,39 @@ _basic_screen_info_fill(E_Config_Dialog_Data *cfdata, E_Config_Randr2_Screen *cs
elm_slider_value_set(cfdata->rel_align_obj, cs->rel_align);
if (cs->profile)
{
elm_check_state_set(cfdata->use_profile_obj, EINA_TRUE);
elm_object_disabled_set(cfdata->profile_list_obj, EINA_FALSE);
_basic_profile_list_fill(cfdata, cs->profile);
if (cs->scale_multiplier > 0.0)
{
elm_check_state_set(cfdata->scale_custom_obj, EINA_TRUE);
elm_object_disabled_set(cfdata->scale_value_obj, EINA_FALSE);
elm_slider_value_set(cfdata->scale_value_obj, cs->scale_multiplier);
}
else
{
elm_check_state_set(cfdata->scale_custom_obj, EINA_FALSE);
elm_object_disabled_set(cfdata->scale_value_obj, EINA_TRUE);
elm_slider_value_set(cfdata->scale_value_obj, 1.0);
}
}
else
{
items = (Eina_List *)elm_list_items_get(cfdata->profile_list_obj);
EINA_LIST_FOREACH(items, l, iwt)
{
elm_list_item_selected_set(iwt, EINA_FALSE);
}
elm_check_state_set(cfdata->use_profile_obj, EINA_FALSE);
elm_object_disabled_set(cfdata->profile_list_obj, EINA_TRUE);
elm_object_disabled_set(cfdata->scale_custom_obj, EINA_TRUE);
elm_object_disabled_set(cfdata->scale_value_obj, EINA_TRUE);
}
if (!cs->rel_to)
elm_object_text_set(cfdata->rel_to_obj, "");
else
@ -422,6 +573,67 @@ _cb_rel_to_set(void *data, Evas_Object *obj, void *event)
}
}
static void
_cb_profile_enabled_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
E_Config_Dialog_Data *cfdata = data;
E_Config_Randr2_Screen *cs = _config_screen_find(cfdata);
if (!cs) return;
if (elm_check_state_get(obj))
{
eina_stringshare_del(cs->profile);
cs->profile = eina_stringshare_add("standard");
_basic_profile_list_fill(cfdata, cs->profile);
elm_object_disabled_set(cfdata->profile_list_obj, EINA_FALSE);
elm_object_disabled_set(cfdata->scale_custom_obj, EINA_FALSE);
if (cs->scale_multiplier > 0.0)
elm_object_disabled_set(cfdata->scale_value_obj, EINA_FALSE);
else
elm_object_disabled_set(cfdata->scale_value_obj, EINA_TRUE);
}
else
{
eina_stringshare_del(cs->profile);
cs->profile = NULL;
elm_list_clear(cfdata->profile_list_obj);
elm_object_disabled_set(cfdata->profile_list_obj, EINA_TRUE);
elm_object_disabled_set(cfdata->scale_custom_obj, EINA_TRUE);
elm_object_disabled_set(cfdata->scale_value_obj, EINA_TRUE);
}
e_config_dialog_changed_set(cfdata->cfd, EINA_TRUE);
}
static void
_cb_custom_scale_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
E_Config_Dialog_Data *cfdata = data;
E_Config_Randr2_Screen *cs = _config_screen_find(cfdata);
if (!cs) return;
if (elm_check_state_get(obj))
{
elm_object_disabled_set(cfdata->scale_value_obj, EINA_FALSE);
elm_slider_value_set(cfdata->scale_value_obj, 1.0);
cs->scale_multiplier = 1.0;
}
else
{
elm_object_disabled_set(cfdata->scale_value_obj, EINA_TRUE);
elm_slider_value_set(cfdata->scale_value_obj, 0.0);
cs->scale_multiplier = 0.0;
}
e_config_dialog_changed_set(cfdata->cfd, EINA_TRUE);
}
static void
_cb_scale_value_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
E_Config_Dialog_Data *cfdata = data;
E_Config_Randr2_Screen *cs = _config_screen_find(cfdata);
if (!cs) return;
cs->scale_multiplier = elm_slider_value_get(cfdata->scale_value_obj);
e_config_dialog_changed_set(cfdata->cfd, EINA_TRUE);
}
static void
_cb_rel_align_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
@ -537,6 +749,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
evas_object_show(o);
bx = o;
///////////////////////////////////////////////////////////////////////
o = elm_table_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -574,6 +787,9 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
cs->priority = s->config.priority;
cs->rel_mode = s->config.relative.mode;
cs->enabled = s->config.enabled;
if (s->config.profile)
cs->profile = eina_stringshare_add(s->config.profile);
cs->scale_multiplier = s->config.scale_multiplier;
cfdata->screens = eina_list_append(cfdata->screens, cs);
it = elm_hoversel_item_add(o, s->info.name,
NULL, ELM_ICON_NONE,
@ -649,13 +865,15 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
evas_object_show(o);
cfdata->size_obj = o;
///////////////////////////////////////////////////////////////////////
o = elm_list_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, o, 1, 0, 1, 10);
elm_table_pack(tb, o, 1, 0, 1, 14);
evas_object_show(o);
cfdata->modes_obj = o;
///////////////////////////////////////////////////////////////////////
o = elm_list_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -730,7 +948,54 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
evas_object_smart_callback_add(o, "changed", _cb_rel_align_changed, cfdata);
cfdata->rel_align_obj = o;
// // // // // // // // // // // // // // // // // // // // // // //
o = elm_separator_add(win);
elm_separator_horizontal_set(o, EINA_TRUE);
evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_table_pack(tb, o, 2, 9, 1, 1);
evas_object_show(o);
o = elm_check_add(win);
evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, _("Use Profile"));
elm_table_pack(tb, o, 2, 10, 1, 1);
evas_object_show(o);
cfdata->use_profile_obj = o;
evas_object_smart_callback_add(o, "changed", _cb_profile_enabled_changed, cfdata);
o = elm_list_add(win);
evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, o, 2, 11, 1, 1);
evas_object_show(o);
cfdata->profile_list_obj = o;
o = elm_check_add(win);
evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, _("Custom Scale"));
elm_table_pack(tb, o, 2, 12, 1, 1);
evas_object_show(o);
cfdata->scale_custom_obj = o;
evas_object_smart_callback_add(o, "changed", _cb_custom_scale_changed, cfdata);
o = elm_slider_add(win);
evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, _("Scale"));
elm_slider_unit_format_set(o, "%1.1f");
elm_slider_span_size_set(o, 100);
elm_slider_min_max_set(o, 0.5, 5.5);
elm_table_pack(tb, o, 2, 13, 1, 1);
evas_object_show(o);
cfdata->scale_value_obj = o;
evas_object_smart_callback_add(o, "changed", _cb_scale_value_changed, cfdata);
_basic_profile_list_fill(cfdata, NULL);
_basic_screen_info_fill(cfdata, first_cfg, first);
///////////////////////////////////////////////////////////////////////
o = elm_box_add(win);
elm_box_horizontal_set(o, EINA_TRUE);
@ -809,6 +1074,10 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
cs->rotation = cs2->rotation;
cs->priority = cs2->priority;
cs->rel_mode = cs2->rel_mode;
if (cs->profile) eina_stringshare_del(cs->profile);
cs->profile = NULL;
if (cs2->profile) cs->profile = eina_stringshare_add(cs2->profile);
cs->scale_multiplier = cs2->scale_multiplier;
printf("APPLY %s .... rel mode %i\n", cs->id, cs->rel_mode);
cs->enabled = cs2->enabled;
}