2010-05-07 08:49:06 -07:00
# ifdef HAVE_CONFIG_H
# include "elementary_config.h"
# endif
# ifdef HAVE_EVIL
# include <Evil.h>
# endif
# include <Elementary.h>
# include "elm_priv.h"
2011-10-19 05:46:56 -07:00
EAPI int ELM_EVENT_CONFIG_ALL_CHANGED = 0 ;
2011-02-03 07:52:49 -08:00
2010-05-07 08:49:06 -07:00
Elm_Config * _elm_config = NULL ;
char * _elm_profile = NULL ;
static Eet_Data_Descriptor * _config_edd = NULL ;
2010-11-18 02:01:24 -08:00
static Eet_Data_Descriptor * _config_font_overlay_edd = NULL ;
2012-03-09 05:04:00 -08:00
static Eet_Data_Descriptor * _config_color_edd = NULL ;
static Eet_Data_Descriptor * _config_color_palette_edd = NULL ;
2012-02-29 04:45:58 -08:00
const char * _elm_preferred_engine = NULL ;
2012-11-01 00:30:41 -07:00
Eina_List * _font_overlays_del = NULL ;
2010-05-08 19:19:14 -07:00
2010-11-22 22:10:58 -08:00
static Ecore_Poller * _elm_cache_flush_poller = NULL ;
2010-11-01 14:10:07 -07:00
const char * _elm_engines [ ] = {
" software_x11 " ,
" fb " ,
" directfb " ,
" software_16_x11 " ,
" software_8_x11 " ,
" xrender_x11 " ,
" opengl_x11 " ,
" software_gdi " ,
" software_16_wince_gdi " ,
" sdl " ,
" software_16_sdl " ,
" opengl_sdl " ,
2011-07-25 05:02:52 -07:00
" buffer " ,
2011-10-05 15:18:22 -07:00
" ews " ,
2011-11-02 12:26:29 -07:00
" opengl_cocoa " ,
2011-11-05 10:50:09 -07:00
" psl1ght " ,
2012-01-02 17:45:22 -08:00
" wayland_shm " ,
2012-01-12 01:10:27 -08:00
" wayland_egl " ,
2010-11-01 14:10:07 -07:00
NULL
} ;
2010-11-18 02:01:24 -08:00
/* whenever you want to add a new text class support into Elementary,
declare it both here and in the ( default ) theme */
static const Elm_Text_Class _elm_text_classes [ ] = {
2012-05-08 00:26:48 -07:00
{ " button " , " Button " } ,
{ " label " , " Label " } ,
{ " entry " , " Entry " } ,
2010-11-18 02:01:24 -08:00
{ " title_bar " , " Title Bar " } ,
2010-11-23 17:47:59 -08:00
{ " list_item " , " List Items " } ,
{ " grid_item " , " Grid Items " } ,
{ " toolbar_item " , " Toolbar Items " } ,
{ " menu_item " , " Menu Items " } ,
2010-11-18 02:01:24 -08:00
{ NULL , NULL }
} ;
2010-12-06 04:46:16 -08:00
static void _desc_init ( void ) ;
static void _desc_shutdown ( void ) ;
static void _profile_fetch_from_conf ( void ) ;
2013-01-04 17:12:27 -08:00
static void _config_free ( Elm_Config * cfg ) ;
2010-12-06 04:46:16 -08:00
static void _config_apply ( void ) ;
static Elm_Config * _config_user_load ( void ) ;
static Elm_Config * _config_system_load ( void ) ;
static void _config_load ( void ) ;
static void _config_update ( void ) ;
static void _env_get ( void ) ;
static size_t _elm_data_dir_snprintf ( char * dst ,
size_t size ,
const char * fmt , . . . )
EINA_PRINTF ( 3 , 4 ) ;
2010-05-07 08:49:06 -07:00
2010-11-04 06:50:54 -07:00
# define ELM_CONFIG_VAL(edd, type, member, dtype) \
EET_DATA_DESCRIPTOR_ADD_BASIC ( edd , type , # member , member , dtype )
# define ELM_CONFIG_LIST(edd, type, member, eddtype) \
EET_DATA_DESCRIPTOR_ADD_LIST ( edd , type , # member , member , eddtype )
2010-05-07 08:49:06 -07:00
# ifdef HAVE_ELEMENTARY_X
2010-05-08 19:19:14 -07:00
static Ecore_Event_Handler * _prop_change_handler = NULL ;
2011-10-19 05:46:56 -07:00
static Ecore_Timer * _prop_change_delay_timer = NULL ;
2010-05-08 19:19:14 -07:00
static Ecore_X_Window _root_1st = 0 ;
2011-10-19 05:46:56 -07:00
# define ATOM_COUNT 2
2010-05-08 19:19:14 -07:00
static Ecore_X_Atom _atom [ ATOM_COUNT ] ;
static Ecore_X_Atom _atom_config = 0 ;
static const char * _atom_names [ ATOM_COUNT ] =
2010-12-06 04:46:16 -08:00
{
2011-10-19 05:46:56 -07:00
" ELM_PROFILE " ,
" ELM_CONFIG "
2010-12-06 04:46:16 -08:00
} ;
2011-10-19 05:46:56 -07:00
# define ATOM_E_PROFILE 0
# define ATOM_E_CONFIG 1
2010-05-08 19:19:14 -07:00
static Eina_Bool _prop_config_get ( void ) ;
2011-10-19 05:46:56 -07:00
static void _prop_config_set ( void ) ;
2010-12-06 04:46:16 -08:00
static Eina_Bool _prop_change ( void * data __UNUSED__ ,
int ev_type __UNUSED__ ,
void * ev ) ;
2010-05-08 19:19:14 -07:00
2013-05-13 04:18:24 -07:00
static void
2012-11-01 00:30:41 -07:00
_elm_font_overlays_del_free ( void )
{
char * text_class ;
Eina_List * l ;
EINA_LIST_FOREACH ( _font_overlays_del , l , text_class )
eina_stringshare_del ( text_class ) ;
_font_overlays_del = eina_list_free ( _font_overlays_del ) ;
}
2013-05-13 04:18:24 -07:00
static void
2012-11-01 00:30:41 -07:00
_elm_config_font_overlays_cancel ( void )
{
Elm_Font_Overlay * efd ;
Eina_List * l ;
EINA_LIST_FOREACH ( _elm_config - > font_overlays , l , efd )
edje_text_class_del ( efd - > text_class ) ;
}
2010-05-08 19:19:14 -07:00
static Eina_Bool
_prop_config_get ( void )
{
int size = 0 ;
Ecore_X_Atom atom ;
char buf [ 512 ] ;
2010-06-25 02:58:14 -07:00
unsigned char * data = NULL ;
Elm_Config * config_data ;
2011-10-19 05:46:56 -07:00
snprintf ( buf , sizeof ( buf ) , " ELM_CONFIG_%s " , _elm_profile ) ;
2010-05-08 19:19:14 -07:00
atom = ecore_x_atom_get ( buf ) ;
_atom_config = atom ;
if ( ! ecore_x_window_prop_property_get ( _root_1st ,
2010-10-25 06:08:04 -07:00
atom , _atom [ ATOM_E_CONFIG ] ,
2010-05-08 19:19:14 -07:00
8 , & data , & size ) )
{
2010-10-25 06:08:04 -07:00
if ( ! ecore_x_window_prop_property_get ( _root_1st ,
_atom [ ATOM_E_CONFIG ] ,
_atom [ ATOM_E_CONFIG ] ,
2010-05-08 19:19:14 -07:00
8 , & data , & size ) )
2010-06-05 06:12:45 -07:00
return EINA_FALSE ;
2010-05-08 19:19:14 -07:00
else
_atom_config = _atom [ ATOM_E_CONFIG ] ;
}
else
_atom_config = atom ;
if ( size < 1 )
{
free ( data ) ;
2010-06-05 06:12:45 -07:00
return EINA_FALSE ;
2010-05-08 19:19:14 -07:00
}
config_data = eet_data_descriptor_decode ( _config_edd , data , size ) ;
free ( data ) ;
2010-06-05 06:12:45 -07:00
if ( ! config_data ) return EINA_FALSE ;
2010-09-02 07:33:04 -07:00
/* What do we do on version mismatch when someone changes the
* config in the rootwindow ? */
/* Most obvious case, new version and we are still linked to
* whatever was there before , we just ignore until user restarts us */
if ( config_data - > config_version > ELM_CONFIG_VERSION )
return EINA_TRUE ;
/* What in the case the version is older? Do we even support those
* cases or we only check for equality above ? */
2012-11-01 00:30:41 -07:00
_elm_config_font_overlays_cancel ( ) ;
2013-01-04 17:12:27 -08:00
_config_free ( _elm_config ) ;
_elm_config = NULL ;
2010-05-08 19:19:14 -07:00
_elm_config = config_data ;
2012-08-20 00:53:39 -07:00
_env_get ( ) ;
2010-05-08 19:19:14 -07:00
_config_apply ( ) ;
2010-11-18 02:01:24 -08:00
_elm_config_font_overlay_apply ( ) ;
2010-05-08 19:19:14 -07:00
_elm_rescale ( ) ;
2010-11-22 22:10:58 -08:00
_elm_recache ( ) ;
2013-05-20 05:03:43 -07:00
_elm_clouseau_reload ( ) ;
2013-04-08 01:35:25 -07:00
_elm_win_access ( _elm_config - > access_mode ) ;
2011-10-19 05:46:56 -07:00
ecore_event_add ( ELM_EVENT_CONFIG_ALL_CHANGED , NULL , NULL , NULL ) ;
2010-06-05 06:12:45 -07:00
return EINA_TRUE ;
2010-05-08 19:19:14 -07:00
}
2011-10-19 05:46:56 -07:00
static void
_prop_config_set ( void )
{
unsigned char * config_data = NULL ;
int size = 0 ;
2011-10-20 17:24:15 -07:00
2011-10-19 05:46:56 -07:00
config_data = eet_data_descriptor_encode ( _config_edd , _elm_config , & size ) ;
if ( config_data )
{
Ecore_X_Atom atom ;
char buf [ 512 ] ;
2011-10-20 17:24:15 -07:00
2011-10-19 05:46:56 -07:00
snprintf ( buf , sizeof ( buf ) , " ELM_CONFIG_%s " , _elm_profile ) ;
atom = ecore_x_atom_get ( buf ) ;
_atom_config = atom ;
ecore_x_window_prop_property_set ( _root_1st , _atom_config ,
_atom [ ATOM_E_CONFIG ] , 8 ,
config_data , size ) ;
free ( config_data ) ;
}
}
static Eina_Bool
_prop_change_delay_cb ( void * data __UNUSED__ )
{
char * s ;
2011-10-20 17:24:15 -07:00
2012-08-20 00:53:39 -07:00
if ( ! getenv ( " ELM_PROFILE " ) )
2011-10-19 05:46:56 -07:00
{
2012-08-20 00:53:39 -07:00
s = ecore_x_window_prop_string_get ( _root_1st , _atom [ ATOM_E_PROFILE ] ) ;
if ( s )
{
if ( _elm_profile ) free ( _elm_profile ) ;
_elm_profile = s ;
}
2011-10-19 05:46:56 -07:00
}
_prop_config_get ( ) ;
_prop_change_delay_timer = NULL ;
2013-10-02 04:18:49 -07:00
return ECORE_CALLBACK_CANCEL ;
2011-10-19 05:46:56 -07:00
}
2010-06-25 02:58:14 -07:00
static Eina_Bool
2010-12-06 04:46:16 -08:00
_prop_change ( void * data __UNUSED__ ,
int ev_type __UNUSED__ ,
void * ev )
2010-05-07 08:49:06 -07:00
{
Ecore_X_Event_Window_Property * event = ev ;
2010-05-08 19:19:14 -07:00
if ( event - > win = = _root_1st )
2010-05-07 08:49:06 -07:00
{
2011-10-19 05:46:56 -07:00
if ( event - > atom = = _atom [ ATOM_E_PROFILE ] )
2010-11-22 22:10:58 -08:00
{
2013-05-29 04:49:54 -07:00
if ( _prop_change_delay_timer ) ecore_timer_del ( _prop_change_delay_timer ) ;
2011-10-19 05:46:56 -07:00
_prop_change_delay_timer = ecore_timer_add ( 0.1 , _prop_change_delay_cb , NULL ) ;
2010-12-06 04:46:10 -08:00
}
2010-10-25 06:08:04 -07:00
else if ( ( ( _atom_config > 0 ) & & ( event - > atom = = _atom_config ) ) | |
2010-05-08 19:19:14 -07:00
( event - > atom = = _atom [ ATOM_E_CONFIG ] ) )
{
2013-05-29 04:49:54 -07:00
if ( _prop_change_delay_timer ) ecore_timer_del ( _prop_change_delay_timer ) ;
2011-10-19 05:46:56 -07:00
_prop_change_delay_timer = ecore_timer_add ( 0.1 , _prop_change_delay_cb , NULL ) ;
2010-05-08 19:19:14 -07:00
}
2010-05-07 08:49:06 -07:00
}
2010-06-25 02:58:14 -07:00
return ECORE_CALLBACK_PASS_ON ;
2010-05-07 08:49:06 -07:00
}
2010-12-06 04:46:16 -08:00
2010-05-07 08:49:06 -07:00
# endif
static void
_desc_init ( void )
{
Eet_Data_Descriptor_Class eddc ;
2010-10-25 06:08:04 -07:00
2010-05-07 08:49:06 -07:00
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET ( & eddc , Elm_Config ) ;
eddc . func . str_direct_alloc = NULL ;
eddc . func . str_direct_free = NULL ;
2010-10-25 06:08:04 -07:00
2010-05-07 08:49:06 -07:00
_config_edd = eet_data_descriptor_file_new ( & eddc ) ;
if ( ! _config_edd )
{
2013-06-04 22:40:03 -07:00
ERR ( " EEEK! eet_data_descriptor_file_new() failed. " ) ;
2010-05-07 08:49:06 -07:00
return ;
}
2010-11-04 06:50:54 -07:00
2010-11-18 02:01:24 -08:00
memset ( & eddc , 0 , sizeof ( eddc ) ) ; /* just in case... */
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET ( & eddc , Elm_Font_Overlay ) ;
eddc . func . str_direct_alloc = NULL ;
eddc . func . str_direct_free = NULL ;
_config_font_overlay_edd = eet_data_descriptor_stream_new ( & eddc ) ;
if ( ! _config_font_overlay_edd )
{
2013-06-04 22:40:03 -07:00
ERR ( " EEEK! eet_data_descriptor_stream_new() failed. " ) ;
2010-11-18 02:01:24 -08:00
eet_data_descriptor_free ( _config_edd ) ;
return ;
}
2012-03-09 05:04:00 -08:00
memset ( & eddc , 0 , sizeof ( eddc ) ) ; /* just in case... */
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET ( & eddc , Elm_Color_RGBA ) ;
eddc . func . str_direct_alloc = NULL ;
eddc . func . str_direct_free = NULL ;
_config_color_edd = eet_data_descriptor_stream_new ( & eddc ) ;
if ( ! _config_color_edd )
{
2013-06-04 22:40:03 -07:00
ERR ( " EEEK! eet_data_descriptor_stream_new() failed. " ) ;
2012-03-09 05:04:00 -08:00
eet_data_descriptor_free ( _config_edd ) ;
return ;
}
memset ( & eddc , 0 , sizeof ( eddc ) ) ; /* just in case... */
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET ( & eddc , Elm_Custom_Palette ) ;
eddc . func . str_direct_alloc = NULL ;
eddc . func . str_direct_free = NULL ;
_config_color_palette_edd = eet_data_descriptor_stream_new ( & eddc ) ;
if ( ! _config_color_palette_edd )
{
2013-06-04 22:40:03 -07:00
ERR ( " EEEK! eet_data_descriptor_stream_new() failed. " ) ;
2012-03-09 05:04:00 -08:00
eet_data_descriptor_free ( _config_edd ) ;
return ;
}
2010-12-06 04:46:16 -08:00
# define T_INT EET_T_INT
2010-11-04 06:50:54 -07:00
# define T_DOUBLE EET_T_DOUBLE
# define T_STRING EET_T_STRING
2010-12-06 04:46:16 -08:00
# define T_UCHAR EET_T_UCHAR
2010-11-18 02:01:24 -08:00
2010-12-06 04:46:16 -08:00
# define T Elm_Font_Overlay
# define D _config_font_overlay_edd
2010-11-18 02:01:24 -08:00
ELM_CONFIG_VAL ( D , T , text_class , EET_T_STRING ) ;
ELM_CONFIG_VAL ( D , T , font , EET_T_STRING ) ;
ELM_CONFIG_VAL ( D , T , size , EET_T_INT ) ;
# undef T
# undef D
2012-03-09 05:04:00 -08:00
# define T Elm_Color_RGBA
# define D _config_color_edd
ELM_CONFIG_VAL ( D , T , r , EET_T_UINT ) ;
ELM_CONFIG_VAL ( D , T , g , EET_T_UINT ) ;
ELM_CONFIG_VAL ( D , T , b , EET_T_UINT ) ;
ELM_CONFIG_VAL ( D , T , a , EET_T_UINT ) ;
# undef T
# undef D
# define T Elm_Custom_Palette
# define D _config_color_palette_edd
ELM_CONFIG_VAL ( D , T , palette_name , EET_T_STRING ) ;
ELM_CONFIG_LIST ( D , T , color_list , _config_color_edd ) ;
# undef T
# undef D
2010-11-18 02:01:24 -08:00
# define T Elm_Config
# define D _config_edd
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , config_version , T_INT ) ;
ELM_CONFIG_VAL ( D , T , engine , T_STRING ) ;
2011-05-11 02:06:59 -07:00
ELM_CONFIG_VAL ( D , T , vsync , T_UCHAR ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_enable , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , thumbscroll_threshold , T_INT ) ;
2013-03-07 01:13:15 -08:00
ELM_CONFIG_VAL ( D , T , thumbscroll_hold_threshold , T_INT ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_momentum_threshold , T_DOUBLE ) ;
2013-07-03 02:43:19 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_flick_distance_tolerance , T_INT ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_friction , T_DOUBLE ) ;
2013-04-30 06:06:28 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_min_friction , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , thumbscroll_friction_standard , T_DOUBLE ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_bounce_friction , T_DOUBLE ) ;
2010-11-05 02:31:51 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_border_friction , T_DOUBLE ) ;
2011-10-13 05:07:39 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_sensitivity_friction , T_DOUBLE ) ;
2013-04-17 05:46:21 -07:00
ELM_CONFIG_VAL ( D , T , thumbscroll_acceleration_threshold , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , thumbscroll_acceleration_time_limit , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , thumbscroll_acceleration_weight , T_DOUBLE ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , page_scroll_friction , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , bring_in_scroll_friction , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , zoom_friction , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , thumbscroll_bounce_enable , T_UCHAR ) ;
2013-04-30 00:46:59 -07:00
ELM_CONFIG_VAL ( D , T , scroll_smooth_start_enable , T_UCHAR ) ;
2012-07-05 18:59:57 -07:00
ELM_CONFIG_VAL ( D , T , scroll_smooth_time_interval , T_DOUBLE ) ;
2011-06-09 03:14:16 -07:00
ELM_CONFIG_VAL ( D , T , scroll_smooth_amount , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , scroll_smooth_history_weight , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , scroll_smooth_future_time , T_DOUBLE ) ;
2011-06-09 22:07:21 -07:00
ELM_CONFIG_VAL ( D , T , scroll_smooth_time_window , T_DOUBLE ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , scale , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , bgpixmap , T_INT ) ;
ELM_CONFIG_VAL ( D , T , compositing , T_INT ) ;
/* EET_DATA_DESCRIPTOR_ADD_LIST(D, T, "font_dirs", font_dirs, sub_edd); */
2010-11-18 02:01:24 -08:00
ELM_CONFIG_LIST ( D , T , font_overlays , _config_font_overlay_edd ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , font_hinting , T_INT ) ;
2010-11-22 22:10:58 -08:00
ELM_CONFIG_VAL ( D , T , cache_flush_poll_interval , T_INT ) ;
2010-12-24 08:02:30 -08:00
ELM_CONFIG_VAL ( D , T , cache_flush_enable , T_UCHAR ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , image_cache , T_INT ) ;
ELM_CONFIG_VAL ( D , T , font_cache , T_INT ) ;
2010-11-22 22:10:58 -08:00
ELM_CONFIG_VAL ( D , T , edje_cache , T_INT ) ;
ELM_CONFIG_VAL ( D , T , edje_collection_cache , T_INT ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , finger_size , T_INT ) ;
ELM_CONFIG_VAL ( D , T , fps , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , theme , T_STRING ) ;
ELM_CONFIG_VAL ( D , T , modules , T_STRING ) ;
ELM_CONFIG_VAL ( D , T , tooltip_delay , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , cursor_engine_only , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , focus_highlight_enable , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , focus_highlight_animate , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , toolbar_shrink_mode , T_INT ) ;
ELM_CONFIG_VAL ( D , T , fileselector_expand_enable , T_UCHAR ) ;
2013-09-30 08:49:50 -07:00
ELM_CONFIG_VAL ( D , T , fileselector_double_tap_navigation_enable , T_UCHAR ) ;
2010-11-04 06:50:54 -07:00
ELM_CONFIG_VAL ( D , T , inwin_dialogs_enable , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , icon_size , T_INT ) ;
2010-11-24 09:11:34 -08:00
ELM_CONFIG_VAL ( D , T , longpress_timeout , T_DOUBLE ) ;
2011-01-31 00:18:58 -08:00
ELM_CONFIG_VAL ( D , T , effect_enable , T_UCHAR ) ;
2011-04-01 06:20:40 -07:00
ELM_CONFIG_VAL ( D , T , desktop_entry , T_UCHAR ) ;
2011-06-29 22:38:57 -07:00
ELM_CONFIG_VAL ( D , T , password_show_last , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , password_show_last_timeout , T_DOUBLE ) ;
2011-12-18 00:45:59 -08:00
ELM_CONFIG_VAL ( D , T , glayer_zoom_finger_enable , T_UCHAR ) ;
2011-07-17 23:24:34 -07:00
ELM_CONFIG_VAL ( D , T , glayer_zoom_finger_factor , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , glayer_zoom_wheel_factor , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , glayer_zoom_distance_tolerance , T_DOUBLE ) ;
2011-12-20 00:39:30 -08:00
ELM_CONFIG_VAL ( D , T , glayer_rotate_finger_enable , T_UCHAR ) ;
2011-07-17 23:24:34 -07:00
ELM_CONFIG_VAL ( D , T , glayer_rotate_angular_tolerance , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , glayer_line_min_length , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , glayer_line_distance_tolerance , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , glayer_line_angular_tolerance , T_DOUBLE ) ;
ELM_CONFIG_VAL ( D , T , glayer_flick_time_limit_ms , T_INT ) ;
2011-08-01 06:09:05 -07:00
ELM_CONFIG_VAL ( D , T , glayer_long_tap_start_timeout , T_DOUBLE ) ;
2012-05-20 07:56:35 -07:00
ELM_CONFIG_VAL ( D , T , glayer_double_tap_timeout , T_DOUBLE ) ;
2012-11-08 15:01:37 -08:00
ELM_CONFIG_VAL ( D , T , access_mode , T_UCHAR ) ;
2012-11-29 00:58:49 -08:00
ELM_CONFIG_VAL ( D , T , selection_clear_enable , T_UCHAR ) ;
2011-09-08 03:10:34 -07:00
ELM_CONFIG_VAL ( D , T , glayer_continues_enable , T_UCHAR ) ;
2012-03-06 20:57:03 -08:00
ELM_CONFIG_VAL ( D , T , week_start , T_INT ) ;
ELM_CONFIG_VAL ( D , T , weekend_start , T_INT ) ;
ELM_CONFIG_VAL ( D , T , weekend_len , T_INT ) ;
2012-04-01 23:20:01 -07:00
ELM_CONFIG_VAL ( D , T , year_min , T_INT ) ;
ELM_CONFIG_VAL ( D , T , year_max , T_INT ) ;
2012-03-09 05:04:00 -08:00
ELM_CONFIG_LIST ( D , T , color_palette , _config_color_palette_edd ) ;
2012-07-05 02:23:38 -07:00
ELM_CONFIG_VAL ( D , T , softcursor_mode , T_UCHAR ) ;
2012-08-28 03:37:02 -07:00
ELM_CONFIG_VAL ( D , T , auto_norender_withdrawn , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , auto_norender_iconified_same_as_withdrawn , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , auto_flush_withdrawn , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , auto_dump_withdrawn , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , auto_throttle , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , auto_throttle_amount , T_DOUBLE ) ;
2012-09-12 07:08:26 -07:00
ELM_CONFIG_VAL ( D , T , indicator_service_0 , T_STRING ) ;
ELM_CONFIG_VAL ( D , T , indicator_service_90 , T_STRING ) ;
ELM_CONFIG_VAL ( D , T , indicator_service_180 , T_STRING ) ;
ELM_CONFIG_VAL ( D , T , indicator_service_270 , T_STRING ) ;
2013-01-22 10:51:24 -08:00
ELM_CONFIG_VAL ( D , T , disable_external_menu , T_UCHAR ) ;
2013-05-20 05:03:43 -07:00
ELM_CONFIG_VAL ( D , T , clouseau_enable , T_UCHAR ) ;
2013-06-07 01:17:30 -07:00
ELM_CONFIG_VAL ( D , T , magnifier_enable , T_UCHAR ) ;
ELM_CONFIG_VAL ( D , T , magnifier_scale , T_DOUBLE ) ;
2010-11-04 06:50:54 -07:00
# undef T
# undef D
# undef T_INT
# undef T_DOUBLE
# undef T_STRING
# undef T_UCHAR
2010-05-07 08:49:06 -07:00
}
static void
_desc_shutdown ( void )
{
2010-11-18 02:01:24 -08:00
if ( _config_edd )
{
eet_data_descriptor_free ( _config_edd ) ;
_config_edd = NULL ;
}
if ( _config_font_overlay_edd )
{
eet_data_descriptor_free ( _config_font_overlay_edd ) ;
_config_font_overlay_edd = NULL ;
}
2012-03-09 05:04:00 -08:00
if ( _config_color_edd )
{
eet_data_descriptor_free ( _config_color_edd ) ;
_config_color_edd = NULL ;
}
if ( _config_color_palette_edd )
{
eet_data_descriptor_free ( _config_color_palette_edd ) ;
_config_color_palette_edd = NULL ;
}
2010-05-07 08:49:06 -07:00
}
2010-10-25 10:36:07 -07:00
static int
2010-12-06 04:46:16 -08:00
_sort_files_cb ( const void * f1 ,
const void * f2 )
2010-10-25 06:08:19 -07:00
{
return strcmp ( f1 , f2 ) ;
}
const char *
_elm_config_current_profile_get ( void )
{
2010-12-06 04:46:16 -08:00
return _elm_profile ;
2010-10-25 06:08:19 -07:00
}
2010-10-28 13:57:44 -07:00
static size_t
2010-12-06 04:46:16 -08:00
_elm_data_dir_snprintf ( char * dst ,
size_t size ,
const char * fmt ,
. . . )
2010-10-25 06:08:19 -07:00
{
2010-10-28 13:57:44 -07:00
size_t data_dir_len , off ;
va_list ap ;
2010-10-29 10:32:16 -07:00
data_dir_len = eina_strlcpy ( dst , _elm_data_dir , size ) ;
2010-10-28 13:57:44 -07:00
off = data_dir_len + 1 ;
if ( off > = size )
goto end ;
va_start ( ap , fmt ) ;
dst [ data_dir_len ] = ' / ' ;
off = off + vsnprintf ( dst + off , size - off , fmt , ap ) ;
va_end ( ap ) ;
2010-12-06 04:46:16 -08:00
end :
2010-10-28 13:57:44 -07:00
return off ;
}
2013-09-05 15:38:42 -07:00
size_t
_elm_config_user_dir_snprintf ( char * dst ,
size_t size ,
const char * fmt ,
. . . )
2010-10-28 13:57:44 -07:00
{
2013-05-27 23:19:33 -07:00
const char * home = NULL ;
2010-10-28 13:57:44 -07:00
size_t user_dir_len , off ;
va_list ap ;
2010-10-25 06:08:19 -07:00
2011-04-06 06:57:42 -07:00
# ifdef _WIN32
home = evil_homedir_get ( ) ;
2013-05-27 20:31:59 -07:00
user_dir_len = eina_str_join_len
( dst , size , ' / ' , home , strlen ( home ) ,
ELEMENTARY_BASE_DIR , sizeof ( ELEMENTARY_BASE_DIR ) - 1 ) ;
2011-04-06 06:57:42 -07:00
# else
2013-09-30 03:21:31 -07:00
# ifdef DOXDG
2013-05-27 20:31:59 -07:00
home = getenv ( " XDG_CONFIG_HOME " ) ;
if ( home )
{
user_dir_len = eina_str_join_len
( dst , size , ' / ' , home , strlen ( home ) ,
" elementary " , sizeof ( " elementary " ) - 1 ) ;
}
else
2013-09-30 03:21:31 -07:00
# endif
2013-05-27 20:31:59 -07:00
{
2013-05-27 23:19:33 -07:00
home = getenv ( " HOME " ) ;
2013-05-27 20:31:59 -07:00
if ( ! home ) home = " / " ;
# ifdef DOXDG
user_dir_len = eina_str_join_len
( dst , size , ' / ' , home , strlen ( home ) ,
" .config " , sizeof ( " .config " ) - 1 ,
" elementary " , sizeof ( " elementary " ) - 1 ) ;
# else
user_dir_len = eina_str_join_len
( dst , size , ' / ' , home , strlen ( home ) ,
ELEMENTARY_BASE_DIR , sizeof ( ELEMENTARY_BASE_DIR ) - 1 ) ;
2013-09-30 03:21:31 -07:00
# endif
2013-05-27 20:31:59 -07:00
}
2011-04-06 06:57:42 -07:00
# endif
2010-10-28 13:57:44 -07:00
off = user_dir_len + 1 ;
2013-05-27 20:31:59 -07:00
if ( off > = size ) goto end ;
2010-10-28 13:57:44 -07:00
va_start ( ap , fmt ) ;
dst [ user_dir_len ] = ' / ' ;
off = off + vsnprintf ( dst + off , size - off , fmt , ap ) ;
va_end ( ap ) ;
2010-12-06 04:46:16 -08:00
end :
2010-10-28 13:57:44 -07:00
return off ;
}
const char *
2010-12-06 04:46:16 -08:00
_elm_config_profile_dir_get ( const char * prof ,
Eina_Bool is_user )
2010-10-28 13:57:44 -07:00
{
char buf [ PATH_MAX ] ;
if ( ! is_user )
goto not_user ;
2013-09-05 15:38:42 -07:00
_elm_config_user_dir_snprintf ( buf , sizeof ( buf ) , " config/%s " , prof ) ;
2010-10-25 06:08:19 -07:00
if ( ecore_file_is_dir ( buf ) )
return strdup ( buf ) ;
2010-10-28 13:57:44 -07:00
return NULL ;
2010-12-06 04:46:16 -08:00
not_user :
2010-10-25 06:08:19 -07:00
snprintf ( buf , sizeof ( buf ) , " %s/config/%s " , _elm_data_dir , prof ) ;
if ( ecore_file_is_dir ( buf ) )
return strdup ( buf ) ;
return NULL ;
}
2010-11-18 02:01:24 -08:00
Eina_List *
_elm_config_font_overlays_list ( void )
{
return _elm_config - > font_overlays ;
}
2012-06-29 23:01:25 -07:00
Eina_Bool _elm_config_access_get ( void )
{
return _elm_config - > access_mode ;
}
void _elm_config_access_set ( Eina_Bool is_access )
{
is_access = ! ! is_access ;
if ( _elm_config - > access_mode = = is_access ) return ;
_elm_config - > access_mode = is_access ;
2012-08-18 06:52:03 -07:00
_elm_win_access ( is_access ) ;
2013-02-03 20:51:26 -08:00
if ( ! is_access ) _elm_access_shutdown ( ) ;
2012-06-29 23:01:25 -07:00
}
2012-11-29 00:58:49 -08:00
Eina_Bool _elm_config_selection_unfocused_clear_get ( void )
{
return _elm_config - > selection_clear_enable ;
}
void _elm_config_selection_unfocused_clear_set ( Eina_Bool enabled )
{
enabled = ! ! enabled ;
if ( _elm_config - > selection_clear_enable = = enabled ) return ;
_elm_config - > selection_clear_enable = enabled ;
}
2010-11-18 02:01:24 -08:00
void
_elm_config_font_overlay_set ( const char * text_class ,
const char * font ,
Evas_Font_Size size )
{
Elm_Font_Overlay * efd ;
Eina_List * l ;
EINA_LIST_FOREACH ( _elm_config - > font_overlays , l , efd )
{
if ( strcmp ( efd - > text_class , text_class ) )
continue ;
if ( efd - > font ) eina_stringshare_del ( efd - > font ) ;
efd - > font = eina_stringshare_add ( font ) ;
efd - > size = size ;
_elm_config - > font_overlays =
eina_list_promote_list ( _elm_config - > font_overlays , l ) ;
return ;
}
/* the text class doesn't exist */
efd = calloc ( 1 , sizeof ( Elm_Font_Overlay ) ) ;
efd - > text_class = eina_stringshare_add ( text_class ) ;
efd - > font = eina_stringshare_add ( font ) ;
efd - > size = size ;
_elm_config - > font_overlays = eina_list_prepend ( _elm_config - > font_overlays ,
efd ) ;
}
void
_elm_config_font_overlay_remove ( const char * text_class )
{
Elm_Font_Overlay * efd ;
Eina_List * l ;
EINA_LIST_FOREACH ( _elm_config - > font_overlays , l , efd )
{
2013-07-05 20:14:02 -07:00
if ( ! efd - > text_class ) continue ;
if ( strcmp ( efd - > text_class , text_class ) ) continue ;
2012-11-01 00:30:41 -07:00
_font_overlays_del =
eina_list_append ( _font_overlays_del ,
eina_stringshare_add ( text_class ) ) ;
2010-11-18 02:01:24 -08:00
_elm_config - > font_overlays =
eina_list_remove_list ( _elm_config - > font_overlays , l ) ;
2013-07-05 20:14:02 -07:00
eina_stringshare_del ( efd - > text_class ) ;
2010-11-18 02:01:24 -08:00
if ( efd - > font ) eina_stringshare_del ( efd - > font ) ;
free ( efd ) ;
return ;
}
}
void
_elm_config_font_overlay_apply ( void )
{
Elm_Font_Overlay * efd ;
Eina_List * l ;
2012-11-01 00:30:41 -07:00
char * text_class ;
EINA_LIST_FOREACH ( _font_overlays_del , l , text_class )
{
edje_text_class_del ( text_class ) ;
eina_stringshare_del ( text_class ) ;
}
_font_overlays_del = eina_list_free ( _font_overlays_del ) ;
2010-11-18 02:01:24 -08:00
EINA_LIST_FOREACH ( _elm_config - > font_overlays , l , efd )
edje_text_class_set ( efd - > text_class , efd - > font , efd - > size ) ;
}
Eina_List *
_elm_config_text_classes_get ( void )
{
Eina_List * ret = NULL ;
int i ;
for ( i = 0 ; _elm_text_classes [ i ] . desc ; i + + )
{
Elm_Text_Class * tc ;
tc = malloc ( sizeof ( * tc ) ) ;
2012-02-20 17:39:52 -08:00
if ( ! tc ) continue ;
2010-11-18 02:01:24 -08:00
* tc = _elm_text_classes [ i ] ;
ret = eina_list_append ( ret , tc ) ;
}
return ret ;
}
void
_elm_config_text_classes_free ( Eina_List * l )
{
Elm_Text_Class * tc ;
EINA_LIST_FREE ( l , tc )
free ( tc ) ;
}
2012-03-09 05:04:00 -08:00
Eina_List *
_elm_config_color_list_get ( const char * palette_name )
{
Eina_List * plist ;
Elm_Custom_Palette * cpalette ;
EINA_LIST_FOREACH ( _elm_config - > color_palette , plist , cpalette )
{
if ( strcmp ( cpalette - > palette_name , palette_name ) )
continue ;
return cpalette - > color_list ;
}
return NULL ;
}
void
_elm_config_color_set ( const char * palette_name ,
int r ,
int g ,
int b ,
int a )
{
Eina_List * plist ;
Elm_Custom_Palette * cpalette ;
Elm_Color_RGBA * color ;
EINA_LIST_FOREACH ( _elm_config - > color_palette , plist , cpalette )
{
if ( strcmp ( cpalette - > palette_name , palette_name ) )
continue ;
color = calloc ( 1 , sizeof ( Elm_Color_RGBA ) ) ;
color - > r = r ;
color - > g = g ;
color - > b = b ;
color - > a = a ;
cpalette - > color_list = eina_list_prepend ( cpalette - > color_list ,
color ) ;
}
}
void
_elm_config_colors_free ( const char * palette_name )
{
Eina_List * plist ;
Elm_Custom_Palette * cpalette ;
Elm_Color_RGBA * color ;
EINA_LIST_FOREACH ( _elm_config - > color_palette , plist , cpalette )
{
if ( strcmp ( cpalette - > palette_name , palette_name ) )
continue ;
EINA_LIST_FREE ( cpalette - > color_list , color )
{
free ( color ) ;
}
}
}
2010-10-25 06:08:19 -07:00
Eina_List *
_elm_config_profiles_list ( void )
{
2012-03-07 12:01:17 -08:00
Eina_File_Direct_Info * info ;
2010-10-25 06:08:19 -07:00
Eina_List * flist = NULL ;
2010-10-25 10:36:07 -07:00
Eina_Iterator * file_it ;
char buf [ PATH_MAX ] ;
const char * dir ;
2010-10-25 06:08:19 -07:00
size_t len ;
2013-09-05 15:38:42 -07:00
len = _elm_config_user_dir_snprintf ( buf , sizeof ( buf ) , " config " ) ;
2010-10-25 06:08:19 -07:00
2012-03-08 01:43:33 -08:00
file_it = eina_file_stat_ls ( buf ) ;
2010-10-25 10:36:07 -07:00
if ( ! file_it )
goto sys ;
2010-10-25 06:08:19 -07:00
buf [ len ] = ' / ' ;
len + + ;
len = sizeof ( buf ) - len ;
2010-10-25 10:36:07 -07:00
EINA_ITERATOR_FOREACH ( file_it , info )
2010-10-25 06:08:19 -07:00
{
2010-11-18 02:00:41 -08:00
if ( info - > name_length > = len )
continue ;
if ( info - > type = = EINA_FILE_DIR )
{
flist =
eina_list_sorted_insert ( flist , _sort_files_cb ,
eina_stringshare_add ( info - > path +
info - > name_start ) ) ;
}
2010-10-25 06:08:19 -07:00
}
2010-10-25 10:36:07 -07:00
eina_iterator_free ( file_it ) ;
2010-11-18 02:00:41 -08:00
sys :
2010-10-25 06:08:19 -07:00
len = eina_str_join_len ( buf , sizeof ( buf ) , ' / ' , _elm_data_dir ,
strlen ( _elm_data_dir ) , " config " ,
sizeof ( " config " ) - 1 ) ;
2013-02-16 02:25:42 -08:00
file_it = eina_file_stat_ls ( buf ) ;
2010-10-25 10:36:07 -07:00
if ( ! file_it )
goto list_free ;
2010-10-25 06:08:19 -07:00
buf [ len ] = ' / ' ;
len + + ;
len = sizeof ( buf ) - len ;
2010-10-25 10:36:07 -07:00
EINA_ITERATOR_FOREACH ( file_it , info )
2010-10-25 06:08:19 -07:00
{
2010-11-18 02:00:41 -08:00
if ( info - > name_length > = len )
continue ;
2010-10-25 10:36:07 -07:00
2010-11-18 02:00:41 -08:00
switch ( info - > type )
{
case EINA_FILE_DIR :
{
const Eina_List * l ;
const char * tmp ;
EINA_LIST_FOREACH ( flist , l , tmp )
if ( ! strcmp ( info - > path + info - > name_start , tmp ) )
break ;
if ( ! l )
flist =
eina_list_sorted_insert ( flist , _sort_files_cb ,
eina_stringshare_add ( info - > path +
info - > name_start ) ) ;
}
2010-10-25 10:36:07 -07:00
break ;
2010-11-18 02:00:41 -08:00
default :
continue ;
}
2010-10-25 06:08:19 -07:00
}
2010-10-25 10:36:07 -07:00
eina_iterator_free ( file_it ) ;
elementary - fixed some logic errors patched by rajeev.r@samsung.com
Hi all,
I found few memory related issues in elementary package when performed static analysis on it.
These issues include:
Array indices getting out of bounds, freed memory address being passed to a function as parameter, memory not getting cleaned up because of earlier return statement.
Issues details:
1. In elm_widget.c inside function elm_widget_signal_callback_del(), it is possible that freed memory address esd is passed to the sd->callback_del_func(). I think it should be data, not esd.
Moreover what if the callback frees memory for data, then the other problem is that the return value is data from the function elm_widget_signal_callback_del() which in my opinion can be a problem.
2. Inside directory src/edje_externals for files elm_genlist.c, elm_notify.c, elm_list.c, elm_thumb.c and elm_map.c, array indices can go beyound bounary.
sizeof() operator for an array of character pointers will return [number of elements in the array * size of (char*)], basically 4 times the number of elements which has been taken care in assertion inside src/edje_extenarnals
while performing assertion but has been missed in the next statement in the loop condition.
3. In file src/lib/elm_config.c inside function _elm_config_profiles_list, freeing of file iterator has been missed out.
Please review the attached patch and let me know your opinion.
Thanks.
Regards,
Rajeev
SVN revision: 63550
2011-09-22 17:02:13 -07:00
return flist ;
2010-10-25 10:36:07 -07:00
2010-11-18 02:00:41 -08:00
list_free :
2010-10-25 10:36:07 -07:00
EINA_LIST_FREE ( flist , dir )
eina_stringshare_del ( dir ) ;
return NULL ;
2010-10-25 06:08:19 -07:00
}
2010-05-07 08:49:06 -07:00
static void
2010-10-25 06:08:19 -07:00
_profile_fetch_from_conf ( void )
2010-05-07 08:49:06 -07:00
{
char buf [ PATH_MAX ] , * p , * s ;
2010-10-29 10:32:16 -07:00
Eet_File * ef = NULL ;
2010-05-07 08:49:06 -07:00
int len = 0 ;
// if env var - use profile without question
s = getenv ( " ELM_PROFILE " ) ;
if ( s )
{
_elm_profile = strdup ( s ) ;
return ;
}
2010-10-25 06:08:04 -07:00
2010-10-28 13:57:44 -07:00
// user profile
2013-09-05 15:38:42 -07:00
_elm_config_user_dir_snprintf ( buf , sizeof ( buf ) , " config/profile.cfg " ) ;
2010-05-07 08:49:06 -07:00
ef = eet_open ( buf , EET_FILE_MODE_READ ) ;
if ( ef )
{
p = eet_read ( ef , " config " , & len ) ;
if ( p )
{
_elm_profile = malloc ( len + 1 ) ;
memcpy ( _elm_profile , p , len ) ;
_elm_profile [ len ] = 0 ;
free ( p ) ;
2013-09-10 16:39:59 -07:00
eet_close ( ef ) ;
return ;
2010-05-07 08:49:06 -07:00
}
eet_close ( ef ) ;
}
2010-10-25 06:08:04 -07:00
2010-05-07 08:49:06 -07:00
// system profile
2010-10-28 13:57:44 -07:00
_elm_data_dir_snprintf ( buf , sizeof ( buf ) , " config/profile.cfg " ) ;
2010-05-07 08:49:06 -07:00
ef = eet_open ( buf , EET_FILE_MODE_READ ) ;
if ( ef )
{
p = eet_read ( ef , " config " , & len ) ;
if ( p )
{
_elm_profile = malloc ( len + 1 ) ;
memcpy ( _elm_profile , p , len ) ;
_elm_profile [ len ] = 0 ;
free ( p ) ;
2013-09-10 16:39:59 -07:00
eet_close ( ef ) ;
return ;
2010-05-07 08:49:06 -07:00
}
eet_close ( ef ) ;
}
2013-09-10 16:39:59 -07:00
_elm_profile = strdup ( " default " ) ;
2010-05-07 08:49:06 -07:00
}
2010-05-08 19:19:14 -07:00
static void
2013-01-04 17:12:27 -08:00
_config_free ( Elm_Config * cfg )
2010-05-08 19:19:14 -07:00
{
2010-11-18 02:01:24 -08:00
Elm_Font_Overlay * fo ;
2010-05-08 19:19:14 -07:00
const char * fontdir ;
2012-03-09 05:04:00 -08:00
Elm_Custom_Palette * palette ;
Elm_Color_RGBA * color ;
2010-10-25 06:08:04 -07:00
2013-01-04 17:12:27 -08:00
if ( ! cfg ) return ;
EINA_LIST_FREE ( cfg - > font_dirs , fontdir )
2010-05-08 19:19:14 -07:00
{
eina_stringshare_del ( fontdir ) ;
}
2013-01-04 17:12:27 -08:00
if ( cfg - > engine ) eina_stringshare_del ( cfg - > engine ) ;
EINA_LIST_FREE ( cfg - > font_overlays , fo )
2010-11-18 02:01:24 -08:00
{
if ( fo - > text_class ) eina_stringshare_del ( fo - > text_class ) ;
if ( fo - > font ) eina_stringshare_del ( fo - > font ) ;
free ( fo ) ;
}
2013-01-04 17:12:27 -08:00
EINA_LIST_FREE ( cfg - > color_palette , palette )
2012-03-09 05:04:00 -08:00
{
if ( palette - > palette_name ) eina_stringshare_del ( palette - > palette_name ) ;
EINA_LIST_FREE ( palette - > color_list , color ) free ( color ) ;
free ( palette ) ;
}
2013-01-04 17:12:27 -08:00
if ( cfg - > theme ) eina_stringshare_del ( cfg - > theme ) ;
if ( cfg - > modules ) eina_stringshare_del ( cfg - > modules ) ;
if ( cfg - > indicator_service_0 ) eina_stringshare_del ( cfg - > indicator_service_0 ) ;
if ( cfg - > indicator_service_90 ) eina_stringshare_del ( cfg - > indicator_service_90 ) ;
if ( cfg - > indicator_service_180 ) eina_stringshare_del ( cfg - > indicator_service_180 ) ;
if ( cfg - > indicator_service_270 ) eina_stringshare_del ( cfg - > indicator_service_270 ) ;
free ( cfg ) ;
2010-05-08 19:19:14 -07:00
}
static void
_config_apply ( void )
{
2010-05-11 18:03:46 -07:00
_elm_theme_parse ( NULL , _elm_config - > theme ) ;
2010-05-08 19:19:14 -07:00
ecore_animator_frametime_set ( 1.0 / _elm_config - > fps ) ;
2010-09-22 19:55:51 -07:00
}
static void
_config_sub_apply ( void )
{
2010-05-08 19:19:14 -07:00
edje_frametime_set ( 1.0 / _elm_config - > fps ) ;
edje_scale_set ( _elm_config - > scale ) ;
2011-06-29 22:38:57 -07:00
edje_password_show_last_set ( _elm_config - > password_show_last ) ;
edje_password_show_last_timeout_set ( _elm_config - > password_show_last_timeout ) ;
2010-09-22 19:55:51 -07:00
if ( _elm_config - > modules ) _elm_module_parse ( _elm_config - > modules ) ;
2010-05-08 19:19:14 -07:00
}
2010-11-22 22:10:58 -08:00
static Eina_Bool
_elm_cache_flush_cb ( void * data __UNUSED__ )
{
2012-02-16 21:12:56 -08:00
elm_cache_all_flush ( ) ;
2010-11-22 22:10:58 -08:00
return ECORE_CALLBACK_RENEW ;
}
/* kind of abusing this call right now -- shared between all of those
* properties - - but they are not meant to be called that periodically
* anyway */
2010-11-21 22:56:06 -08:00
void
_elm_recache ( void )
{
Eina_List * l ;
Evas_Object * win ;
2012-02-16 21:12:56 -08:00
elm_cache_all_flush ( ) ;
2010-11-21 22:56:06 -08:00
EINA_LIST_FOREACH ( _elm_win_list , l , win )
{
Evas * e = evas_object_evas_get ( win ) ;
2011-02-10 22:16:23 -08:00
evas_image_cache_set ( e , _elm_config - > image_cache * 1024 ) ;
evas_font_cache_set ( e , _elm_config - > font_cache * 1024 ) ;
2010-11-22 22:10:58 -08:00
}
edje_file_cache_set ( _elm_config - > edje_cache ) ;
edje_collection_cache_set ( _elm_config - > edje_collection_cache ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( _elm_cache_flush_poller , ecore_poller_del ) ;
2011-01-24 02:21:58 -08:00
if ( _elm_config - > cache_flush_enable )
2010-11-22 22:10:58 -08:00
{
2011-01-24 02:21:58 -08:00
if ( _elm_config - > cache_flush_poll_interval > 0 )
{
_elm_cache_flush_poller =
ecore_poller_add ( ECORE_POLLER_CORE ,
_elm_config - > cache_flush_poll_interval ,
_elm_cache_flush_cb , NULL ) ;
}
2010-11-21 22:56:06 -08:00
}
}
2010-09-02 07:33:04 -07:00
static Elm_Config *
_config_user_load ( void )
2010-05-07 08:49:06 -07:00
{
2010-09-02 07:33:04 -07:00
Elm_Config * cfg = NULL ;
Eet_File * ef ;
2010-05-07 08:49:06 -07:00
char buf [ PATH_MAX ] ;
2010-09-02 07:33:04 -07:00
2013-09-05 15:38:42 -07:00
_elm_config_user_dir_snprintf ( buf , sizeof ( buf ) , " config/%s/base.cfg " ,
2010-10-28 13:57:44 -07:00
_elm_profile ) ;
2010-09-02 07:33:04 -07:00
2010-05-07 08:49:06 -07:00
ef = eet_open ( buf , EET_FILE_MODE_READ ) ;
if ( ef )
{
2010-09-02 07:33:04 -07:00
cfg = eet_data_read ( ef , _config_edd , " config " ) ;
2010-05-07 08:49:06 -07:00
eet_close ( ef ) ;
}
2010-09-02 07:33:04 -07:00
return cfg ;
}
static Elm_Config *
_config_system_load ( void )
{
Elm_Config * cfg = NULL ;
Eet_File * ef ;
char buf [ PATH_MAX ] ;
2010-10-28 13:57:44 -07:00
_elm_data_dir_snprintf ( buf , sizeof ( buf ) , " config/%s/base.cfg " ,
_elm_profile ) ;
2010-05-07 08:49:06 -07:00
ef = eet_open ( buf , EET_FILE_MODE_READ ) ;
if ( ef )
{
2010-09-02 07:33:04 -07:00
cfg = eet_data_read ( ef , _config_edd , " config " ) ;
2010-05-07 08:49:06 -07:00
eet_close ( ef ) ;
}
2010-09-02 07:33:04 -07:00
return cfg ;
}
static void
_config_load ( void )
{
_elm_config = _config_user_load ( ) ;
if ( _elm_config )
{
if ( _elm_config - > config_version < ELM_CONFIG_VERSION )
_config_update ( ) ;
2013-05-03 06:56:05 -07:00
/* set the default value if the configuration was just added and the
* value is zero which means it was not supported before and invalid . */
if ( _elm_config - > thumbscroll_min_friction = = 0.0 )
_elm_config - > thumbscroll_min_friction = 0.5 ;
if ( _elm_config - > thumbscroll_friction_standard = = 0.0 )
_elm_config - > thumbscroll_friction_standard = 1000.0 ;
2013-07-08 22:07:21 -07:00
if ( _elm_config - > thumbscroll_flick_distance_tolerance = = 0 )
_elm_config - > thumbscroll_flick_distance_tolerance = 1000 ;
2013-05-03 06:56:05 -07:00
2010-09-02 07:33:04 -07:00
return ;
}
/* no user config, fallback for system. No need to check version for
* this one , if it ' s not the right one , someone screwed up at the time
* of installing it */
_elm_config = _config_system_load ( ) ;
2010-05-07 08:49:06 -07:00
if ( _elm_config ) return ;
2010-09-02 07:33:04 -07:00
/* FIXME: config load could have failed because of a non-existent
* profile . Fallback to default before moving on */
2010-05-07 08:49:06 -07:00
// config load fail - defaults
2012-03-05 04:46:15 -08:00
// why are these here? well if they are, it means you can make a gui
// config recovery app i guess...
2010-05-07 08:49:06 -07:00
_elm_config = ELM_NEW ( Elm_Config ) ;
2010-09-02 07:33:04 -07:00
_elm_config - > config_version = ELM_CONFIG_VERSION ;
2010-11-01 14:10:07 -07:00
_elm_config - > engine = eina_stringshare_add ( " software_x11 " ) ;
2011-05-11 02:06:59 -07:00
_elm_config - > vsync = 0 ;
2010-10-21 11:26:14 -07:00
_elm_config - > thumbscroll_enable = EINA_TRUE ;
2010-10-21 12:35:12 -07:00
_elm_config - > thumbscroll_threshold = 24 ;
2013-03-07 01:13:15 -08:00
_elm_config - > thumbscroll_hold_threshold = 24 ;
2010-10-21 12:35:12 -07:00
_elm_config - > thumbscroll_momentum_threshold = 100.0 ;
2013-07-03 02:43:19 -07:00
_elm_config - > thumbscroll_flick_distance_tolerance = 1000 ;
2010-05-07 08:49:06 -07:00
_elm_config - > thumbscroll_friction = 1.0 ;
2013-04-30 06:06:28 -07:00
_elm_config - > thumbscroll_min_friction = 0.5 ;
_elm_config - > thumbscroll_friction_standard = 1000.0 ;
2010-05-07 08:49:06 -07:00
_elm_config - > thumbscroll_bounce_friction = 0.5 ;
2010-11-22 22:10:58 -08:00
_elm_config - > thumbscroll_bounce_enable = EINA_TRUE ;
2013-04-17 05:46:21 -07:00
_elm_config - > thumbscroll_acceleration_threshold = 500.0 ;
_elm_config - > thumbscroll_acceleration_time_limit = 0.7 ;
_elm_config - > thumbscroll_acceleration_weight = 1.5 ;
2010-05-07 08:49:06 -07:00
_elm_config - > page_scroll_friction = 0.5 ;
_elm_config - > bring_in_scroll_friction = 0.5 ;
_elm_config - > zoom_friction = 0.5 ;
2010-11-22 22:10:58 -08:00
_elm_config - > thumbscroll_border_friction = 0.5 ;
2011-10-13 05:07:39 -07:00
_elm_config - > thumbscroll_sensitivity_friction = 0.25 ; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time
2013-04-30 00:46:59 -07:00
_elm_config - > scroll_smooth_start_enable = EINA_FALSE ;
2012-07-05 18:59:57 -07:00
_elm_config - > scroll_smooth_time_interval = 0.008 ;
2011-06-09 03:14:16 -07:00
_elm_config - > scroll_smooth_amount = 1.0 ;
_elm_config - > scroll_smooth_history_weight = 0.3 ;
2011-06-10 01:05:39 -07:00
_elm_config - > scroll_smooth_future_time = 0.0 ;
_elm_config - > scroll_smooth_time_window = 0.2 ;
2010-05-07 08:49:06 -07:00
_elm_config - > scale = 1.0 ;
_elm_config - > bgpixmap = 0 ;
2010-11-22 22:10:58 -08:00
_elm_config - > compositing = 1 ;
2010-05-07 08:49:06 -07:00
_elm_config - > font_hinting = 2 ;
2010-11-22 22:10:58 -08:00
_elm_config - > cache_flush_poll_interval = 512 ;
2010-12-24 08:02:30 -08:00
_elm_config - > cache_flush_enable = EINA_TRUE ;
2010-05-07 08:49:06 -07:00
_elm_config - > font_dirs = NULL ;
_elm_config - > image_cache = 4096 ;
_elm_config - > font_cache = 512 ;
2010-11-22 22:10:58 -08:00
_elm_config - > edje_cache = 32 ;
_elm_config - > edje_collection_cache = 64 ;
2010-05-07 08:49:06 -07:00
_elm_config - > finger_size = 40 ;
_elm_config - > fps = 60.0 ;
_elm_config - > theme = eina_stringshare_add ( " default " ) ;
_elm_config - > modules = NULL ;
2010-09-10 17:52:33 -07:00
_elm_config - > tooltip_delay = 1.0 ;
2010-10-21 11:26:14 -07:00
_elm_config - > cursor_engine_only = EINA_TRUE ;
_elm_config - > focus_highlight_enable = EINA_FALSE ;
_elm_config - > focus_highlight_animate = EINA_TRUE ;
_elm_config - > toolbar_shrink_mode = 2 ;
_elm_config - > fileselector_expand_enable = EINA_FALSE ;
2013-09-30 08:49:50 -07:00
_elm_config - > fileselector_double_tap_navigation_enable = EINA_FALSE ;
2010-10-21 11:26:14 -07:00
_elm_config - > inwin_dialogs_enable = EINA_FALSE ;
_elm_config - > icon_size = 32 ;
2010-11-24 09:11:34 -08:00
_elm_config - > longpress_timeout = 1.0 ;
2011-01-31 00:18:58 -08:00
_elm_config - > effect_enable = EINA_TRUE ;
2011-04-01 06:20:40 -07:00
_elm_config - > desktop_entry = EINA_FALSE ;
_elm_config - > is_mirrored = EINA_FALSE ; /* Read sys value in env_get() */
2011-06-29 22:38:57 -07:00
_elm_config - > password_show_last = EINA_FALSE ;
_elm_config - > password_show_last_timeout = 2.0 ;
2011-12-21 00:48:29 -08:00
_elm_config - > glayer_zoom_finger_enable = EINA_TRUE ;
2011-07-17 23:24:34 -07:00
_elm_config - > glayer_zoom_finger_factor = 1.0 ;
_elm_config - > glayer_zoom_wheel_factor = 0.05 ;
2013-01-02 10:16:03 -08:00
_elm_config - > glayer_zoom_distance_tolerance = 1.0 ; /* 1 times elm_config_finger_size_get() */
2011-12-21 00:48:29 -08:00
_elm_config - > glayer_rotate_finger_enable = EINA_TRUE ;
2011-12-21 00:48:08 -08:00
_elm_config - > glayer_rotate_angular_tolerance = 2.0 ; /* 2 DEG */
2013-01-02 10:16:03 -08:00
_elm_config - > glayer_line_min_length = 1.0 ; /* 1 times elm_config_finger_size_get() */
_elm_config - > glayer_line_distance_tolerance = 3.0 ; /* 3 times elm_config_finger_size_get() */
2011-12-21 00:48:08 -08:00
_elm_config - > glayer_line_angular_tolerance = 20.0 ; /* 20 DEG */
2011-11-09 07:10:13 -08:00
_elm_config - > glayer_flick_time_limit_ms = 120 ; /* ms to finish flick */
2011-08-01 06:09:05 -07:00
_elm_config - > glayer_long_tap_start_timeout = 1.2 ; /* 1.2 second to start long-tap */
2012-05-21 00:51:41 -07:00
_elm_config - > glayer_double_tap_timeout = 0.25 ; /* 0.25 seconds between 2 mouse downs of a tap. */
2011-09-08 03:10:34 -07:00
_elm_config - > glayer_continues_enable = EINA_TRUE ; /* Continue gestures default */
2012-06-29 23:01:25 -07:00
_elm_config - > access_mode = ELM_ACCESS_MODE_OFF ;
2012-11-29 00:58:49 -08:00
_elm_config - > selection_clear_enable = EINA_FALSE ;
2012-03-07 04:03:13 -08:00
_elm_config - > week_start = 1 ; /* monday */
_elm_config - > weekend_start = 6 ; /* saturday */
2012-03-06 20:57:03 -08:00
_elm_config - > weekend_len = 2 ;
2012-04-01 23:20:01 -07:00
_elm_config - > year_min = 2 ;
_elm_config - > year_max = 137 ;
2012-07-05 02:23:38 -07:00
_elm_config - > softcursor_mode = 0 ; /* 0 = auto, 1 = on, 2 = off */
2012-03-09 05:04:00 -08:00
_elm_config - > color_palette = NULL ;
2012-08-28 03:37:02 -07:00
_elm_config - > auto_norender_withdrawn = 0 ;
_elm_config - > auto_norender_iconified_same_as_withdrawn = 1 ;
_elm_config - > auto_flush_withdrawn = 0 ;
_elm_config - > auto_dump_withdrawn = 0 ;
_elm_config - > auto_throttle = 0 ;
_elm_config - > auto_throttle_amount = 0.1 ;
2012-09-12 07:08:26 -07:00
_elm_config - > indicator_service_0 = eina_stringshare_add ( " elm_indicator_portrait " ) ;
_elm_config - > indicator_service_90 = eina_stringshare_add ( " elm_indicator_landscape " ) ;
_elm_config - > indicator_service_180 = eina_stringshare_add ( " elm_indicator_portrait " ) ;
_elm_config - > indicator_service_270 = eina_stringshare_add ( " elm_indicator_landscape " ) ;
2013-01-22 10:51:24 -08:00
_elm_config - > disable_external_menu = EINA_FALSE ;
2013-06-07 01:17:30 -07:00
_elm_config - > magnifier_enable = EINA_TRUE ;
_elm_config - > magnifier_scale = 1.5 ;
2010-05-07 08:49:06 -07:00
}
2010-10-28 13:57:44 -07:00
static const char *
2010-12-06 04:46:16 -08:00
_elm_config_eet_close_error_get ( Eet_File * ef ,
char * file )
2010-10-28 13:57:44 -07:00
{
Eet_Error err ;
2010-10-29 06:04:05 -07:00
const char * erstr = NULL ;
2010-10-28 13:57:44 -07:00
err = eet_close ( ef ) ;
switch ( err )
{
case EET_ERROR_WRITE_ERROR :
2010-12-06 04:46:16 -08:00
erstr = " An error occurred while saving Elementary's "
" settings to disk. The error could not be "
" deterimined. The file where the error occurred was: "
" %s. This file has been deleted to avoid corrupt data. " ;
break ;
2010-10-28 13:57:44 -07:00
case EET_ERROR_WRITE_ERROR_FILE_TOO_BIG :
2010-12-06 04:46:16 -08:00
erstr = " Elementary's settings files are too big "
" for the file system they are being saved to. "
" This error is very strange as the files should "
" be extremely small. Please check the settings "
" for your home directory. "
" The file where the error occurred was: %s . "
" This file has been deleted to avoid corrupt data. " ;
break ;
2010-10-28 13:57:44 -07:00
case EET_ERROR_WRITE_ERROR_IO_ERROR :
2010-12-06 04:46:16 -08:00
erstr = " An output error occurred when writing the settings "
" files for Elementary. Your disk is having troubles "
" and possibly needs replacement. "
" The file where the error occurred was: %s . "
" This file has been deleted to avoid corrupt data. " ;
break ;
2010-10-28 13:57:44 -07:00
case EET_ERROR_WRITE_ERROR_OUT_OF_SPACE :
2010-12-06 04:46:16 -08:00
erstr = " Elementary cannot write its settings file "
" because it ran out of space to write the file. "
" You have either run out of disk space or have "
" gone over your quota limit. "
" The file where the error occurred was: %s . "
" This file has been deleted to avoid corrupt data. " ;
break ;
2010-10-28 13:57:44 -07:00
case EET_ERROR_WRITE_ERROR_FILE_CLOSED :
2010-12-06 04:46:16 -08:00
erstr = " Elementary unexpectedly had the settings file "
" it was writing closed on it. This is very unusual. "
" The file where the error occurred was: %s "
" This file has been deleted to avoid corrupt data. " ;
break ;
2010-10-28 13:57:44 -07:00
default :
2010-12-06 04:46:16 -08:00
break ;
2010-10-28 13:57:44 -07:00
}
if ( erstr )
{
2010-12-06 04:46:16 -08:00
/* delete any partially-written file */
ecore_file_unlink ( file ) ;
return strdup ( erstr ) ;
2010-10-28 13:57:44 -07:00
}
return NULL ;
}
static Eina_Bool
_elm_config_profile_save ( void )
{
char buf [ 4096 ] , buf2 [ 4096 ] ;
int ok = 0 , ret ;
const char * err ;
Eet_File * ef ;
size_t len ;
2013-09-05 15:38:42 -07:00
len = _elm_config_user_dir_snprintf ( buf , sizeof ( buf ) , " config/profile.cfg " ) ;
2010-10-28 13:57:44 -07:00
if ( len + 1 > = sizeof ( buf ) )
return EINA_FALSE ;
2013-09-05 15:38:42 -07:00
len = _elm_config_user_dir_snprintf ( buf2 , sizeof ( buf2 ) ,
" config/profile.cfg.tmp " ) ;
2010-10-28 13:57:44 -07:00
if ( len + 1 > = sizeof ( buf2 ) )
return EINA_FALSE ;
ef = eet_open ( buf2 , EET_FILE_MODE_WRITE ) ;
if ( ! ef )
return EINA_FALSE ;
ok = eet_write ( ef , " config " , _elm_profile , strlen ( _elm_profile ) , 0 ) ;
if ( ! ok )
goto err ;
err = _elm_config_eet_close_error_get ( ef , buf2 ) ;
if ( err )
{
2010-12-06 04:46:16 -08:00
ERR ( " %s " , err ) ;
free ( ( void * ) err ) ;
goto err ;
2010-10-28 13:57:44 -07:00
}
ret = ecore_file_mv ( buf2 , buf ) ;
if ( ! ret )
{
2012-05-08 23:22:09 -07:00
ERR ( " Error saving Elementary's configuration profile file " ) ;
2010-12-06 04:46:16 -08:00
goto err ;
2010-10-28 13:57:44 -07:00
}
ecore_file_unlink ( buf2 ) ;
return EINA_TRUE ;
2010-12-06 04:46:16 -08:00
err :
2010-10-28 13:57:44 -07:00
ecore_file_unlink ( buf2 ) ;
return EINA_FALSE ;
}
Eina_Bool
_elm_config_save ( void )
{
char buf [ 4096 ] , buf2 [ 4096 ] ;
int ok = 0 , ret ;
const char * err ;
Eet_File * ef ;
size_t len ;
2013-09-05 15:38:42 -07:00
len = _elm_config_user_dir_snprintf ( buf , sizeof ( buf ) , " config/%s " ,
_elm_profile ) ;
2010-10-28 13:57:44 -07:00
if ( len + 1 > = sizeof ( buf ) )
return EINA_FALSE ;
ok = ecore_file_mkpath ( buf ) ;
if ( ! ok )
{
2012-03-04 18:33:49 -08:00
ERR ( " Problem accessing Elementary's user configuration directory: %s " ,
2010-12-06 04:46:16 -08:00
buf ) ;
return EINA_FALSE ;
2010-10-28 13:57:44 -07:00
}
2010-10-29 10:32:16 -07:00
if ( ! _elm_config_profile_save ( ) )
return EINA_FALSE ;
2010-10-28 13:57:44 -07:00
buf [ len ] = ' / ' ;
len + + ;
if ( len + sizeof ( " base.cfg " ) > = sizeof ( buf ) - len )
return EINA_FALSE ;
memcpy ( buf + len , " base.cfg " , sizeof ( " base.cfg " ) ) ;
len + = sizeof ( " base.cfg " ) - 1 ;
if ( len + sizeof ( " .tmp " ) > = sizeof ( buf ) )
return EINA_FALSE ;
memcpy ( buf2 , buf , len ) ;
memcpy ( buf2 + len , " .tmp " , sizeof ( " .tmp " ) ) ;
ef = eet_open ( buf2 , EET_FILE_MODE_WRITE ) ;
if ( ! ef )
return EINA_FALSE ;
ok = eet_data_write ( ef , _config_edd , " config " , _elm_config , 1 ) ;
if ( ! ok )
goto err ;
err = _elm_config_eet_close_error_get ( ef , buf2 ) ;
if ( err )
{
2010-12-06 04:46:16 -08:00
ERR ( " %s " , err ) ;
free ( ( void * ) err ) ;
goto err ;
2010-10-28 13:57:44 -07:00
}
ret = ecore_file_mv ( buf2 , buf ) ;
if ( ! ret )
{
2010-12-06 04:46:16 -08:00
ERR ( " Error saving Elementary's configuration file " ) ;
goto err ;
2010-10-28 13:57:44 -07:00
}
ecore_file_unlink ( buf2 ) ;
return EINA_TRUE ;
2010-12-06 04:46:16 -08:00
err :
2010-10-28 13:57:44 -07:00
ecore_file_unlink ( buf2 ) ;
return EINA_FALSE ;
}
2010-09-02 07:33:04 -07:00
static void
_config_update ( void )
{
Elm_Config * tcfg ;
2013-01-04 17:12:27 -08:00
const char * s = NULL ;
2010-09-02 07:33:04 -07:00
tcfg = _config_system_load ( ) ;
if ( ! tcfg )
{
/* weird profile or something? We should probably fill
* with hardcoded defaults , or get from default previx */
2012-11-30 08:52:13 -08:00
return ;
2010-09-02 07:33:04 -07:00
}
2010-12-06 04:46:16 -08:00
# define IFCFG(v) if ((_elm_config->config_version & 0xffff) < (v)) {
2010-09-02 07:33:04 -07:00
# define IFCFGELSE } else {
2010-12-06 04:46:16 -08:00
# define IFCFGEND }
2012-03-29 04:09:45 -07:00
# define COPYVAL(x) do {_elm_config->x = tcfg->x; } while (0)
# define COPYPTR(x) do {_elm_config->x = tcfg->x; tcfg->x = NULL; } while (0)
2010-09-02 07:33:04 -07:00
# define COPYSTR(x) COPYPTR(x)
2010-12-06 04:46:16 -08:00
/* we also need to update for property changes in the root window
* if needed , but that will be dependent on new properties added
* with each version */
2010-09-02 07:33:04 -07:00
2010-12-06 04:46:16 -08:00
IFCFG ( 0x0003 ) ;
COPYVAL ( longpress_timeout ) ;
IFCFGEND ;
2010-09-02 07:33:04 -07:00
2012-11-30 08:52:13 -08:00
IFCFG ( 0x0004 ) ;
# define PREFS_IFACE_MODULE_STR "prefs>prefs_iface"
if ( ! _elm_config - > modules )
2013-01-04 17:12:27 -08:00
s = eina_stringshare_add ( PREFS_IFACE_MODULE_STR ) ;
2012-11-30 08:52:13 -08:00
else
{
if ( ! strstr ( _elm_config - > modules , PREFS_IFACE_MODULE_STR ) )
2013-01-04 17:12:27 -08:00
s = eina_stringshare_printf
( " %s:%s " , _elm_config - > modules , PREFS_IFACE_MODULE_STR ) ;
2012-11-30 08:52:13 -08:00
}
2013-01-04 17:12:27 -08:00
if ( s )
2012-11-30 08:52:13 -08:00
{
2013-01-04 17:12:27 -08:00
if ( _elm_config - > modules ) eina_stringshare_del ( _elm_config - > modules ) ;
_elm_config - > modules = s ;
2012-11-30 08:52:13 -08:00
}
IFCFGEND ;
2010-09-02 07:33:04 -07:00
# undef COPYSTR
# undef COPYPTR
# undef COPYVAL
# undef IFCFGEND
# undef IFCFGELSE
# undef IFCFG
2013-01-04 17:12:27 -08:00
_elm_config - > config_version = ELM_CONFIG_VERSION ;
/* after updating user config, we must save */
_config_free ( tcfg ) ;
_elm_config_save ( ) ;
2010-09-02 07:33:04 -07:00
}
2010-05-07 08:49:06 -07:00
static void
2010-05-08 19:19:14 -07:00
_env_get ( void )
2010-05-07 08:49:06 -07:00
{
2010-05-27 02:01:41 -07:00
char * s ;
2010-12-06 04:46:10 -08:00
double friction ;
2010-10-25 06:08:04 -07:00
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_ENGINE " ) ;
if ( s )
{
if ( ( ! strcasecmp ( s , " x11 " ) ) | |
( ! strcasecmp ( s , " x " ) ) | |
( ! strcasecmp ( s , " software-x11 " ) ) | |
( ! strcasecmp ( s , " software_x11 " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_X11 ) ;
2010-09-28 15:43:48 -07:00
else if ( ( ! strcasecmp ( s , " opengl " ) ) | |
( ! strcasecmp ( s , " gl " ) ) | |
( ! strcasecmp ( s , " opengl-x11 " ) ) | |
( ! strcasecmp ( s , " opengl_x11 " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_OPENGL_X11 ) ;
2010-09-28 15:43:48 -07:00
else if ( ( ! strcasecmp ( s , " x11-8 " ) ) | |
2011-05-15 19:26:16 -07:00
( ! strcasecmp ( s , " x8 " ) ) | |
2010-09-28 15:43:48 -07:00
( ! strcasecmp ( s , " software-8-x11 " ) ) | |
( ! strcasecmp ( s , " software_8_x11 " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_8_X11 ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " x11-16 " ) ) | |
( ! strcasecmp ( s , " x16 " ) ) | |
( ! strcasecmp ( s , " software-16-x11 " ) ) | |
( ! strcasecmp ( s , " software_16_x11 " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_16_X11 ) ;
2011-05-19 17:43:05 -07:00
/*
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " xrender " ) ) | |
( ! strcasecmp ( s , " xr " ) ) | |
( ! strcasecmp ( s , " xrender-x11 " ) ) | |
( ! strcasecmp ( s , " xrender_x11 " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_XRENDER_X11 ) ;
2011-05-15 19:26:16 -07:00
*/
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " fb " ) ) | |
( ! strcasecmp ( s , " software-fb " ) ) | |
( ! strcasecmp ( s , " software_fb " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_FB ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " directfb " ) ) | |
( ! strcasecmp ( s , " dfb " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_DIRECTFB ) ;
2011-11-05 10:50:09 -07:00
else if ( ( ! strcasecmp ( s , " psl1ght " ) ) )
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_PSL1GHT ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " sdl " ) ) | |
( ! strcasecmp ( s , " software-sdl " ) ) | |
( ! strcasecmp ( s , " software_sdl " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_SDL ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " sdl-16 " ) ) | |
( ! strcasecmp ( s , " software-16-sdl " ) ) | |
( ! strcasecmp ( s , " software_16_sdl " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_16_SDL ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " opengl-sdl " ) ) | |
( ! strcasecmp ( s , " opengl_sdl " ) ) | |
( ! strcasecmp ( s , " gl-sdl " ) ) | |
( ! strcasecmp ( s , " gl_sdl " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_OPENGL_SDL ) ;
2011-11-02 12:26:29 -07:00
else if ( ( ! strcasecmp ( s , " opengl-cocoa " ) ) | |
( ! strcasecmp ( s , " opengl_cocoa " ) ) | |
( ! strcasecmp ( s , " gl-cocoa " ) ) | |
( ! strcasecmp ( s , " gl_cocoa " ) ) )
eina_stringshare_replace ( & _elm_config - > engine , ELM_OPENGL_COCOA ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " gdi " ) ) | |
( ! strcasecmp ( s , " software-gdi " ) ) | |
( ! strcasecmp ( s , " software_gdi " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_WIN32 ) ;
2010-05-07 08:49:06 -07:00
else if ( ( ! strcasecmp ( s , " wince-gdi " ) ) | |
( ! strcasecmp ( s , " software-16-wince-gdi " ) ) | |
( ! strcasecmp ( s , " software_16_wince_gdi " ) ) )
2010-11-01 14:10:07 -07:00
eina_stringshare_replace ( & _elm_config - > engine , ELM_SOFTWARE_16_WINCE ) ;
2011-07-25 05:02:52 -07:00
else if ( ! strcasecmp ( s , " buffer " ) )
eina_stringshare_replace ( & _elm_config - > engine , ELM_BUFFER ) ;
2011-05-04 03:09:59 -07:00
else if ( ( ! strncmp ( s , " shot: " , 5 ) ) )
eina_stringshare_replace ( & _elm_config - > engine , s ) ;
2011-10-05 15:18:22 -07:00
else if ( ( ! strcasecmp ( s , " ews " ) ) )
eina_stringshare_replace ( & _elm_config - > engine , ELM_EWS ) ;
2012-01-02 17:45:22 -08:00
else if ( ( ! strcasecmp ( s , " wayland_shm " ) ) )
eina_stringshare_replace ( & _elm_config - > engine , ELM_WAYLAND_SHM ) ;
2012-01-12 01:10:27 -08:00
else if ( ( ! strcasecmp ( s , " wayland_egl " ) ) )
eina_stringshare_replace ( & _elm_config - > engine , ELM_WAYLAND_EGL ) ;
2012-01-25 09:15:43 -08:00
else
ERR ( " Unknown engine '%s'. " , s ) ;
2010-05-07 08:49:06 -07:00
}
2011-05-13 09:55:24 -07:00
2011-05-11 02:06:59 -07:00
s = getenv ( " ELM_VSYNC " ) ;
if ( s ) _elm_config - > vsync = ! ! atoi ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_THUMBSCROLL_ENABLE " ) ;
2010-10-21 11:26:14 -07:00
if ( s ) _elm_config - > thumbscroll_enable = ! ! atoi ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_THUMBSCROLL_THRESHOLD " ) ;
2010-10-21 12:35:12 -07:00
if ( s ) _elm_config - > thumbscroll_threshold = atoi ( s ) ;
2013-03-07 01:13:15 -08:00
s = getenv ( " ELM_THUMBSCROLL_HOLD_THRESHOLD " ) ;
if ( s ) _elm_config - > thumbscroll_hold_threshold = atoi ( s ) ;
2010-05-07 08:49:06 -07:00
// FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
s = getenv ( " ELM_THUMBSCROLL_MOMENTUM_THRESHOLD " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > thumbscroll_momentum_threshold = _elm_atof ( s ) ;
2013-07-03 02:43:19 -07:00
s = getenv ( " ELM_THUMBSCROLL_FLICK_DISTANCE_TOLERANCE " ) ;
if ( s ) _elm_config - > thumbscroll_flick_distance_tolerance = atoi ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_THUMBSCROLL_FRICTION " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > thumbscroll_friction = _elm_atof ( s ) ;
2013-04-30 06:06:28 -07:00
s = getenv ( " ELM_THUMBSCROLL_MIN_FRICTION " ) ;
if ( s ) _elm_config - > thumbscroll_min_friction = _elm_atof ( s ) ;
s = getenv ( " ELM_THUMBSCROLL_FRICTION_STANDARD " ) ;
if ( s ) _elm_config - > thumbscroll_friction_standard = _elm_atof ( s ) ;
2010-12-06 04:46:10 -08:00
s = getenv ( " ELM_THUMBSCROLL_BOUNCE_ENABLE " ) ;
if ( s ) _elm_config - > thumbscroll_bounce_enable = ! ! atoi ( s ) ;
s = getenv ( " ELM_THUMBSCROLL_BOUNCE_FRICTION " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > thumbscroll_bounce_friction = _elm_atof ( s ) ;
2013-04-17 05:46:21 -07:00
s = getenv ( " ELM_THUMBSCROLL_ACCELERATION_THRESHOLD " ) ;
if ( s ) _elm_config - > thumbscroll_acceleration_threshold = _elm_atof ( s ) ;
s = getenv ( " ELM_THUMBSCROLL_ACCELERATION_TIME_LIMIT " ) ;
if ( s ) _elm_config - > thumbscroll_acceleration_time_limit = _elm_atof ( s ) ;
s = getenv ( " ELM_THUMBSCROLL_ACCELERATION_WEIGHT " ) ;
if ( s ) _elm_config - > thumbscroll_acceleration_weight = _elm_atof ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_PAGE_SCROLL_FRICTION " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > page_scroll_friction = _elm_atof ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_BRING_IN_SCROLL_FRICTION " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > bring_in_scroll_friction = _elm_atof ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_ZOOM_FRICTION " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > zoom_friction = _elm_atof ( s ) ;
2010-11-05 02:31:51 -07:00
s = getenv ( " ELM_THUMBSCROLL_BORDER_FRICTION " ) ;
2010-12-06 04:46:10 -08:00
if ( s )
{
2012-04-25 20:32:18 -07:00
friction = _elm_atof ( s ) ;
2010-12-06 04:46:10 -08:00
if ( friction < 0.0 )
friction = 0.0 ;
2010-05-07 08:49:06 -07:00
2010-12-06 04:46:10 -08:00
if ( friction > 1.0 )
friction = 1.0 ;
_elm_config - > thumbscroll_border_friction = friction ;
}
2011-10-13 05:07:39 -07:00
s = getenv ( " ELM_THUMBSCROLL_SENSITIVITY_FRICTION " ) ;
if ( s )
{
2012-04-25 20:32:18 -07:00
friction = _elm_atof ( s ) ;
2011-10-13 05:07:39 -07:00
if ( friction < 0.1 )
friction = 0.1 ;
if ( friction > 1.0 )
friction = 1.0 ;
_elm_config - > thumbscroll_sensitivity_friction = friction ;
}
2013-04-30 00:46:59 -07:00
s = getenv ( " ELM_SCROLL_SMOOTH_START_ENABLE " ) ;
if ( s ) _elm_config - > scroll_smooth_start_enable = ! ! atoi ( s ) ;
2012-07-05 18:59:57 -07:00
s = getenv ( " ELM_SCROLL_SMOOTH_TIME_INTERVAL " ) ;
if ( s ) _elm_config - > scroll_smooth_time_interval = atof ( s ) ;
2011-06-09 03:14:16 -07:00
s = getenv ( " ELM_SCROLL_SMOOTH_AMOUNT " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > scroll_smooth_amount = _elm_atof ( s ) ;
2011-06-09 03:14:16 -07:00
s = getenv ( " ELM_SCROLL_SMOOTH_HISTORY_WEIGHT " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > scroll_smooth_history_weight = _elm_atof ( s ) ;
2011-06-09 03:14:16 -07:00
s = getenv ( " ELM_SCROLL_SMOOTH_FUTURE_TIME " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > scroll_smooth_future_time = _elm_atof ( s ) ;
2011-06-09 22:07:21 -07:00
s = getenv ( " ELM_SCROLL_SMOOTH_TIME_WINDOW " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > scroll_smooth_time_window = _elm_atof ( s ) ;
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_THEME " ) ;
if ( s ) eina_stringshare_replace ( & _elm_config - > theme , s ) ;
s = getenv ( " ELM_FONT_HINTING " ) ;
if ( s )
{
2010-12-06 04:46:16 -08:00
if ( ! strcasecmp ( s , " none " ) ) _elm_config - > font_hinting = 0 ;
else if ( ! strcasecmp ( s , " auto " ) )
_elm_config - > font_hinting = 1 ;
else if ( ! strcasecmp ( s , " bytecode " ) )
_elm_config - > font_hinting = 2 ;
2010-05-07 08:49:06 -07:00
}
s = getenv ( " ELM_FONT_PATH " ) ;
if ( s )
{
2010-10-25 06:08:04 -07:00
const char * p , * pp ;
char * buf2 ;
2010-05-07 08:49:06 -07:00
EINA_LIST_FREE ( _elm_config - > font_dirs , p )
{
eina_stringshare_del ( p ) ;
}
2010-10-25 06:08:04 -07:00
buf2 = alloca ( strlen ( s ) + 1 ) ;
p = s ;
pp = p ;
2010-12-06 04:46:16 -08:00
for ( ; ; )
2010-10-25 06:08:04 -07:00
{
if ( ( * p = = ' : ' ) | | ( * p = = 0 ) )
{
int len ;
len = p - pp ;
strncpy ( buf2 , pp , len ) ;
buf2 [ len ] = 0 ;
_elm_config - > font_dirs =
eina_list_append ( _elm_config - > font_dirs ,
2010-05-07 08:49:06 -07:00
eina_stringshare_add ( buf2 ) ) ;
2010-10-25 06:08:04 -07:00
if ( * p = = 0 ) break ;
p + + ;
pp = p ;
}
else
{
if ( * p = = 0 ) break ;
p + + ;
}
}
2010-05-07 08:49:06 -07:00
}
s = getenv ( " ELM_IMAGE_CACHE " ) ;
if ( s ) _elm_config - > image_cache = atoi ( s ) ;
s = getenv ( " ELM_FONT_CACHE " ) ;
if ( s ) _elm_config - > font_cache = atoi ( s ) ;
s = getenv ( " ELM_SCALE " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > scale = _elm_atof ( s ) ;
2010-10-25 06:08:04 -07:00
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_FINGER_SIZE " ) ;
if ( s ) _elm_config - > finger_size = atoi ( s ) ;
2011-06-29 22:38:57 -07:00
s = getenv ( " ELM_PASSWORD_SHOW_LAST " ) ;
if ( s ) _elm_config - > password_show_last = ! ! atoi ( s ) ;
s = getenv ( " ELM_PASSWORD_SHOW_LAST_TIMEOUT " ) ;
if ( s )
{
2012-04-25 20:32:18 -07:00
double pw_show_last_timeout = _elm_atof ( s ) ;
2011-06-29 22:38:57 -07:00
if ( pw_show_last_timeout > = 0.0 )
_elm_config - > password_show_last_timeout = pw_show_last_timeout ;
}
2010-05-07 08:49:06 -07:00
s = getenv ( " ELM_FPS " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > fps = _elm_atof ( s ) ;
2010-05-07 08:49:06 -07:00
if ( _elm_config - > fps < 1.0 ) _elm_config - > fps = 1.0 ;
s = getenv ( " ELM_MODULES " ) ;
if ( s ) eina_stringshare_replace ( & _elm_config - > modules , s ) ;
2010-09-10 17:52:33 -07:00
s = getenv ( " ELM_TOOLTIP_DELAY " ) ;
if ( s )
{
2012-04-25 20:32:18 -07:00
double delay = _elm_atof ( s ) ;
2010-09-10 17:52:33 -07:00
if ( delay > = 0.0 )
_elm_config - > tooltip_delay = delay ;
}
2010-09-25 15:04:51 -07:00
s = getenv ( " ELM_CURSOR_ENGINE_ONLY " ) ;
2010-10-21 11:26:14 -07:00
if ( s ) _elm_config - > cursor_engine_only = ! ! atoi ( s ) ;
2010-10-04 09:55:32 -07:00
s = getenv ( " ELM_FOCUS_HIGHLIGHT_ENABLE " ) ;
2010-10-21 11:26:14 -07:00
if ( s ) _elm_config - > focus_highlight_enable = ! ! atoi ( s ) ;
2010-10-04 09:55:32 -07:00
s = getenv ( " ELM_FOCUS_HIGHLIGHT_ANIMATE " ) ;
2010-10-21 11:26:14 -07:00
if ( s ) _elm_config - > focus_highlight_animate = ! ! atoi ( s ) ;
s = getenv ( " ELM_TOOLBAR_SHRINK_MODE " ) ;
if ( s ) _elm_config - > toolbar_shrink_mode = atoi ( s ) ;
s = getenv ( " ELM_FILESELECTOR_EXPAND_ENABLE " ) ;
if ( s ) _elm_config - > fileselector_expand_enable = ! ! atoi ( s ) ;
2013-09-30 08:49:50 -07:00
s = getenv ( " ELM_FILESELECTOR_DOUBLE_TAP_NAVIGATION_ENABLE " ) ;
if ( s ) _elm_config - > fileselector_double_tap_navigation_enable = ! ! atoi ( s ) ;
2010-10-21 11:26:14 -07:00
s = getenv ( " ELM_INWIN_DIALOGS_ENABLE " ) ;
if ( s ) _elm_config - > inwin_dialogs_enable = ! ! atoi ( s ) ;
s = getenv ( " ELM_ICON_SIZE " ) ;
if ( s ) _elm_config - > icon_size = atoi ( s ) ;
2010-12-06 04:46:16 -08:00
2010-11-24 09:11:34 -08:00
s = getenv ( " ELM_LONGPRESS_TIMEOUT " ) ;
2012-04-25 20:32:18 -07:00
if ( s ) _elm_config - > longpress_timeout = _elm_atof ( s ) ;
2010-12-06 04:46:10 -08:00
if ( _elm_config - > longpress_timeout < 0.0 )
2010-12-06 04:46:16 -08:00
_elm_config - > longpress_timeout = 0.0 ;
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
2011-01-31 00:18:58 -08:00
s = getenv ( " ELM_EFFECT_ENABLE " ) ;
if ( s ) _elm_config - > effect_enable = ! ! atoi ( s ) ;
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
2011-04-01 06:20:40 -07:00
s = getenv ( " ELM_DESKTOP_ENTRY " ) ;
if ( s ) _elm_config - > desktop_entry = ! ! atoi ( s ) ;
2011-08-19 07:39:27 -07:00
s = getenv ( " ELM_ACCESS_MODE " ) ;
if ( s ) _elm_config - > access_mode = ELM_ACCESS_MODE_ON ;
2012-08-28 03:37:02 -07:00
2012-11-29 00:58:49 -08:00
s = getenv ( " ELM_SELECTION_CLEAR_ENABLE " ) ;
if ( s ) _elm_config - > selection_clear_enable = ! ! atoi ( s ) ;
2012-08-28 03:37:02 -07:00
s = getenv ( " ELM_AUTO_THROTTLE " ) ;
if ( s ) _elm_config - > auto_throttle = EINA_TRUE ;
s = getenv ( " ELM_AUTO_THROTTLE_AMOUNT " ) ;
if ( s ) _elm_config - > auto_throttle_amount = _elm_atof ( s ) ;
s = getenv ( " ELM_AUTO_NORENDER_WITHDRAWN " ) ;
if ( s ) _elm_config - > auto_norender_withdrawn = EINA_TRUE ;
s = getenv ( " ELM_AUTO_NORENDER_ICONIFIED_SAME_AS_WITHDRAWN " ) ;
if ( s ) _elm_config - > auto_norender_iconified_same_as_withdrawn = EINA_TRUE ;
s = getenv ( " ELM_AUTO_FLUSH_WITHDRAWN " ) ;
if ( s ) _elm_config - > auto_flush_withdrawn = EINA_TRUE ;
s = getenv ( " ELM_AUTO_DUMP_WIDTHDRAWN " ) ;
if ( s ) _elm_config - > auto_dump_withdrawn = EINA_TRUE ;
2012-09-12 07:08:26 -07:00
s = getenv ( " ELM_INDICATOR_SERVICE_0 " ) ;
if ( s ) eina_stringshare_replace ( & _elm_config - > indicator_service_0 , s ) ;
s = getenv ( " ELM_INDICATOR_SERVICE_90 " ) ;
if ( s ) eina_stringshare_replace ( & _elm_config - > indicator_service_90 , s ) ;
s = getenv ( " ELM_INDICATOR_SERVICE_180 " ) ;
if ( s ) eina_stringshare_replace ( & _elm_config - > indicator_service_180 , s ) ;
s = getenv ( " ELM_INDICATOR_SERVICE_270 " ) ;
if ( s ) eina_stringshare_replace ( & _elm_config - > indicator_service_270 , s ) ;
2013-01-22 10:51:24 -08:00
s = getenv ( " ELM_DISABLE_EXTERNAL_MENU " ) ;
if ( s ) _elm_config - > disable_external_menu = ! ! atoi ( s ) ;
2013-05-20 05:03:43 -07:00
s = getenv ( " ELM_CLOUSEAU " ) ;
if ( s ) _elm_config - > clouseau_enable = atoi ( s ) ;
2013-06-07 01:17:30 -07:00
s = getenv ( " ELM_MAGNIFIER_ENABLE " ) ;
if ( s ) _elm_config - > magnifier_enable = ! ! atoi ( s ) ;
s = getenv ( " ELM_MAGNIFIER_SCALE " ) ;
if ( s ) _elm_config - > magnifier_scale = _elm_atof ( s ) ;
2010-05-07 08:49:06 -07:00
}
2011-02-03 07:52:49 -08:00
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_mirrored_get ( void )
2011-02-03 07:52:49 -08:00
{
return _elm_config - > is_mirrored ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_mirrored_set ( Eina_Bool mirrored )
2011-02-03 07:52:49 -08:00
{
2012-06-01 02:55:44 -07:00
mirrored = ! ! mirrored ;
if ( _elm_config - > is_mirrored = = mirrored ) return ;
2011-02-03 07:52:49 -08:00
_elm_config - > is_mirrored = mirrored ;
2011-02-09 08:13:58 -08:00
_elm_rescale ( ) ;
2011-02-03 07:52:49 -08:00
}
2012-03-06 01:23:43 -08:00
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_cursor_engine_only_get ( void )
2012-03-06 01:23:43 -08:00
{
return _elm_config - > cursor_engine_only ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cursor_engine_only_set ( Eina_Bool engine_only )
2012-03-06 01:23:43 -08:00
{
engine_only = ! ! engine_only ;
_elm_config - > cursor_engine_only = engine_only ;
}
2012-03-06 04:04:25 -08:00
EAPI double
elm_config_tooltip_delay_get ( void )
2012-03-06 01:23:43 -08:00
{
return _elm_config - > tooltip_delay ;
}
2012-03-06 04:04:25 -08:00
EAPI void
elm_config_tooltip_delay_set ( double delay )
2012-03-06 01:23:43 -08:00
{
if ( delay < 0.0 ) return ;
_elm_config - > tooltip_delay = delay ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scale_get ( void )
2012-03-06 01:23:43 -08:00
{
return _elm_config - > scale ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scale_set ( double scale )
2012-03-06 01:23:43 -08:00
{
2012-10-10 02:26:29 -07:00
if ( scale < 0.0 ) return ;
2012-03-06 01:23:43 -08:00
if ( _elm_config - > scale = = scale ) return ;
_elm_config - > scale = scale ;
_elm_rescale ( ) ;
}
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_password_show_last_get ( void )
2012-03-06 01:23:43 -08:00
{
return _elm_config - > password_show_last ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_password_show_last_set ( Eina_Bool password_show_last )
2012-03-06 01:23:43 -08:00
{
if ( _elm_config - > password_show_last = = password_show_last ) return ;
_elm_config - > password_show_last = password_show_last ;
edje_password_show_last_set ( _elm_config - > password_show_last ) ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_password_show_last_timeout_get ( void )
2012-03-06 01:23:43 -08:00
{
return _elm_config - > password_show_last_timeout ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_password_show_last_timeout_set ( double password_show_last_timeout )
2012-03-06 01:23:43 -08:00
{
2012-10-10 02:26:29 -07:00
if ( password_show_last_timeout < 0.0 ) return ;
2012-03-06 01:23:43 -08:00
if ( _elm_config - > password_show_last_timeout = = password_show_last_timeout ) return ;
_elm_config - > password_show_last_timeout = password_show_last_timeout ;
edje_password_show_last_timeout_set ( _elm_config - > password_show_last_timeout ) ;
}
2012-03-06 01:49:24 -08:00
EAPI Eina_Bool
elm_config_save ( void )
{
return _elm_config_save ( ) ;
}
EAPI void
elm_config_reload ( void )
{
_elm_config_reload ( ) ;
}
EAPI const char *
2012-03-06 04:04:25 -08:00
elm_config_profile_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config_current_profile_get ( ) ;
}
EAPI const char *
2012-03-06 04:04:25 -08:00
elm_config_profile_dir_get ( const char * profile ,
2012-03-06 01:49:24 -08:00
Eina_Bool is_user )
{
return _elm_config_profile_dir_get ( profile , is_user ) ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_profile_dir_free ( const char * p_dir )
2012-03-06 01:49:24 -08:00
{
free ( ( void * ) p_dir ) ;
}
EAPI Eina_List *
2012-03-06 04:04:25 -08:00
elm_config_profile_list_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config_profiles_list ( ) ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_profile_list_free ( Eina_List * l )
2012-03-06 01:49:24 -08:00
{
const char * dir ;
EINA_LIST_FREE ( l , dir )
eina_stringshare_del ( dir ) ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_profile_set ( const char * profile )
2012-03-06 01:49:24 -08:00
{
EINA_SAFETY_ON_NULL_RETURN ( profile ) ;
_elm_config_profile_set ( profile ) ;
}
EAPI const char *
2012-03-06 04:04:25 -08:00
elm_config_engine_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > engine ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_engine_set ( const char * engine )
2012-03-06 01:49:24 -08:00
{
EINA_SAFETY_ON_NULL_RETURN ( engine ) ;
_elm_config_engine_set ( engine ) ;
}
EAPI Eina_List *
2012-03-06 04:04:25 -08:00
elm_config_text_classes_list_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config_text_classes_get ( ) ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_text_classes_list_free ( Eina_List * list )
2012-03-06 01:49:24 -08:00
{
_elm_config_text_classes_free ( list ) ;
}
EAPI const Eina_List *
2012-03-06 04:04:25 -08:00
elm_config_font_overlay_list_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config_font_overlays_list ( ) ;
}
2012-06-29 23:01:25 -07:00
EAPI Eina_Bool
elm_config_access_get ( void )
{
return _elm_config_access_get ( ) ;
}
EAPI void
elm_config_access_set ( Eina_Bool is_access )
{
_elm_config_access_set ( is_access ) ;
}
2012-11-29 00:58:49 -08:00
EAPI Eina_Bool
elm_config_selection_unfocused_clear_get ( void )
{
return _elm_config_selection_unfocused_clear_get ( ) ;
}
EAPI void
elm_config_selection_unfocused_clear_set ( Eina_Bool enabled )
{
_elm_config_selection_unfocused_clear_set ( enabled ) ;
}
2012-03-06 01:49:24 -08:00
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_font_overlay_set ( const char * text_class ,
2012-03-06 01:49:24 -08:00
const char * font ,
Evas_Font_Size size )
{
EINA_SAFETY_ON_NULL_RETURN ( text_class ) ;
_elm_config_font_overlay_set ( text_class , font , size ) ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_font_overlay_unset ( const char * text_class )
2012-03-06 01:49:24 -08:00
{
EINA_SAFETY_ON_NULL_RETURN ( text_class ) ;
_elm_config_font_overlay_remove ( text_class ) ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_font_overlay_apply ( void )
2012-03-06 01:49:24 -08:00
{
_elm_config_font_overlay_apply ( ) ;
2012-06-14 03:55:16 -07:00
_elm_rescale ( ) ;
2012-03-06 01:49:24 -08:00
}
EAPI Evas_Coord
2012-03-06 04:04:25 -08:00
elm_config_finger_size_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > finger_size ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_finger_size_set ( Evas_Coord size )
2012-03-06 01:49:24 -08:00
{
2012-10-10 02:26:29 -07:00
if ( size < 0 ) return ;
2012-03-06 01:49:24 -08:00
if ( _elm_config - > finger_size = = size ) return ;
_elm_config - > finger_size = size ;
_elm_rescale ( ) ;
}
EAPI int
2012-03-06 04:04:25 -08:00
elm_config_cache_flush_interval_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > cache_flush_poll_interval ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cache_flush_interval_set ( int size )
2012-03-06 01:49:24 -08:00
{
2012-05-23 22:43:48 -07:00
EINA_SAFETY_ON_FALSE_RETURN ( size > 0 ) ;
2012-03-06 01:49:24 -08:00
if ( _elm_config - > cache_flush_poll_interval = = size ) return ;
_elm_config - > cache_flush_poll_interval = size ;
_elm_recache ( ) ;
}
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_cache_flush_enabled_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > cache_flush_enable ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cache_flush_enabled_set ( Eina_Bool enabled )
2012-03-06 01:49:24 -08:00
{
enabled = ! ! enabled ;
if ( _elm_config - > cache_flush_enable = = enabled ) return ;
_elm_config - > cache_flush_enable = enabled ;
_elm_recache ( ) ;
}
EAPI int
2012-03-06 04:04:25 -08:00
elm_config_cache_font_cache_size_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > font_cache ;
}
2012-03-28 02:02:22 -07:00
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cache_font_cache_size_set ( int size )
2012-03-06 01:49:24 -08:00
{
2012-10-10 02:26:29 -07:00
if ( size < 0 ) return ;
2012-03-06 01:49:24 -08:00
if ( _elm_config - > font_cache = = size ) return ;
_elm_config - > font_cache = size ;
_elm_recache ( ) ;
}
EAPI int
2012-03-06 04:04:25 -08:00
elm_config_cache_image_cache_size_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > image_cache ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cache_image_cache_size_set ( int size )
2012-03-06 01:49:24 -08:00
{
2012-10-10 02:26:29 -07:00
if ( size < 0 ) return ;
2012-03-06 01:49:24 -08:00
if ( _elm_config - > image_cache = = size ) return ;
_elm_config - > image_cache = size ;
_elm_recache ( ) ;
}
EAPI int
2012-03-06 04:04:25 -08:00
elm_config_cache_edje_file_cache_size_get ( )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > edje_cache ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cache_edje_file_cache_size_set ( int size )
2012-03-06 01:49:24 -08:00
{
2012-10-10 02:26:29 -07:00
if ( size < 0 ) return ;
2012-03-06 01:49:24 -08:00
if ( _elm_config - > edje_cache = = size ) return ;
_elm_config - > edje_cache = size ;
_elm_recache ( ) ;
}
EAPI int
2012-03-06 04:04:25 -08:00
elm_config_cache_edje_collection_cache_size_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > edje_collection_cache ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_cache_edje_collection_cache_size_set ( int size )
2012-03-06 01:49:24 -08:00
{
if ( _elm_config - > edje_collection_cache = = size ) return ;
_elm_config - > edje_collection_cache = size ;
_elm_recache ( ) ;
}
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_focus_highlight_enabled_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > focus_highlight_enable ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_focus_highlight_enabled_set ( Eina_Bool enable )
2012-03-06 01:49:24 -08:00
{
_elm_config - > focus_highlight_enable = ! ! enable ;
}
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_focus_highlight_animate_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > focus_highlight_animate ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_focus_highlight_animate_set ( Eina_Bool animate )
2012-03-06 01:49:24 -08:00
{
_elm_config - > focus_highlight_animate = ! ! animate ;
}
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_scroll_bounce_enabled_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_bounce_enable ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_bounce_enabled_set ( Eina_Bool enabled )
2012-03-06 01:49:24 -08:00
{
_elm_config - > thumbscroll_bounce_enable = enabled ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_bounce_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_bounce_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_bounce_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
_elm_config - > thumbscroll_bounce_friction = friction ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_page_scroll_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > page_scroll_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_page_scroll_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
_elm_config - > page_scroll_friction = friction ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_bring_in_scroll_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > bring_in_scroll_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_bring_in_scroll_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
_elm_config - > bring_in_scroll_friction = friction ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_zoom_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > zoom_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_zoom_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
_elm_config - > zoom_friction = friction ;
}
EAPI Eina_Bool
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_enabled_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_enable ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_enabled_set ( Eina_Bool enabled )
2012-03-06 01:49:24 -08:00
{
_elm_config - > thumbscroll_enable = enabled ;
}
EAPI unsigned int
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_threshold_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_threshold ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_threshold_set ( unsigned int threshold )
2012-03-06 01:49:24 -08:00
{
_elm_config - > thumbscroll_threshold = threshold ;
}
2013-03-07 01:13:15 -08:00
EAPI unsigned int
elm_config_scroll_thumbscroll_hold_threshold_get ( void )
{
return _elm_config - > thumbscroll_hold_threshold ;
}
EAPI void
elm_config_scroll_thumbscroll_hold_threshold_set ( unsigned int threshold )
{
_elm_config - > thumbscroll_hold_threshold = threshold ;
}
2012-03-06 01:49:24 -08:00
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_momentum_threshold_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_momentum_threshold ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_momentum_threshold_set ( double threshold )
2012-03-06 01:49:24 -08:00
{
_elm_config - > thumbscroll_momentum_threshold = threshold ;
}
2013-07-03 02:43:19 -07:00
EAPI unsigned int
elm_config_scroll_thumbscroll_flick_distance_tolerance_get ( void )
{
return _elm_config - > thumbscroll_flick_distance_tolerance ;
}
EAPI void
elm_config_scroll_thumbscroll_flick_distance_tolerance_set ( unsigned int distance )
{
_elm_config - > thumbscroll_flick_distance_tolerance = distance ;
}
2012-03-06 01:49:24 -08:00
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
_elm_config - > thumbscroll_friction = friction ;
}
2013-04-30 06:06:28 -07:00
EAPI double
elm_config_scroll_thumbscroll_min_friction_get ( void )
{
return _elm_config - > thumbscroll_min_friction ;
}
EAPI void
elm_config_scroll_thumbscroll_min_friction_set ( double friction )
{
_elm_config - > thumbscroll_min_friction = friction ;
}
EAPI double
elm_config_scroll_thumbscroll_friction_standard_get ( void )
{
return _elm_config - > thumbscroll_friction_standard ;
}
EAPI void
elm_config_scroll_thumbscroll_friction_standard_set ( double standard )
{
_elm_config - > thumbscroll_friction_standard = standard ;
}
2012-03-06 01:49:24 -08:00
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_border_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_border_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_border_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
if ( friction < 0.0 ) friction = 0.0 ;
if ( friction > 1.0 ) friction = 1.0 ;
2012-03-15 01:48:38 -07:00
_elm_config - > thumbscroll_border_friction = friction ;
2012-03-06 01:49:24 -08:00
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_sensitivity_friction_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > thumbscroll_sensitivity_friction ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_scroll_thumbscroll_sensitivity_friction_set ( double friction )
2012-03-06 01:49:24 -08:00
{
if ( friction < 0.1 ) friction = 0.1 ;
if ( friction > 1.0 ) friction = 1.0 ;
2012-03-15 01:48:38 -07:00
_elm_config - > thumbscroll_sensitivity_friction = friction ;
2012-03-06 01:49:24 -08:00
}
2013-04-17 05:46:21 -07:00
EAPI double
elm_config_scroll_thumbscroll_acceleration_threshold_get ( void )
{
return _elm_config - > thumbscroll_acceleration_threshold ;
}
EAPI void
elm_config_scroll_thumbscroll_acceleration_threshold_set ( double threshold )
{
_elm_config - > thumbscroll_acceleration_threshold = threshold ;
}
EAPI double
elm_config_scroll_thumbscroll_acceleration_time_limit_get ( void )
{
return _elm_config - > thumbscroll_acceleration_time_limit ;
}
EAPI void
elm_config_scroll_thumbscroll_acceleration_time_limit_set ( double time_limit )
{
_elm_config - > thumbscroll_acceleration_time_limit = time_limit ;
}
EAPI double
elm_config_scroll_thumbscroll_acceleration_weight_get ( void )
{
return _elm_config - > thumbscroll_acceleration_weight ;
}
EAPI void
elm_config_scroll_thumbscroll_acceleration_weight_set ( double weight )
{
_elm_config - > thumbscroll_acceleration_weight = weight ;
}
2012-03-06 01:49:24 -08:00
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_longpress_timeout_set ( double longpress_timeout )
2012-03-06 01:49:24 -08:00
{
_elm_config - > longpress_timeout = longpress_timeout ;
}
EAPI double
2012-03-06 04:04:25 -08:00
elm_config_longpress_timeout_get ( void )
2012-03-06 01:49:24 -08:00
{
return _elm_config - > longpress_timeout ;
}
2012-07-05 02:23:38 -07:00
EAPI void
elm_config_softcursor_mode_set ( Elm_Softcursor_Mode mode )
{
_elm_config - > softcursor_mode = mode ;
}
EAPI Elm_Softcursor_Mode
elm_config_softcursor_mode_get ( void )
{
return _elm_config - > softcursor_mode ;
}
2012-12-27 05:38:33 -08:00
EAPI Eina_Bool
2013-01-22 10:51:24 -08:00
elm_config_disable_external_menu_get ( void )
2012-12-27 05:38:33 -08:00
{
2013-01-22 10:51:24 -08:00
return _elm_config - > disable_external_menu ;
2012-12-27 05:38:33 -08:00
}
EAPI void
2013-01-22 10:51:24 -08:00
elm_config_disable_external_menu_set ( Eina_Bool disable )
2012-12-27 05:38:33 -08:00
{
2013-01-22 10:51:24 -08:00
_elm_config - > disable_external_menu = ! ! disable ;
2012-12-27 05:38:33 -08:00
}
2013-05-20 05:03:43 -07:00
EAPI Eina_Bool
2013-05-20 09:36:34 -07:00
elm_config_clouseau_enabled_get ( void )
2013-05-20 05:03:43 -07:00
{
return _elm_config - > clouseau_enable ;
}
EAPI void
2013-05-20 09:36:34 -07:00
elm_config_clouseau_enabled_set ( Eina_Bool enable )
2013-05-20 05:03:43 -07:00
{
_elm_config - > clouseau_enable = ! ! enable ;
_elm_clouseau_reload ( ) ;
}
2013-05-28 03:05:52 -07:00
EAPI double
elm_config_glayer_long_tap_start_timeout_get ( void )
{
return _elm_config - > glayer_long_tap_start_timeout ;
}
EAPI void
elm_config_glayer_long_tap_start_timeout_set ( double long_tap_timeout )
{
_elm_config - > glayer_long_tap_start_timeout = long_tap_timeout ;
}
EAPI double
elm_config_glayer_double_tap_timeout_get ( void )
{
return _elm_config - > glayer_double_tap_timeout ;
}
EAPI void
elm_config_glayer_double_tap_timeout_set ( double double_tap_timeout )
{
_elm_config - > glayer_double_tap_timeout = double_tap_timeout ;
}
2013-06-07 01:17:30 -07:00
EAPI Eina_Bool
elm_config_magnifier_enable_get ( void )
{
return _elm_config - > magnifier_enable ;
}
EAPI void
elm_config_magnifier_enable_set ( Eina_Bool enable )
{
_elm_config - > magnifier_enable = ! ! enable ;
}
EAPI double
elm_config_magnifier_scale_get ( void )
{
return _elm_config - > magnifier_scale ;
}
EAPI void
elm_config_magnifier_scale_set ( double scale )
{
_elm_config - > magnifier_scale = scale ;
}
2012-02-15 01:09:21 -08:00
EAPI void
elm_config_all_flush ( void )
{
# ifdef HAVE_ELEMENTARY_X
2013-06-27 01:28:46 -07:00
_prop_config_set ( ) ;
ecore_x_window_prop_string_set ( _root_1st , _atom [ ATOM_E_PROFILE ] ,
_elm_profile ) ;
2012-02-15 01:09:21 -08:00
# endif
}
2011-09-18 00:53:41 -07:00
static void
_translation_init ( )
{
# ifdef ENABLE_NLS
const char * cur_dom = textdomain ( NULL ) ;
const char * trans_comment = gettext ( " " ) ;
const char * msg_locale = setlocale ( LC_MESSAGES , NULL ) ;
/* Same concept as what glib does:
* We shouldn ' t translate if there are no translations for the
* application in the current locale + domain . ( Unless locale is
* en_ / C where translating only parts of the interface make some
* sense ) .
*/
_elm_config - > translate = ! ( strcmp ( cur_dom , " messages " ) & &
! * trans_comment & & strncmp ( msg_locale , " en_ " , 3 ) & &
strcmp ( msg_locale , " C " ) ) ;
2012-05-13 04:24:28 -07:00
/* Get RTL orientation from system */
if ( _elm_config - > translate )
{
bindtextdomain ( PACKAGE , LOCALE_DIR ) ;
_elm_config - > is_mirrored = ! strcmp ( E_ ( " default:LTR " ) , " default:RTL " ) ;
}
2011-09-18 00:53:41 -07:00
# endif
}
2010-05-07 08:49:06 -07:00
void
_elm_config_init ( void )
{
2011-10-19 05:46:56 -07:00
if ( ! ELM_EVENT_CONFIG_ALL_CHANGED )
ELM_EVENT_CONFIG_ALL_CHANGED = ecore_event_type_new ( ) ;
2010-05-07 08:49:06 -07:00
_desc_init ( ) ;
2010-10-25 06:08:19 -07:00
_profile_fetch_from_conf ( ) ;
2010-05-07 08:49:06 -07:00
_config_load ( ) ;
2012-03-08 13:15:35 -08:00
_env_get ( ) ;
2013-05-29 04:49:54 -07:00
ELM_SAFE_FREE ( _elm_preferred_engine , eina_stringshare_del ) ;
2011-09-18 00:53:41 -07:00
_translation_init ( ) ;
2010-05-08 19:19:14 -07:00
_config_apply ( ) ;
2010-11-18 02:01:24 -08:00
_elm_config_font_overlay_apply ( ) ;
2010-11-22 22:10:58 -08:00
_elm_recache ( ) ;
2013-05-20 05:03:43 -07:00
_elm_clouseau_reload ( ) ;
2010-05-07 08:49:06 -07:00
}
2011-09-28 19:00:20 -07:00
void
_elm_config_sub_shutdown ( void )
{
2013-03-19 03:42:34 -07:00
# ifdef HAVE_ELEMENTARY_X
2013-05-29 04:49:54 -07:00
ELM_SAFE_FREE ( _prop_change_delay_timer , ecore_timer_del ) ;
2013-03-19 03:42:34 -07:00
# endif
2011-09-28 19:00:20 -07:00
# define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
if ( ENGINE_COMPARE ( ELM_SOFTWARE_X11 ) | |
ENGINE_COMPARE ( ELM_SOFTWARE_16_X11 ) | |
ENGINE_COMPARE ( ELM_XRENDER_X11 ) | |
2011-11-02 12:26:29 -07:00
ENGINE_COMPARE ( ELM_OPENGL_X11 ) | |
ENGINE_COMPARE ( ELM_OPENGL_COCOA ) )
2011-09-28 19:00:20 -07:00
# undef ENGINE_COMPARE
{
# ifdef HAVE_ELEMENTARY_X
2012-05-02 01:29:11 -07:00
ecore_x_shutdown ( ) ;
2011-09-28 19:00:20 -07:00
# endif
}
}
2010-05-07 08:49:06 -07:00
void
_elm_config_sub_init ( void )
{
2010-11-01 14:10:07 -07:00
# define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2010-12-06 04:46:16 -08:00
if ( ENGINE_COMPARE ( ELM_SOFTWARE_X11 ) | |
ENGINE_COMPARE ( ELM_SOFTWARE_16_X11 ) | |
ENGINE_COMPARE ( ELM_XRENDER_X11 ) | |
2011-11-02 12:26:29 -07:00
ENGINE_COMPARE ( ELM_OPENGL_X11 ) | |
ENGINE_COMPARE ( ELM_OPENGL_COCOA ) )
2010-11-01 14:10:07 -07:00
# undef ENGINE_COMPARE
2010-05-07 08:49:06 -07:00
{
# ifdef HAVE_ELEMENTARY_X
2012-07-05 02:23:38 -07:00
if ( ecore_x_init ( NULL ) )
2010-10-25 06:08:04 -07:00
{
2012-07-05 02:23:38 -07:00
_root_1st = ecore_x_window_root_first_get ( ) ;
2013-09-30 03:21:31 -07:00
2012-07-05 02:23:38 -07:00
if ( ! ecore_x_screen_is_composited ( 0 ) )
_elm_config - > compositing = 0 ;
2013-09-30 03:21:31 -07:00
2012-07-05 02:23:38 -07:00
ecore_x_atoms_get ( _atom_names , ATOM_COUNT , _atom ) ;
ecore_x_event_mask_set ( _root_1st ,
ECORE_X_EVENT_MASK_WINDOW_PROPERTY ) ;
_prop_change_handler = ecore_event_handler_add
( ECORE_X_EVENT_WINDOW_PROPERTY , _prop_change , NULL ) ;
if ( ! getenv ( " ELM_PROFILE " ) )
2010-10-25 06:08:04 -07:00
{
2012-07-05 02:23:38 -07:00
char * s ;
2013-09-30 03:21:31 -07:00
2012-07-05 02:23:38 -07:00
s = ecore_x_window_prop_string_get ( _root_1st ,
_atom [ ATOM_E_PROFILE ] ) ;
if ( s )
2010-05-08 19:19:14 -07:00
{
2012-07-05 02:23:38 -07:00
int changed = 0 ;
2013-09-30 03:21:31 -07:00
2012-07-05 02:23:38 -07:00
if ( _elm_profile )
{
if ( strcmp ( _elm_profile , s ) ) changed = 1 ;
free ( _elm_profile ) ;
}
_elm_profile = s ;
if ( changed ) _prop_config_get ( ) ;
2010-05-08 19:19:14 -07:00
}
2010-10-25 06:08:04 -07:00
}
}
2012-07-05 02:23:38 -07:00
else
ERR ( " Cannot connect to X11 display. check $DISPLAY variable " ) ;
2010-05-07 08:49:06 -07:00
# endif
2010-10-25 06:08:04 -07:00
}
2010-09-22 19:55:51 -07:00
_config_sub_apply ( ) ;
2010-05-07 08:49:06 -07:00
}
2010-10-28 13:57:44 -07:00
void
_elm_config_reload ( void )
{
2013-01-04 17:12:27 -08:00
_config_free ( _elm_config ) ;
_elm_config = NULL ;
2010-12-06 04:46:16 -08:00
_config_load ( ) ;
_config_apply ( ) ;
_elm_config_font_overlay_apply ( ) ;
_elm_rescale ( ) ;
_elm_recache ( ) ;
2013-05-20 05:03:43 -07:00
_elm_clouseau_reload ( ) ;
2012-05-09 03:46:14 -07:00
ecore_event_add ( ELM_EVENT_CONFIG_ALL_CHANGED , NULL , NULL , NULL ) ;
2010-10-28 13:57:44 -07:00
}
2010-11-01 14:10:14 -07:00
void
_elm_config_engine_set ( const char * engine )
{
2010-12-06 04:46:16 -08:00
if ( _elm_config - > engine & & strcmp ( _elm_config - > engine , engine ) )
eina_stringshare_del ( _elm_config - > engine ) ;
2010-11-01 14:10:14 -07:00
2010-12-06 04:46:16 -08:00
_elm_config - > engine = eina_stringshare_add ( engine ) ;
2010-11-01 14:10:14 -07:00
}
2012-02-29 04:45:58 -08:00
EAPI const char *
2012-03-06 04:04:25 -08:00
elm_config_preferred_engine_get ( void )
2012-02-29 04:45:58 -08:00
{
return _elm_preferred_engine ;
}
EAPI void
2012-03-06 04:04:25 -08:00
elm_config_preferred_engine_set ( const char * engine )
2012-02-29 04:45:58 -08:00
{
2012-03-06 04:04:25 -08:00
if ( engine )
eina_stringshare_replace ( & ( _elm_preferred_engine ) , engine ) ;
else
{
2013-05-29 04:49:54 -07:00
ELM_SAFE_FREE ( _elm_preferred_engine , eina_stringshare_del ) ;
2012-03-06 04:04:25 -08:00
}
2012-02-29 04:45:58 -08:00
}
2012-09-12 07:08:26 -07:00
EAPI const char *
2012-11-15 02:43:26 -08:00
elm_config_indicator_service_get ( int rotation )
2012-09-12 07:08:26 -07:00
{
2012-11-15 02:43:26 -08:00
switch ( rotation )
{
case 0 :
return _elm_config - > indicator_service_0 ;
case 90 :
return _elm_config - > indicator_service_90 ;
case 180 :
return _elm_config - > indicator_service_180 ;
case 270 :
return _elm_config - > indicator_service_270 ;
default :
return NULL ;
}
2012-09-12 07:08:26 -07:00
}
2010-10-25 06:08:19 -07:00
void
_elm_config_profile_set ( const char * profile )
{
2010-12-06 04:46:16 -08:00
if ( _elm_profile )
{
2013-09-03 18:09:37 -07:00
if ( ! strcmp ( _elm_profile , profile ) )
return ;
2010-12-06 04:46:16 -08:00
free ( _elm_profile ) ;
}
_elm_profile = strdup ( profile ) ;
2013-09-03 18:09:37 -07:00
_config_free ( _elm_config ) ;
_elm_config = NULL ;
_config_load ( ) ;
_config_apply ( ) ;
_elm_config_font_overlay_apply ( ) ;
_elm_rescale ( ) ;
_elm_recache ( ) ;
_elm_clouseau_reload ( ) ;
2010-10-25 06:08:19 -07:00
}
2010-05-07 08:49:06 -07:00
void
_elm_config_shutdown ( void )
{
2010-11-01 14:10:07 -07:00
# define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2010-12-06 04:46:16 -08:00
if ( ENGINE_COMPARE ( ELM_SOFTWARE_X11 ) | |
ENGINE_COMPARE ( ELM_SOFTWARE_16_X11 ) | |
ENGINE_COMPARE ( ELM_XRENDER_X11 ) | |
ENGINE_COMPARE ( ELM_OPENGL_X11 ) )
2010-11-01 14:10:07 -07:00
# undef ENGINE_COMPARE
2010-05-07 08:49:06 -07:00
{
# ifdef HAVE_ELEMENTARY_X
2010-10-25 06:08:04 -07:00
ecore_event_handler_del ( _prop_change_handler ) ;
_prop_change_handler = NULL ;
2010-05-07 08:49:06 -07:00
# endif
}
2013-05-29 04:49:54 -07:00
ELM_SAFE_FREE ( _elm_config , _config_free ) ;
ELM_SAFE_FREE ( _elm_preferred_engine , eina_stringshare_del ) ;
ELM_SAFE_FREE ( _elm_profile , free ) ;
2012-11-01 00:30:41 -07:00
2013-05-13 04:18:24 -07:00
# ifdef HAVE_ELEMENTARY_X
2012-11-01 00:30:41 -07:00
_elm_font_overlays_del_free ( ) ;
2013-05-13 04:18:24 -07:00
# endif
2010-05-07 08:49:06 -07:00
_desc_shutdown ( ) ;
}
2010-12-06 04:46:16 -08:00