}
static void
-_engine_use(void *data,
- Evas_Object *obj EINA_UNUSED,
- void *event_info EINA_UNUSED)
-{
- Evas_Object *li;
- const char *selection;
-
- li = data;
- selection = elm_object_item_data_get(elm_list_selected_item_get(li));
-
- if (!strcmp(elm_config_engine_get(), selection))
- return;
-
- elm_config_engine_set(selection);
- elm_config_all_flush();
- elm_config_save(); /* make sure new engine has its data dir */
-}
-
-static void
_profile_use(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
}
static void
-_engines_list_item_del_cb(void *data,
- Evas_Object *obj EINA_UNUSED,
- void *event_info EINA_UNUSED)
-{
- free(data);
-}
-
-static void
_profiles_list_item_del_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
elm_naviframe_item_simple_push(naviframe, sc);
}
-static char *
-_engine_name_prettify(const char *engine)
+static void
+_cb_accel(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED)
{
- char *ret, *ptr;
-
- ret = strdup(engine);
- ret[0] -= 0x20;
-
- while ((ptr = strpbrk(ret, "_")))
- {
- *ptr = ' ';
- }
+ const char *val = data;
+ const char *ss = elm_config_accel_preference_get();
- return ret;
-}
-
-/* FIXME! ideally, we would trim elm_config.c's _elm_engines list at
- build time, making a getter for is as in ecore-evas. */
-static Eina_Bool
-_elm_engine_supported(const char *engine)
-{
- const char *engines[] = {
- "software_x11",
- "fb",
- "directfb",
- "software_16_x11",
- "software_8_x11",
- "xrender_x11",
- "opengl_x11",
- "software_gdi",
- "sdl",
- "software_16_sdl",
- "opengl_sdl",
- "ews",
- "opengl_cocoa",
- "psl1ght",
- "wayland_shm",
- "wayland_egl",
- NULL
- };
-
- unsigned int i;
-
- for (i = 0; engines[i]; i++)
+ if ((!ss) || (ss && (strcasecmp(ss, val))))
{
-#define ENGINE_COMPARE(name) (!strcmp(engines[i], name))
- if (ENGINE_COMPARE(engine))
- return EINA_TRUE;
-#undef ENGINE_COMPARE
+ elm_config_accel_preference_set(val);
+ elm_config_all_flush();
+ elm_config_save();
}
-
- return EINA_FALSE;
}
static void
-_engines_list_fill(Evas_Object *l_widget,
- Eina_List *e_names)
+_cb_accel_override(void *data EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED)
{
- const char *engine, *cur_engine;
- void *sel_it = NULL;
- Eina_List *l;
-
- if (!e_names)
- return;
-
- cur_engine = elm_config_engine_get();
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sb = elm_config_accel_preference_override_get();
- EINA_LIST_FOREACH(e_names, l, engine)
+ if (val != sb)
{
- const char *label;
- Elm_Object_Item *list_it;
-
- if (!_elm_engine_supported(engine))
- continue;
-
- label = _engine_name_prettify(engine);
-
- list_it = elm_list_item_append(l_widget, label, NULL, NULL, NULL,
- strdup(engine));
- elm_object_item_del_cb_set(list_it, _engines_list_item_del_cb);
- free((void *)label);
-
- if (!strcmp(cur_engine, engine))
- sel_it = list_it;
+ elm_config_accel_preference_override_set(val);
+ elm_config_all_flush();
+ elm_config_save();
}
-
- if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE);
- elm_list_go(l_widget);
}
static void
_status_config_rendering(Evas_Object *win,
Evas_Object *naviframe)
{
- Evas_Object *li, *bx, *fr, *sp, *pd, *bt;
- Eina_List *engines;
+ Evas_Object *li, *bx, *ck;
+ Elm_Object_Item *it;
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
- fr = elm_frame_add(win);
- elm_object_text_set(fr, "Available Engines");
- evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, fr);
- evas_object_show(fr);
-
li = elm_list_add(win);
- elm_object_content_set(fr, li);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- engines = ecore_evas_engines_get();
- _engines_list_fill(li, engines);
- ecore_evas_engines_free(engines);
-
+ elm_box_pack_end(bx, li);
evas_object_show(li);
- evas_object_data_set(win, "engines_list", li);
- /////////////////////////////////////////////
- sp = elm_separator_add(win);
- elm_separator_horizontal_set(sp, EINA_TRUE);
- evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, sp);
- evas_object_show(sp);
+ it = elm_list_item_append(li, "No Acceleration", NULL, NULL,
+ _cb_accel, "none");
+ if (!elm_config_accel_preference_get() ||
+ (!strcasecmp(elm_config_accel_preference_get(), "none")))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ it = elm_list_item_append(li, "OpenGL / OpenGL-ES", NULL, NULL,
+ _cb_accel, "gl");
+ if (elm_config_accel_preference_get() &&
+ ((!strcasecmp(elm_config_accel_preference_get(), "gl")) ||
+ (!strcasecmp(elm_config_accel_preference_get(), "opengl"))))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ it = elm_list_item_append(li, "3D (any 3D hardware)", NULL, NULL,
+ _cb_accel, "3d");
+ if (elm_config_accel_preference_get() &&
+ (!strcasecmp(elm_config_accel_preference_get(), "3d")))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ it = elm_list_item_append(li, "Hardware (any hardware)", NULL, NULL,
+ _cb_accel, "hw");
+ if (elm_config_accel_preference_get() &&
+ ((!strcasecmp(elm_config_accel_preference_get(), "hw")) ||
+ (!strcasecmp(elm_config_accel_preference_get(), "hardware")) ||
+ (!strcasecmp(elm_config_accel_preference_get(), "accel"))))
+ elm_list_item_selected_set(it, EINA_TRUE);
- pd = elm_frame_add(win);
- elm_object_style_set(pd, "pad_medium");
- evas_object_size_hint_weight_set(pd, 0.0, 0.0);
- evas_object_size_hint_align_set(pd, 0.5, 0.5);
- elm_box_pack_end(bx, pd);
- evas_object_show(pd);
+ elm_list_go(li);
- bt = elm_button_add(win);
- evas_object_smart_callback_add(bt, "clicked", _engine_use, li);
- elm_object_text_set(bt, "Use Engine");
- evas_object_size_hint_weight_set(bt, 0.0, 0.0);
- evas_object_size_hint_align_set(bt, 0.5, 0.5);
- elm_object_content_set(pd, bt);
- evas_object_show(bt);
+ CHECK_ADD("Override Preferred Acceleration",
+ "Force any application requesting<br>"
+ "acceleration to use the system<br>"
+ "configured acceleration as above",
+ _cb_accel_override, NULL);
+ elm_check_state_set(ck, elm_config_accel_preference_override_get());
evas_object_data_set(win, "rendering", bx);
elm_naviframe_item_simple_push(naviframe, bx);
#define D _config_edd
ELM_CONFIG_VAL(D, T, config_version, T_INT);
ELM_CONFIG_VAL(D, T, engine, T_STRING);
+ ELM_CONFIG_VAL(D, T, accel, T_STRING);
+ ELM_CONFIG_VAL(D, T, accel_override, T_UCHAR);
ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
eina_stringshare_del(fontdir);
}
eina_stringshare_del(cfg->engine);
+ eina_stringshare_del(cfg->accel);
EINA_LIST_FREE(cfg->font_overlays, fo)
{
eina_stringshare_del(fo->text_class);
_elm_config = ELM_NEW(Elm_Config);
_elm_config->config_version = ELM_CONFIG_VERSION;
_elm_config->engine = eina_stringshare_add(DEFAULT_ENGINE);
+ _elm_config->accel = NULL;
+ _elm_config->accel_override = 0;
_elm_config->vsync = 0;
_elm_config->thumbscroll_enable = EINA_TRUE;
_elm_config->thumbscroll_threshold = 24;
}
EAPI Eina_Bool
+elm_config_vsync_get(void)
+{
+ return _elm_config->vsync;
+}
+
+EAPI void
+elm_config_vsync_set(Eina_Bool enabled)
+{
+ _elm_config->vsync = enabled;
+}
+
+EAPI Eina_Bool
+elm_config_accel_preference_override_get(void)
+{
+ return _elm_config->accel_override;
+}
+
+EAPI void
+elm_config_accel_preference_override_set(Eina_Bool enabled)
+{
+ _elm_config->accel_override = enabled;
+}
+
+EAPI Eina_Bool
elm_config_focus_highlight_enabled_get(void)
{
return _elm_config->focus_highlight_enable;
EAPI const char *
elm_config_accel_preference_get(void)
{
- return _elm_accel_preference;
+ if (_elm_accel_preference) return _elm_accel_preference;
+ return _elm_config->accel;
}
EAPI void
elm_config_accel_preference_set(const char *pref)
{
if (pref)
- eina_stringshare_replace(&(_elm_accel_preference), pref);
+ {
+ eina_stringshare_replace(&(_elm_accel_preference), pref);
+ eina_stringshare_replace(&(_elm_config->accel), pref);
+ }
else
{
ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
+ ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
}
}