Add cursor engine only usage to elm config

Only use engine cursors by default



SVN revision: 52762
This commit is contained in:
Bruno Dilly 2010-09-25 22:04:51 +00:00
parent 3dd29a961c
commit b7ae7c772a
8 changed files with 59 additions and 2 deletions

View File

@ -21,4 +21,5 @@ group "Elm_Config" struct {
value "theme" string: "default";
value "modules" string: "";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" int: 1;
}

View File

@ -21,4 +21,5 @@ group "Elm_Config" struct {
value "theme" string: "default";
value "modules" string: "";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" int: 1;
}

View File

@ -21,4 +21,5 @@ group "Elm_Config" struct {
value "theme" string: "default";
value "modules" string: "";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" int: 1;
}

View File

@ -181,11 +181,24 @@ test_cursor3(void *data, Evas_Object *obj, void *event_info)
o = elm_button_add(win);
elm_object_cursor_set(o, "hand4");
elm_object_cursor_engine_only_set(o, EINA_FALSE);
elm_button_label_set(o, "not existent");
elm_box_pack_end(bx, o);
evas_object_show(o);
elm_cursor_engine_only_set(0);
o = elm_button_add(win);
elm_object_cursor_set(o, "hand2");
elm_button_label_set(o, "hand 2 engine only config false");
elm_box_pack_end(bx, o);
evas_object_show(o);
elm_cursor_engine_only_set(1);
o = elm_button_add(win);
elm_object_cursor_set(o, "hand2");
elm_button_label_set(o, "hand 2 engine only config true");
elm_box_pack_end(bx, o);
evas_object_show(o);
o = elm_list_add(win);
elm_box_pack_end(bx, o);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

View File

@ -1075,6 +1075,8 @@ extern "C" {
EAPI const char *elm_object_cursor_style_get(const Evas_Object *obj);
EAPI void elm_object_cursor_engine_only_set(Evas_Object *obj, Eina_Bool engine_only);
EAPI Eina_Bool elm_object_cursor_engine_only_get(const Evas_Object *obj);
EAPI int elm_cursor_engine_only_get(void);
EAPI Eina_Bool elm_cursor_engine_only_set(int engine_only);
typedef struct _Elm_Menu_Item Elm_Menu_Item; /**< Item of Elm_Menu. Sub-type of Elm_Widget_Item */
EAPI Evas_Object *elm_menu_add(Evas_Object *parent);

View File

@ -225,6 +225,7 @@ _desc_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "theme", theme, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "modules", modules, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "tooltip_delay", tooltip_delay, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "cursor_engine_only", cursor_engine_only, EET_T_INT);
}
static void
@ -411,6 +412,7 @@ _config_load(void)
_elm_config->theme = eina_stringshare_add("default");
_elm_config->modules = NULL;
_elm_config->tooltip_delay = 1.0;
_elm_config->cursor_engine_only = 1;
}
static void
@ -603,6 +605,9 @@ _env_get(void)
if (delay >= 0.0)
_elm_config->tooltip_delay = delay;
}
s = getenv("ELM_CURSOR_ENGINE_ONLY");
if (s) _elm_config->cursor_engine_only = atoi(s);
}
void

View File

@ -91,6 +91,7 @@ struct _Elm_Config
const char *theme;
const char *modules;
double tooltip_delay;
int cursor_engine_only;
};
struct _Elm_Module

View File

@ -303,7 +303,7 @@ elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char
cur->owner = owner;
cur->eventarea = eventarea;
cur->engine_only = EINA_TRUE;
cur->engine_only = _elm_config->cursor_engine_only;
cur->visible = EINA_FALSE;
cur->cursor_name = eina_stringshare_add(cursor);
@ -532,3 +532,36 @@ elm_object_cursor_engine_only_get(const Evas_Object *obj)
ELM_CURSOR_GET_OR_RETURN(cur, obj, EINA_FALSE);
return cur->engine_only;
}
/**
* Get the configured cursor engine only usage
*
* This gets the globally configured exclusive usage of engine cursors.
*
* @return 1 if only engine cursors should be used
* @ingroup Cursors
*/
EAPI int
elm_cursor_engine_only_get(void)
{
return _elm_config->cursor_engine_only;
}
/**
* Set the configured cursor engine only usage
*
* This sets the globally configured exclusive usage of engine cursors.
* It won't affect cursors set before changing this value.
*
* @param engine_only If 1 only engine cursors will be enabled, if 0 will
* look for them on theme before.
* @return EINA_TRUE if value is valid and setted (0 or 1)
* @ingroup Cursors
*/
EAPI Eina_Bool
elm_cursor_engine_only_set(int engine_only)
{
if ((engine_only < 0) || (engine_only > 1)) return EINA_FALSE;
_elm_config->cursor_engine_only = engine_only;
return EINA_TRUE;
}