From de4305ae2c863b27433e4c56b28a69824941ff58 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 18 Mar 2019 09:27:14 -0400 Subject: [PATCH] efl_ui_win: fix hw accel detection the ordering of priority here is supposed to be: 1. env vars 2. global override config 3. window config 4. global config in the case where 1 and 3 were not set, however, this would end up mangling the global config values and not using the gl options @fix Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D8389 --- src/lib/elementary/efl_ui_win.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index ccede46..35a5c77 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5869,28 +5869,38 @@ _elm_win_cb_show(void *data EINA_UNUSED, _elm_win_state_eval_queue(); } -static inline const char * -_efl_ui_win_accel(Efl_Ui_Win_Data *sd) +static inline Eina_Bool +_efl_ui_win_accel(Efl_Ui_Win_Data *sd, Eina_Stringshare **accel, int *gl_depth, int *gl_stencil, int *gl_msaa) { const char *str = sd->accel_pref; const char *env; + const char *cfg = NULL; + Eina_Bool is_accel = EINA_FALSE; - /* current elm config */ - if (!str) + /* current elm config OR global override */ + if ((!str) || ((_elm_config->accel_override) && (_elm_config->accel))) { - if (_elm_config->accel) str = _elm_config->accel; - if (_elm_accel_preference) str = _elm_accel_preference; + if (_elm_config->accel) cfg = _elm_config->accel; + if (_elm_config->accel_override && _elm_accel_preference) cfg = _elm_accel_preference; } - /* global overrides */ - if ((_elm_config->accel_override) && (_elm_config->accel)) - str = _elm_config->accel; - /* env var wins */ env = getenv("ELM_ACCEL"); - if (env) str = env; - return str; + if (env) + is_accel = _elm_config_accel_preference_parse(env, accel, gl_depth, gl_stencil, gl_msaa); + else if (cfg) + { + is_accel = !!cfg; + *accel = eina_stringshare_ref(cfg); + *gl_depth = _elm_config->gl_depth; + *gl_stencil = _elm_config->gl_stencil; + *gl_msaa = _elm_config->gl_msaa; + } + else + is_accel = _elm_config_accel_preference_parse(str, accel, gl_depth, gl_stencil, gl_msaa); + + return is_accel; } static inline void @@ -6059,8 +6069,7 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U /* just to store some data while trying out to create a canvas */ memset(&tmp_sd, 0, sizeof(Efl_Ui_Win_Data)); - is_gl_accel = _elm_config_accel_preference_parse - (_efl_ui_win_accel(sd), &accel, &gl_depth, &gl_stencil, &gl_msaa); + is_gl_accel = _efl_ui_win_accel(sd, &accel, &gl_depth, &gl_stencil, &gl_msaa); switch ((int) type) { -- 2.7.4