forked from enlightenment/efl
fix several elm+fb related issues and add a feature.
SVN revision: 73334
This commit is contained in:
parent
fffbdfce6a
commit
c417a9c99f
|
@ -269,3 +269,13 @@
|
|||
|
||||
* Add access hook to widget infra.
|
||||
|
||||
2012-07-5 Carsten Haitzler (The Rasterman)
|
||||
|
||||
* Fix several FB related issues:
|
||||
* Fallback to FB from X11 so it "just works"
|
||||
* Config expected x11 and failed to start app if engine not
|
||||
explicitly set to non-x11
|
||||
* No mouse cursor displayed in fb when needed, so add a
|
||||
softcursor mode defaulting to auto.
|
||||
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ group "Elm_Config" struct {
|
|||
value "weekend_len" int: 2;
|
||||
value "year_min" int: 2;
|
||||
value "year_max" int: 137;
|
||||
value "softcursor_mode" uchar: 0;
|
||||
group "color_palette" list {
|
||||
group "Elm_Custom_Palette" struct {
|
||||
value "palette_name" string: "default";
|
||||
|
|
|
@ -62,6 +62,7 @@ group "Elm_Config" struct {
|
|||
value "weekend_len" int: 2;
|
||||
value "year_min" int: 2;
|
||||
value "year_max" int: 137;
|
||||
value "softcursor_mode" uchar: 0;
|
||||
group "color_palette" list {
|
||||
group "Elm_Custom_Palette" struct {
|
||||
value "palette_name" string: "default";
|
||||
|
|
|
@ -60,6 +60,7 @@ group "Elm_Config" struct {
|
|||
value "week_start" int: 1;
|
||||
value "weekend_start" int: 6;
|
||||
value "weekend_len" int: 2;
|
||||
value "softcursor_mode" uchar: 0;
|
||||
group "color_palette" list {
|
||||
group "Elm_Custom_Palette" struct {
|
||||
value "palette_name" string: "default";
|
||||
|
|
|
@ -386,6 +386,7 @@ _desc_init(void)
|
|||
ELM_CONFIG_VAL(D, T, year_min, T_INT);
|
||||
ELM_CONFIG_VAL(D, T, year_max, T_INT);
|
||||
ELM_CONFIG_LIST(D, T, color_palette, _config_color_palette_edd);
|
||||
ELM_CONFIG_VAL(D, T, softcursor_mode, T_UCHAR);
|
||||
#undef T
|
||||
#undef D
|
||||
#undef T_INT
|
||||
|
@ -1053,6 +1054,7 @@ _config_load(void)
|
|||
_elm_config->weekend_len = 2;
|
||||
_elm_config->year_min = 2;
|
||||
_elm_config->year_max = 137;
|
||||
_elm_config->softcursor_mode = 0; /* 0 = auto, 1 = on, 2 = off */
|
||||
_elm_config->color_palette = NULL;
|
||||
}
|
||||
|
||||
|
@ -2019,6 +2021,18 @@ elm_config_longpress_timeout_get(void)
|
|||
return _elm_config->longpress_timeout;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_config_all_flush(void)
|
||||
{
|
||||
|
@ -2104,11 +2118,8 @@ _elm_config_sub_init(void)
|
|||
#undef ENGINE_COMPARE
|
||||
{
|
||||
#ifdef HAVE_ELEMENTARY_X
|
||||
if (!ecore_x_init(NULL))
|
||||
if (ecore_x_init(NULL))
|
||||
{
|
||||
ERR("Cannot connect to X11 display. check $DISPLAY variable");
|
||||
exit(1);
|
||||
}
|
||||
_root_1st = ecore_x_window_root_first_get();
|
||||
|
||||
if (!ecore_x_screen_is_composited(0))
|
||||
|
@ -2138,6 +2149,9 @@ _elm_config_sub_init(void)
|
|||
if (changed) _prop_config_get();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
ERR("Cannot connect to X11 display. check $DISPLAY variable");
|
||||
#endif
|
||||
}
|
||||
_config_sub_apply();
|
||||
|
|
|
@ -421,6 +421,41 @@ EAPI double elm_config_longpress_timeout_get(void);
|
|||
*/
|
||||
EAPI void elm_config_longpress_timeout_set(double longpress_timeout);
|
||||
|
||||
typedef enum _Elm_Softcursor_Mode
|
||||
{
|
||||
ELM_SOFTCURSOR_MODE_AUTO, /**< Auto-detect if a software cursor should be used (default) */
|
||||
ELM_SOFTCURSOR_MODE_ON, /**< Always use a softcursor */
|
||||
ELM_SOFTCURSOR_MODE_OFF /**< Never use a softcursor */
|
||||
} Elm_Softcursor_Mode; /**< @since 1.1 */
|
||||
|
||||
/**
|
||||
* Set the mode used for software provided mouse cursors inline in the window
|
||||
* canvas.
|
||||
*
|
||||
* A software rendered cursor can be provided for rendering inline inside the
|
||||
* canvas windows in the event the native display system does not provide one
|
||||
* or the native oneis not wanted.
|
||||
*
|
||||
* @param lonpress_timeout Timeout for long press event
|
||||
* @ingroup Softcursor
|
||||
*
|
||||
* @see elm_config_softcursor_mode_get()
|
||||
* @since 1.1
|
||||
*/
|
||||
EAPI void elm_config_softcursor_mode_set(Elm_Softcursor_Mode mode);
|
||||
|
||||
/**
|
||||
* Get the software cursor mode
|
||||
*
|
||||
* @return The mode used for software cursors
|
||||
* @ingroup Softcursor
|
||||
*
|
||||
* @see elm_config_softcursor_mode_set()
|
||||
* @since 1.1
|
||||
*/
|
||||
EAPI Elm_Softcursor_Mode elm_config_softcursor_mode_get(void);
|
||||
|
||||
|
||||
/**
|
||||
* Get the duration after which tooltip will be shown.
|
||||
*
|
||||
|
|
|
@ -189,6 +189,7 @@ struct _Elm_Config
|
|||
int year_min;
|
||||
int year_max;
|
||||
Eina_List *color_palette;
|
||||
unsigned char softcursor_mode;
|
||||
|
||||
/* Not part of the EET file */
|
||||
Eina_Bool is_mirrored : 1;
|
||||
|
|
|
@ -1963,6 +1963,13 @@ elm_win_add(Evas_Object *parent,
|
|||
elm_config_preferred_engine_set \
|
||||
(ecore_evas_engine_name_get(tmp_sd.ee)); \
|
||||
} while (0)
|
||||
#define FALLBACK_STORE(engine) \
|
||||
if (tmp_sd.ee) \
|
||||
do { \
|
||||
CRITICAL(engine "Fallback to %s successful.", engine); \
|
||||
elm_config_preferred_engine_set \
|
||||
(ecore_evas_engine_name_get(tmp_sd.ee)); \
|
||||
} while (0)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -1998,26 +2005,66 @@ elm_win_add(Evas_Object *parent,
|
|||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_TRY("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_TRY("Sofware FB");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
|
||||
FALLBACK_TRY("Sofware DirectFB");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_TRY("Sofware-16");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_TRY("Sofware-8");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_OPENGL_X11))
|
||||
{
|
||||
|
@ -2037,6 +2084,16 @@ elm_win_add(Evas_Object *parent,
|
|||
else
|
||||
tmp_sd.ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_TRY("OpenGL");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
|
||||
{
|
||||
|
@ -2057,16 +2114,46 @@ elm_win_add(Evas_Object *parent,
|
|||
{
|
||||
tmp_sd.ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
|
||||
FALLBACK_TRY("Sofware SDL");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
|
||||
FALLBACK_TRY("Sofware-16-SDL");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
|
||||
FALLBACK_TRY("OpenGL SDL");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware X11");
|
||||
if (!tmp_sd.ee)
|
||||
{
|
||||
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
|
||||
FALLBACK_STORE("Sofware FB");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
|
||||
{
|
||||
|
@ -2249,6 +2336,30 @@ elm_win_add(Evas_Object *parent,
|
|||
ERR("failed to grab F12 key to elm widgets (dot) tree generation");
|
||||
#endif
|
||||
|
||||
if ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_ON) ||
|
||||
((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_AUTO) &&
|
||||
elm_config_preferred_engine_get() &&
|
||||
(!strcmp(elm_config_preferred_engine_get(), "fb"))))
|
||||
{
|
||||
Evas_Object *o;
|
||||
Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0;
|
||||
|
||||
sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee));
|
||||
_elm_theme_object_set(obj, o, "pointer", "base", "default");
|
||||
edje_object_size_min_calc(o, &mw, &mh);
|
||||
evas_object_resize(o, mw, mh);
|
||||
edje_object_part_geometry_get(o, "elm.swallow.hotspot",
|
||||
&hx, &hy, NULL, NULL);
|
||||
sd->pointer.hot_x = hx;
|
||||
sd->pointer.hot_y = hy;
|
||||
evas_object_show(o);
|
||||
ecore_evas_object_cursor_set(tmp_sd.ee, o, EVAS_LAYER_MAX, hx, hy);
|
||||
}
|
||||
else if (_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_OFF)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue