diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 832b550b75..ac8aa406bb 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -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. + + diff --git a/legacy/elementary/config/default/base.src b/legacy/elementary/config/default/base.src index 52398e8280..bad7bf34fd 100644 --- a/legacy/elementary/config/default/base.src +++ b/legacy/elementary/config/default/base.src @@ -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"; diff --git a/legacy/elementary/config/illume/base.src b/legacy/elementary/config/illume/base.src index 4e0844b0bc..df2735ba3b 100644 --- a/legacy/elementary/config/illume/base.src +++ b/legacy/elementary/config/illume/base.src @@ -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"; diff --git a/legacy/elementary/config/standard/base.src b/legacy/elementary/config/standard/base.src index b607816795..40d207d215 100644 --- a/legacy/elementary/config/standard/base.src +++ b/legacy/elementary/config/standard/base.src @@ -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"; diff --git a/legacy/elementary/src/lib/elm_config.c b/legacy/elementary/src/lib/elm_config.c index 7736aa3d22..cb8ff678c2 100644 --- a/legacy/elementary/src/lib/elm_config.c +++ b/legacy/elementary/src/lib/elm_config.c @@ -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,40 +2118,40 @@ _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)) - _elm_config->compositing = 0; - - ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom); - ecore_x_event_mask_set(_root_1st, - 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(_root_1st, - _atom[ATOM_E_PROFILE]); - if (s) + _root_1st = ecore_x_window_root_first_get(); + + if (!ecore_x_screen_is_composited(0)) + _elm_config->compositing = 0; + + ecore_x_atoms_get(_atom_names, ATOM_COUNT, _atom); + ecore_x_event_mask_set(_root_1st, + 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")) { - int changed = 0; - - if (_elm_profile) + char *s; + + s = ecore_x_window_prop_string_get(_root_1st, + _atom[ATOM_E_PROFILE]); + if (s) { - if (strcmp(_elm_profile, s)) changed = 1; - free(_elm_profile); + int changed = 0; + + if (_elm_profile) + { + if (strcmp(_elm_profile, s)) changed = 1; + free(_elm_profile); + } + _elm_profile = s; + if (changed) _prop_config_get(); } - _elm_profile = s; - if (changed) _prop_config_get(); } } + else + ERR("Cannot connect to X11 display. check $DISPLAY variable"); #endif } _config_sub_apply(); diff --git a/legacy/elementary/src/lib/elm_config.h b/legacy/elementary/src/lib/elm_config.h index 3128f46477..c7b8e67862 100644 --- a/legacy/elementary/src/lib/elm_config.h +++ b/legacy/elementary/src/lib/elm_config.h @@ -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. * diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index fd2bc4b90a..ea2f4a16af 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -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; diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 044df1841b..0d2f5855db 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -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)) { @@ -2105,7 +2192,7 @@ elm_win_add(Evas_Object *parent, ERR("Cannot create window."); return NULL; } - + obj = evas_object_smart_add (ecore_evas_get(tmp_sd.ee), _elm_win_smart_class_new()); @@ -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; }