elm engine choice and logic rationalize

now that we have ELM_DISPLAY and ELM_ACCEL we have little need for a
lot of the elm engine stuff and frankly a lot was broken if you used
multiple engines etc. so this fixes a lot of it nd removes a lot of
cruft. i think i got it all right, but i may have oppsied. this also
remo9ves engine support for engines long gone from evas.
This commit is contained in:
Carsten Haitzler 2014-08-22 14:48:13 +09:00
parent 915b9e8091
commit f934291859
5 changed files with 98 additions and 162 deletions

View File

@ -35,14 +35,9 @@ Eina_Hash *_elm_key_bindings = NULL;
const char *_elm_engines[] = {
"software_x11",
"fb",
"directfb",
"software_16_x11",
"software_8_x11",
"xrender_x11",
"opengl_x11",
"software_gdi",
"sdl",
"software_16_sdl",
"opengl_sdl",
"buffer",
"ews",
@ -3191,21 +3186,14 @@ elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute)
EAPI void
elm_config_all_flush(void)
{
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11) ||
ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
if (ecore_x_display_get())
{
_prop_config_set();
ecore_x_window_prop_string_set(_config_win, _atom[ATOM_E_PROFILE],
_elm_profile);
#endif
}
#endif
}
static void
@ -3268,90 +3256,68 @@ _elm_config_sub_shutdown(void)
{
#ifdef HAVE_ELEMENTARY_X
ELM_SAFE_FREE(_prop_change_delay_timer, ecore_timer_del);
if (ecore_x_display_get()) ecore_x_shutdown();
#endif
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11) ||
ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
if (ecore_x_display_get()) ecore_x_shutdown();
#endif
}
}
void
_elm_config_sub_init(void)
{
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11) ||
ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
if (getenv("DISPLAY"))
const char *ev = getenv("ELM_DISPLAY");
if (((ev) && (!strcmp(ev, "x11")) && (getenv("DISPLAY"))) ||
(getenv("DISPLAY")))
{
if (ecore_x_init(NULL))
{
if (ecore_x_init(NULL))
Ecore_X_Window win = 0, win2 = 0, root;
if (!ecore_x_screen_is_composited(0))
_elm_config->compositing = 0;
ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
root = ecore_x_window_root_first_get();
if (ecore_x_window_prop_window_get(root,
_atom[ATOM_E_CONFIG_WIN],
&win, 1) == 1)
{
Ecore_X_Window win = 0, win2 = 0, root;
if (!ecore_x_screen_is_composited(0))
_elm_config->compositing = 0;
ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom);
root = ecore_x_window_root_first_get();
if (ecore_x_window_prop_window_get(root,
if (ecore_x_window_prop_window_get(win,
_atom[ATOM_E_CONFIG_WIN],
&win, 1) == 1)
&win2, 1) == 1)
{
if (ecore_x_window_prop_window_get(win,
_atom[ATOM_E_CONFIG_WIN],
&win2, 1) == 1)
{
if (win2 == win) _config_win = win;
}
}
if (_config_win == 0)
_config_win = ecore_x_window_permanent_new
(root, _atom[ATOM_E_CONFIG_WIN]);
ecore_x_event_mask_set(_config_win,
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"))
{
char *s;
s = ecore_x_window_prop_string_get(_config_win,
_atom[ATOM_E_PROFILE]);
if (s)
{
int changed = 0;
if (_elm_profile)
{
if (strcmp(_elm_profile, s)) changed = 1;
free(_elm_profile);
}
_elm_profile = s;
if (changed) _prop_config_get();
s = strchr(_elm_profile, '/');
if (s) *s = 0;
}
if (win2 == win) _config_win = win;
}
}
if (_config_win == 0)
_config_win = ecore_x_window_permanent_new
(root, _atom[ATOM_E_CONFIG_WIN]);
ecore_x_event_mask_set(_config_win,
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"))
{
char *s;
s = ecore_x_window_prop_string_get(_config_win,
_atom[ATOM_E_PROFILE]);
if (s)
{
int changed = 0;
if (_elm_profile)
{
if (strcmp(_elm_profile, s)) changed = 1;
free(_elm_profile);
}
_elm_profile = s;
if (changed) _prop_config_get();
s = strchr(_elm_profile, '/');
if (s) *s = 0;
}
}
else
ERR("Cannot connect to X11 display. check $DISPLAY variable");
}
else ERR("Cannot connect to X11 display. check $DISPLAY variable");
#endif
}
_config_sub_apply();
@ -3470,24 +3436,13 @@ _elm_config_profile_set(const char *profile)
void
_elm_config_shutdown(void)
{
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11) ||
ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
#undef ENGINE_COMPARE
{
#ifdef HAVE_ELEMENTARY_X
ELM_SAFE_FREE(_prop_change_handler, ecore_event_handler_del);
ELM_SAFE_FREE(_prop_change_handler, ecore_event_handler_del);
#endif
}
ELM_SAFE_FREE(_elm_config, _config_free);
ELM_SAFE_FREE(_elm_preferred_engine, eina_stringshare_del);
ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
ELM_SAFE_FREE(_elm_profile, free);
#ifdef HAVE_ELEMENTARY_X
_elm_font_overlays_del_free();
#endif

View File

@ -780,19 +780,19 @@ EAPI void elm_config_password_show_last_timeout_set(double password_show_la
* The following are the available engines:
* @li "software_x11"
* @li "fb"
* @li "directfb"
* @li "software_16_x11"
* @li "software_8_x11"
* @li "xrender_x11"
* @li "opengl_x11"
* @li "software_gdi"
* @li "sdl"
* @li "software_16_sdl"
* @li "opengl_sdl"
* @li "buffer"
* @li "ews"
* @li "opengl_cocoa"
* @li "psl1ght"
* @li "wayland_shm"
* @li "wayland_egl"
* @li "drm"
*
* @deprecated Please use elm_config_accel_preference_override_set() instead
*
* @{
*/
@ -807,8 +807,10 @@ EAPI void elm_config_password_show_last_timeout_set(double password_show_la
* applications.
*
* @see elm_config_engine_set()
*
* @deprecated Please use elm_config_accel_preference_override_get() instead
*/
EAPI const char *elm_config_engine_get(void);
EINA_DEPRECATED EAPI const char *elm_config_engine_get(void);
/**
* @brief Set Elementary's rendering engine for use.
@ -819,8 +821,10 @@ EAPI const char *elm_config_engine_get(void);
* this is called.
*
* @see elm_win_add()
*
* @deprecated Please use elm_config_accel_preference_override_set() instead
*/
EAPI void elm_config_engine_set(const char *engine);
EINA_DEPRECATED EAPI void elm_config_engine_set(const char *engine);
/**
* @brief Get Elementary's preferred engine to use.
@ -833,8 +837,10 @@ EAPI void elm_config_engine_set(const char *engine);
* override the engine configured for all applications which.
*
* @see elm_config_preferred_engine_set()
*
* @deprecated Please use elm_config_accel_preference_override_get() instead
*/
EAPI const char *elm_config_preferred_engine_get(void);
EINA_DEPRECATED EAPI const char *elm_config_preferred_engine_get(void);
/**
* @brief Set Elementary's preferred rendering engine for use.
@ -846,8 +852,10 @@ EAPI const char *elm_config_preferred_engine_get(void);
* application startup. Note that it is a hint and may not be honored.
*
* @see elm_win_add()
*
* @deprecated Please use elm_config_accel_preference_override_set() instead
*/
EAPI void elm_config_preferred_engine_set(const char *engine);
EINA_DEPRECATED EAPI void elm_config_preferred_engine_set(const char *engine);
/**
* @brief Get Elementary's preferred engine to use.

View File

@ -701,19 +701,6 @@ elm_quicklaunch_sub_shutdown(void)
ecore_imf_shutdown();
ecore_evas_shutdown();
_elm_config_sub_shutdown();
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11) ||
ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
ENGINE_COMPARE(ELM_OPENGL_SDL) ||
ENGINE_COMPARE(ELM_OPENGL_COCOA) ||
ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
ENGINE_COMPARE(ELM_EWS))
#undef ENGINE_COMPARE
evas_cserve_disconnect();
edje_shutdown();
evas_shutdown();
}
@ -788,17 +775,9 @@ elm_quicklaunch_seed(void)
ecore_main_loop_iterate();
evas_object_del(win);
ecore_main_loop_iterate();
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11))
#undef ENGINE_COMPARE
{
# ifdef HAVE_ELEMENTARY_X
if (ecore_x_display_get()) ecore_x_sync();
if (ecore_x_display_get()) ecore_x_sync();
# endif
}
ecore_main_loop_iterate();
}
#endif
@ -956,17 +935,14 @@ elm_quicklaunch_fork(int argc,
edje_init();
_elm_module_init();
_elm_config_sub_init();
#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) ||
ENGINE_COMPARE(ELM_OPENGL_X11))
#undef ENGINE_COMPARE
{
# ifdef HAVE_ELEMENTARY_X
if (getenv("DISPLAY")) ecore_x_init(NULL);
# endif
{
const char *ev = getenv("ELM_DISPLAY");
if (((ev) && (!strcmp(ev, "x11")) && (getenv("DISPLAY"))) ||
(getenv("DISPLAY")))
ecore_x_init(NULL);
}
# endif
ecore_evas_init(); // FIXME: check errors
ecore_imf_init();
#endif

View File

@ -136,22 +136,17 @@ extern const char *_elm_engines[];
#define ELM_SOFTWARE_X11 (_elm_engines[0])
#define ELM_SOFTWARE_FB (_elm_engines[1])
#define ELM_SOFTWARE_DIRECTFB (_elm_engines[2])
#define ELM_SOFTWARE_16_X11 (_elm_engines[3])
#define ELM_SOFTWARE_8_X11 (_elm_engines[4])
#define ELM_XRENDER_X11 (_elm_engines[5])
#define ELM_OPENGL_X11 (_elm_engines[6])
#define ELM_SOFTWARE_WIN32 (_elm_engines[7])
#define ELM_SOFTWARE_SDL (_elm_engines[8])
#define ELM_SOFTWARE_16_SDL (_elm_engines[9])
#define ELM_OPENGL_SDL (_elm_engines[10])
#define ELM_BUFFER (_elm_engines[11])
#define ELM_EWS (_elm_engines[12])
#define ELM_OPENGL_COCOA (_elm_engines[13])
#define ELM_SOFTWARE_PSL1GHT (_elm_engines[14])
#define ELM_WAYLAND_SHM (_elm_engines[15])
#define ELM_WAYLAND_EGL (_elm_engines[16])
#define ELM_DRM (_elm_engines[17])
#define ELM_OPENGL_X11 (_elm_engines[2])
#define ELM_SOFTWARE_WIN32 (_elm_engines[3])
#define ELM_SOFTWARE_SDL (_elm_engines[4])
#define ELM_OPENGL_SDL (_elm_engines[5])
#define ELM_BUFFER (_elm_engines[6])
#define ELM_EWS (_elm_engines[7])
#define ELM_OPENGL_COCOA (_elm_engines[8])
#define ELM_SOFTWARE_PSL1GHT (_elm_engines[9])
#define ELM_WAYLAND_SHM (_elm_engines[10])
#define ELM_WAYLAND_EGL (_elm_engines[11])
#define ELM_DRM (_elm_engines[12])
#define ELM_FONT_TOKEN_STYLE ":style="

View File

@ -15,7 +15,14 @@
* testing. Engines that may be supported (depending on Evas and Ecore-Evas
* compilation setup and modules actually installed at runtime) are (listed
* in order of best supported and most likely to be complete and work to
* lowest quality).
* lowest quality). Note that ELM_ENGINE is really only needed for special
* cases and debugging. you should normally use ELM_DISPLAY and ELM_ACCEL
* environment variables, or core elementary config. ELM_DISPLAY can be set to
* "x11" or "wl" to indicate the target display system (as on Linux systems
* you may have both display systems available, so this selects which to use).
* ELM_ACCEL may also be set to indicate if you want accelerations and which
* kind to use. see elm_config_accel_preference_set(0 for details on this
* environment variable values.
*
* @li "x11", "x", "software-x11", "software_x11" (Software rendering in X11)
* @li "gl", "opengl", "opengl-x11", "opengl_x11" (OpenGL or OpenGL-ES2
@ -30,16 +37,11 @@
* rendering using SDL as the buffer)
* @li "gdi", "software-gdi", "software_gdi" (Windows WIN32 rendering via
* GDI with software)
* @li "dfb", "directfb" (Rendering to a DirectFB window)
* @li "x11-8", "x8", "software-8-x11", "software_8_x11" (Rendering in
* grayscale using dedicated 8bit software engine in X11)
* @li "x11-16", "x16", "software-16-x11", "software_16_x11" (Rendering in
* X11 using 16bit software engine)
* @li "sdl-16", "software-16-sdl", "software_16_sdl" (Rendering to SDL
* buffer with 16bit software renderer)
* @li "ews" (rendering to EWS - Ecore + Evas Single Process Windowing System)
* @li "gl-cocoa", "gl_cocoa", "opengl-cocoa", "opengl_cocoa" (OpenGL rendering in Cocoa)
* @li "psl1ght" (PS3 rendering using PSL1GHT)
* @li "wayland_shm" (Wayland client SHM rendering)
* @li "wayland_egl" (Wayland client OpenGL/EGL rendering)
* @li "drm" (Linux drm/kms etc. direct display)
*
* All engines use a simple string to select the engine to render, EXCEPT
* the "shot" engine. This actually encodes the output of the virtual