diff -Nru e20-201702271931/configure.ac e20-201702281931/configure.ac --- e20-201702271931/configure.ac 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/configure.ac 2017-02-28 19:31:37.000000000 +0000 @@ -760,6 +760,17 @@ ]) AM_CONDITIONAL([HAVE_WL_WL], [test "x${WL_WL}" = "xtrue"]) +WL_BUFFER=false +define([CHECK_MODULE_WL_BUFFER], +[ + if test "x${have_wayland}" = "xyes"; then + WL_BUFFER=true + else + WL_BUFFER=false + fi +]) +AM_CONDITIONAL([HAVE_WL_BUFFER], [test "x${WL_BUFFER}" = "xtrue"]) + WL_DESKTOP_SHELL=false define([CHECK_MODULE_WL_DESKTOP_SHELL], [ @@ -794,7 +805,7 @@ AC_DEFINE_UNQUOTED([HAVE_DRM2],[1],[enable ecore-drm2 support]) ], [WL_DRM=false]) else - AC_E_CHECK_PKG(WL_DRM, [ ecore-drm >= $efl_version ], [WL_DRM=true], [WL_DRM=false]) + WL_DRM=false fi else WL_DRM=false @@ -893,6 +904,7 @@ AC_E_OPTIONAL_MODULE([wl_desktop_shell], $have_wayland_dep) AC_E_OPTIONAL_MODULE([wl_x11], $have_wayland_dep, [CHECK_MODULE_WL_X11]) AC_E_OPTIONAL_MODULE([wl_wl], $have_wayland_dep) +AC_E_OPTIONAL_MODULE([wl_buffer], $have_wayland_dep) #AC_E_OPTIONAL_MODULE([wl_fb], $have_wayland_dep, [CHECK_MODULE_WL_FB]) AC_E_OPTIONAL_MODULE([wl_drm], $have_wayland_dep, [CHECK_MODULE_WL_DRM]) AC_E_OPTIONAL_MODULE([wl_text_input], $have_wayland_dep) diff -Nru e20-201702271931/debian/bzr-builder.manifest e20-201702281931/debian/bzr-builder.manifest --- e20-201702271931/debian/bzr-builder.manifest 2017-02-27 19:32:02.000000000 +0000 +++ e20-201702281931/debian/bzr-builder.manifest 2017-02-28 19:31:48.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version 201702271931-21815 -lp:~enlightenment-git/enlightenment-svn/enlightenment-bzr revid:smhouston88@gmail.com-20170111180130-po8x3cy1n2cahdg0 +# bzr-builder format 0.3 deb-version 201702281931-22036 +lp:~enlightenment-git/enlightenment-svn/enlightenment-bzr revid:marcel-hollerbach@t-online.de-20170225160206-t3nbxhcvqtbnth5t nest-part packaging lp:enlightenment-svn e20 debian revid:adam@adamisrael.com-20161229012720-bwp239clu5p89z66 diff -Nru e20-201702271931/debian/changelog e20-201702281931/debian/changelog --- e20-201702271931/debian/changelog 2017-02-27 19:32:02.000000000 +0000 +++ e20-201702281931/debian/changelog 2017-02-28 19:31:48.000000000 +0000 @@ -1,6 +1,6 @@ -e20 (201702271931-21815~ubuntu15.04.1) vivid; urgency=low +e20 (201702281931-22036~ubuntu15.04.1) vivid; urgency=low * Auto build. - -- Adam Israel Mon, 27 Feb 2017 19:32:02 +0000 + -- Adam Israel Tue, 28 Feb 2017 19:31:48 +0000 diff -Nru e20-201702271931/src/bin/e_actions.c e20-201702281931/src/bin/e_actions.c --- e20-201702271931/src/bin/e_actions.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_actions.c 2017-02-28 19:31:37.000000000 +0000 @@ -97,8 +97,8 @@ obj = E_OBJECT(e_client_focused_get()); if (!obj) return; if (obj->type != E_CLIENT_TYPE) return; - if (!((E_Client *)obj)->lock_user_location) - e_client_act_move_begin((E_Client *)obj, NULL); + if (!((E_Client *)(void *)obj)->lock_user_location) + e_client_act_move_begin((E_Client *)(void *)obj, NULL); } ACT_FN_GO_MOUSE(window_move, EINA_UNUSED) @@ -106,7 +106,7 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return EINA_FALSE; if (obj->type != E_CLIENT_TYPE) return EINA_FALSE; - e_client_act_move_begin((E_Client *)obj, ev); + e_client_act_move_begin((E_Client *)(void *)obj, ev); return EINA_TRUE; } @@ -115,14 +115,14 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; if (obj->type != E_CLIENT_TYPE) return; - if (!((E_Client *)obj)->lock_user_location) + if (!((E_Client *)(void *)obj)->lock_user_location) { if ((params) && (!strcmp(params, "end"))) - e_client_signal_move_end((E_Client *)obj, sig, src); + e_client_signal_move_end((E_Client *)(void *)obj, sig, src); else { - if (!((E_Client *)obj)->moving) - e_client_signal_move_begin((E_Client *)obj, sig, src); + if (!((E_Client *)(void *)obj)->moving) + e_client_signal_move_begin((E_Client *)(void *)obj, sig, src); } } } @@ -132,7 +132,7 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; if (obj->type != E_CLIENT_TYPE) return; - e_client_act_move_end((E_Client *)obj, NULL); + e_client_act_move_end((E_Client *)(void *)obj, NULL); } ACT_FN_END_MOUSE(window_move, EINA_UNUSED) @@ -140,7 +140,7 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return EINA_FALSE; if (obj->type != E_CLIENT_TYPE) return EINA_FALSE; - e_client_act_move_end((E_Client *)obj, ev); + e_client_act_move_end((E_Client *)(void *)obj, ev); return EINA_TRUE; } @@ -148,8 +148,8 @@ { if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_location) - e_client_act_move_keyboard((E_Client *)obj); + if (!((E_Client *)(void *)obj)->lock_user_location) + e_client_act_move_keyboard((E_Client *)(void *)obj); } /***************************************************************************/ @@ -158,8 +158,8 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_size) - e_client_act_resize_begin((E_Client *)obj, NULL); + if (!((E_Client *)(void *)obj)->lock_user_size) + e_client_act_resize_begin((E_Client *)(void *)obj, NULL); } ACT_FN_GO_MOUSE(window_resize, EINA_UNUSED) @@ -167,8 +167,8 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return EINA_FALSE; if (obj->type != E_CLIENT_TYPE) return EINA_FALSE; - if (!((E_Client *)obj)->lock_user_size) - e_client_act_resize_begin((E_Client *)obj, ev); + if (!((E_Client *)(void *)obj)->lock_user_size) + e_client_act_resize_begin((E_Client *)(void *)obj, ev); return EINA_TRUE; } @@ -177,17 +177,17 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; if (obj->type != E_CLIENT_TYPE) return; - if (!((E_Client *)obj)->lock_user_size) + if (!((E_Client *)(void *)obj)->lock_user_size) { if ((params) && (!strcmp(params, "end"))) - e_client_signal_resize_end((E_Client *)obj, params, sig, src); + e_client_signal_resize_end((E_Client *)(void *)obj, params, sig, src); else { if (!params) params = ""; - if (e_client_util_resizing_get((E_Client *)obj)) - e_client_signal_resize_end((E_Client *)obj, params, sig, src); + if (e_client_util_resizing_get((E_Client *)(void *)obj)) + e_client_signal_resize_end((E_Client *)(void *)obj, params, sig, src); else - e_client_signal_resize_begin((E_Client *)obj, params, sig, src); + e_client_signal_resize_begin((E_Client *)(void *)obj, params, sig, src); } } } @@ -197,7 +197,7 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; if (obj->type != E_CLIENT_TYPE) return; - e_client_act_resize_end((E_Client *)obj, NULL); + e_client_act_resize_end((E_Client *)(void *)obj, NULL); } ACT_FN_END_MOUSE(window_resize, EINA_UNUSED) @@ -205,7 +205,7 @@ if (!obj) obj = E_OBJECT(e_client_focused_get()); if (!obj) return EINA_FALSE; if (obj->type != E_CLIENT_TYPE) return EINA_FALSE; - e_client_act_resize_end((E_Client *)obj, ev); + e_client_act_resize_end((E_Client *)(void *)obj, ev); return EINA_TRUE; } @@ -218,8 +218,8 @@ obj = E_OBJECT(e_client_focused_get()); if (!obj) return; } - if (!((E_Client *)obj)->lock_user_size) - e_client_act_resize_keyboard((E_Client *)obj); + if (!((E_Client *)(void *)obj)->lock_user_size) + e_client_act_resize_keyboard((E_Client *)(void *)obj); } /***************************************************************************/ @@ -228,7 +228,7 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - e_client_act_menu_begin((E_Client *)obj, NULL, 0); + e_client_act_menu_begin((E_Client *)(void *)obj, NULL, 0); } ACT_FN_GO_MOUSE(window_menu, EINA_UNUSED) @@ -240,7 +240,7 @@ obj = E_OBJECT(e_client_focused_get()); if (!obj) return EINA_FALSE; } - e_client_act_menu_begin((E_Client *)obj, ev, 0); + e_client_act_menu_begin((E_Client *)(void *)obj, ev, 0); return EINA_TRUE; } @@ -253,7 +253,7 @@ obj = E_OBJECT(e_client_focused_get()); if (!obj) return; } - e_client_act_menu_begin((E_Client *)obj, NULL, 1); + e_client_act_menu_begin((E_Client *)(void *)obj, NULL, 1); } /***************************************************************************/ @@ -262,8 +262,8 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_stacking) - evas_object_raise(((E_Client *)obj)->frame); + if (!((E_Client *)(void *)obj)->lock_user_stacking) + evas_object_raise(((E_Client *)(void *)obj)->frame); } /***************************************************************************/ @@ -272,8 +272,8 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_stacking) - evas_object_lower(((E_Client *)obj)->frame); + if (!((E_Client *)(void *)obj)->lock_user_stacking) + evas_object_lower(((E_Client *)(void *)obj)->frame); } /***************************************************************************/ @@ -282,8 +282,8 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_close) - e_client_act_close_begin((E_Client *)obj); + if (!((E_Client *)(void *)obj)->lock_close) + e_client_act_close_begin((E_Client *)(void *)obj); } /***************************************************************************/ @@ -300,8 +300,8 @@ e_object_del(E_OBJECT(kill_dialog)); kill_dialog = NULL; } - if ((!((E_Client *)obj)->lock_close) && (!((E_Client *)obj)->internal)) - e_client_act_kill_begin((E_Client *)obj); + if ((!((E_Client *)(void *)obj)->lock_close) && (!((E_Client *)(void *)obj)->internal)) + e_client_act_kill_begin((E_Client *)(void *)obj); } static void @@ -325,7 +325,7 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((ec->lock_close) || (ec->internal)) return; if (kill_dialog) e_object_del(E_OBJECT(kill_dialog)); @@ -367,11 +367,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_sticky) + if (!((E_Client *)(void *)obj)->lock_user_sticky) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (ec->sticky) e_client_unstick(ec); else e_client_stick(ec); } @@ -383,11 +383,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_sticky) + if (!((E_Client *)(void *)obj)->lock_user_sticky) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (params) { if (atoi(params) == 1) @@ -406,7 +406,7 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((!ec->lock_user_iconify) && (!ec->fullscreen) && ((ec->netwm.type == E_WINDOW_TYPE_NORMAL) || @@ -423,11 +423,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_iconify) + if (!((E_Client *)(void *)obj)->lock_user_iconify) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (params) { if (atoi(params) == 1) @@ -444,11 +444,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_fullscreen) + if (!((E_Client *)(void *)obj)->lock_user_fullscreen) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (ec->fullscreen) e_client_unfullscreen(ec); else if (!params || *params == '\0') @@ -466,11 +466,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_fullscreen) + if (!((E_Client *)(void *)obj)->lock_user_fullscreen) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (params) { int v; @@ -504,7 +504,7 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; /* internal dialog which is resizable */ if (ec->internal && (ec->netwm.type == E_WINDOW_TYPE_DIALOG)) @@ -568,11 +568,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_maximize) + if (!((E_Client *)(void *)obj)->lock_user_maximize) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (params) { E_Maximize max; @@ -622,11 +622,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_shade) + if (!((E_Client *)(void *)obj)->lock_user_shade) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (ec->shaded) { if (!params) @@ -672,11 +672,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_user_shade) + if (!((E_Client *)(void *)obj)->lock_user_shade) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (!e_comp_object_frame_allowed(ec->frame)) return; if (params) { @@ -718,11 +718,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_border) + if (!((E_Client *)(void *)obj)->lock_border) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (!e_comp_object_frame_allowed(ec->frame)) return; ec->borderless = !ec->borderless; @@ -737,11 +737,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_border) + if (!((E_Client *)(void *)obj)->lock_border) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (!e_comp_object_frame_allowed(ec->frame)) return; if (ec && params) { @@ -758,11 +758,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_border) + if (!((E_Client *)(void *)obj)->lock_border) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (!e_comp_object_frame_allowed(ec->frame)) return; if (ec && params) { @@ -817,11 +817,11 @@ if ((!obj) || (obj->type != E_CLIENT_TYPE)) obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - if (!((E_Client *)obj)->lock_border) + if (!((E_Client *)(void *)obj)->lock_border) { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((ec->netwm.state.stacking == E_STACKING_BELOW) && (ec->user_skip_winlist) && (ec->borderless)) e_client_pinned_set(ec, 0); @@ -848,7 +848,7 @@ { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; evas_object_move(ec->frame, ec->x + dx, ec->y + dy); e_util_pointer_center(ec); @@ -868,7 +868,7 @@ int x, y, zx, zy, zw, zh; char cx, cy; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh); if (sscanf(params, "%c%i %c%i", &cx, &x, &cy, &y) == 4) @@ -915,7 +915,7 @@ if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if((ec->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE) e_client_unmaximize(ec, E_MAXIMIZE_BOTH); e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh); @@ -959,7 +959,7 @@ obj = E_OBJECT(e_client_focused_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; e_comp_object_util_center(ec->frame); e_util_pointer_center(ec); @@ -980,7 +980,7 @@ { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; dw += ec->w; dh += ec->h; @@ -1049,7 +1049,7 @@ else return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh); if (hdir < 0) x = zx; @@ -1186,7 +1186,7 @@ { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; ec->drag.start = 1; ec->drag.x = -1; ec->drag.y = -1; @@ -1206,7 +1206,7 @@ obj = E_OBJECT(e_client_action_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((!ec->zone) || (!ec->desk)) return; if (sscanf(params, "%d %d", &x, &y) == 2) { @@ -1268,7 +1268,7 @@ obj = E_OBJECT(e_client_action_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; /* bad */ if (!ec->zone) return; /* only one screen */ @@ -1308,7 +1308,7 @@ obj = E_OBJECT(e_client_action_get()); if (!obj) return; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((!ec->zone) || (!ec->desk)) return; if (sscanf(params, "%d %d", &x, &y) == 2) { @@ -1328,9 +1328,9 @@ if (obj->type == (int)E_COMP_TYPE) return e_zone_current_get(); else if (obj->type == (int)E_ZONE_TYPE) - return (E_Zone *)obj; + return (void *)obj; else if (obj->type == (int)E_CLIENT_TYPE) - return ((E_Client *)obj)->zone; + return ((E_Client *)(void *)obj)->zone; else if (obj->type == (int)E_SHELF_TYPE) return ((E_Shelf *)obj)->zone; else if (e_obj_is_win(obj)) @@ -1980,7 +1980,7 @@ obj = E_OBJECT(e_client_focused_get()); if (!obj) return; } - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if (ec->desktop) e_exec(zone, ec->desktop, NULL, NULL, "action/app"); @@ -2436,7 +2436,7 @@ { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((ec->lock_user_size) || (ec->shaded) || (ec->shading) || (ec->fullscreen) || ((ec->maximized) && (!e_config->allow_manip))) return; @@ -2452,7 +2452,7 @@ { E_Client *ec; - ec = (E_Client *)obj; + ec = (E_Client *)(void *)obj; if ((ec->lock_user_size) || (ec->shaded) || (ec->shading) || (ec->fullscreen) || ((ec->maximized) && (!e_config->allow_manip))) return; @@ -2686,7 +2686,7 @@ eina_strlcpy(a2, a2start, a2stop - a2start + 1); _delayed_action_list_parse_action(a2, &delay, &da->delayed.action, &da->delayed.params); } - da->timer = ecore_timer_add(delay, _delayed_action_cb_timer, da); + da->timer = ecore_timer_loop_add(delay, _delayed_action_cb_timer, da); } static void diff -Nru e20-201702271931/src/bin/e_askpass_main.c e20-201702281931/src/bin/e_askpass_main.c --- e20-201702271931/src/bin/e_askpass_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_askpass_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,8 +1,11 @@ #include -#define TITLE "Enter Your Password" +#define TITLE_USER "Enter Your Username" +#define TITLE_PWD "Enter Your Password" +#define SUDO_LBL "[sudo]" #define TEXT "Please enter your user password" -#define GUIDE "Password" +#define GUIDE_USER "Username" +#define GUIDE_PWD "Password" #define OK "OK" #define CANCEL "Cancel" #define PAD "pad_medium" @@ -33,9 +36,25 @@ } EAPI int -elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) +elm_main(int argc, char **argv) { Evas_Object *win, *bx, *fr, *lab, *en, *sep, *bx2, *bt; + const char *txt = NULL; + Eina_Bool askpass = EINA_TRUE; + + if (argc > 1) + { + /* Git could use SSH_ASKPASS env to query user and password. */ + /* At least git has no i18n, so this should work for all languages */ + /* as long as the string is unchanged. */ + if (!strncmp(argv[1], "Username", sizeof("Username") - 1)) + askpass = EINA_FALSE; + /* Sudo prompt [sudo] at the begining of line */ + if (!strncmp(argv[1], SUDO_LBL, sizeof(SUDO_LBL) - 1)) + txt = &argv[1][sizeof(SUDO_LBL)]; + else + txt = argv[1]; + } elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); @@ -45,7 +64,7 @@ elm_app_info_set(elm_main, "enlightenment", "AUTHORS"); { - win = elm_win_util_standard_add("main", TITLE); + win = elm_win_util_standard_add("main", askpass ? TITLE_PWD : TITLE_USER); elm_win_autodel_set(win, EINA_TRUE); { bx = elm_box_add(win); @@ -60,7 +79,10 @@ { lab = elm_label_add(win); evas_object_size_hint_align_set(lab, EVAS_HINT_FILL, 0.5); - elm_object_text_set(lab, TEXT); + if (txt) + elm_object_text_set(lab, txt); + else + elm_object_text_set(lab, TEXT); elm_object_content_set(fr, lab); evas_object_show(lab); } @@ -78,9 +100,9 @@ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); elm_scroller_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); - elm_object_part_text_set(en, "guide", GUIDE); + elm_object_part_text_set(en, "guide", askpass ? GUIDE_PWD : GUIDE_USER); elm_entry_single_line_set(en, EINA_TRUE); - elm_entry_password_set(en, EINA_TRUE); + elm_entry_password_set(en, askpass); evas_object_smart_callback_add(en, "activated", cb_ok, NULL); evas_object_smart_callback_add(en, "aborted", cb_cancel, NULL); elm_object_content_set(fr, en); diff -Nru e20-201702271931/src/bin/e_backlight.c e20-201702281931/src/bin/e_backlight.c --- e20-201702271931/src/bin/e_backlight.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_backlight.c 2017-02-28 19:31:37.000000000 +0000 @@ -121,6 +121,7 @@ // set backlight associated with zone to val over period of tim // if tim == 0.0 - then do it instantnly, if time == -1 use some default // transition time + if ((!e_comp->screen) || (!e_comp->screen->backlight_enabled)) return; if (val < 0.0) val = 0.0; else if (val > 1.0) val = 1.0; @@ -165,6 +166,9 @@ // zone == NULL == everything if (e_config->backlight.mode == mode) return; + if (eina_streq(ecore_evas_engine_name_get(e_comp->ee), "buffer") || + strstr(ecore_evas_engine_name_get(e_comp->ee), "wayland")) + return; pmode = e_config->backlight.mode; e_config->backlight.mode = mode; if (e_config->backlight.mode == E_BACKLIGHT_MODE_NORMAL) @@ -496,7 +500,7 @@ { bl_sys_set_exe_ready = EINA_FALSE; bl_sys_set_exe = NULL; - ecore_timer_add(0.05, _e_bl_cb_ext_delay, NULL); + ecore_timer_loop_add(0.05, _e_bl_cb_ext_delay, NULL); } return ECORE_CALLBACK_RENEW; } diff -Nru e20-201702271931/src/bin/e_bindings.c e20-201702281931/src/bin/e_bindings.c --- e20-201702271931/src/bin/e_bindings.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_bindings.c 2017-02-28 19:31:37.000000000 +0000 @@ -125,7 +125,7 @@ event->direction = ev->direction; event->z = ev->z; event->canvas.x = e_comp_canvas_x_root_adjust(ev->root.x); - event->canvas.y = e_comp_canvas_x_root_adjust(ev->root.y); + event->canvas.y = e_comp_canvas_y_root_adjust(ev->root.y); event->timestamp = ev->timestamp; event->modifiers = _e_bindings_modifiers(ev->modifiers); } @@ -136,7 +136,7 @@ memset(event, 0, sizeof(E_Binding_Event_Mouse_Button)); event->button = ev->buttons; event->canvas.x = e_comp_canvas_x_root_adjust(ev->root.x); - event->canvas.y = e_comp_canvas_x_root_adjust(ev->root.y); + event->canvas.y = e_comp_canvas_y_root_adjust(ev->root.y); event->timestamp = ev->timestamp; event->modifiers = _e_bindings_modifiers(ev->modifiers); @@ -904,7 +904,7 @@ ed->obj = obj; ed->act = act; ed->ev = ev2; - binding->timer = ecore_timer_add(((double)binding->delay), _e_bindings_edge_cb_timer, ed); + binding->timer = ecore_timer_loop_add(((double)binding->delay), _e_bindings_edge_cb_timer, ed); return act; } diff -Nru e20-201702271931/src/bin/e_bryce.c e20-201702281931/src/bin/e_bryce.c --- e20-201702271931/src/bin/e_bryce.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_bryce.c 2017-02-28 19:31:37.000000000 +0000 @@ -301,9 +301,9 @@ { if (b->autohide_blocked) return; if (b->autohide_timer) - ecore_timer_reset(b->autohide_timer); + ecore_timer_loop_reset(b->autohide_timer); else - b->autohide_timer = ecore_timer_add(1.0, (Ecore_Task_Cb)_bryce_autohide_timeout, b); + b->autohide_timer = ecore_timer_loop_add(1.0, (Ecore_Task_Cb)_bryce_autohide_timeout, b); } static void @@ -501,9 +501,9 @@ if (size && (b->size != size)) { if (b->save_timer) - ecore_timer_reset(b->save_timer); + ecore_timer_loop_reset(b->save_timer); else - b->save_timer = ecore_timer_add(0.5, _bryce_moveresize_save, b); + b->save_timer = ecore_timer_loop_add(0.5, _bryce_moveresize_save, b); } if (starting) return; diff -Nru e20-201702271931/src/bin/e_bryce_editor.c e20-201702281931/src/bin/e_bryce_editor.c --- e20-201702271931/src/bin/e_bryce_editor.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_bryce_editor.c 2017-02-28 19:31:37.000000000 +0000 @@ -96,9 +96,9 @@ e_gadget_site_gadget_add(site, "Start", 0); e_gadget_site_gadget_add(site, "Digital Clock", 0); e_gadget_site_gadget_add(site, "Wireless", 0); + evas_object_move(b, zone->x, zone->y); } - evas_object_move(b, zone->x, zone->y); e_gadget_site_gravity_set(site, gravity); e_bryce_style_set(b, bi->style); e_bryce_autohide_set(b, bi->autohide); diff -Nru e20-201702271931/src/bin/e_client.c e20-201702281931/src/bin/e_client.c --- e20-201702271931/src/bin/e_client.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_client.c 2017-02-28 19:31:37.000000000 +0000 @@ -55,31 +55,7 @@ EINTERN void e_client_focused_set(E_Client *ec); -static Eina_Inlist *_e_client_hooks[] = -{ - [E_CLIENT_HOOK_EVAL_PRE_FETCH] = NULL, - [E_CLIENT_HOOK_EVAL_FETCH] = NULL, - [E_CLIENT_HOOK_EVAL_PRE_POST_FETCH] = NULL, - [E_CLIENT_HOOK_EVAL_POST_FETCH] = NULL, - [E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN] = NULL, - [E_CLIENT_HOOK_EVAL_POST_FRAME_ASSIGN] = NULL, - [E_CLIENT_HOOK_EVAL_PRE_NEW_CLIENT] = NULL, - [E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT] = NULL, - [E_CLIENT_HOOK_EVAL_END] = NULL, - [E_CLIENT_HOOK_FOCUS_SET] = NULL, - [E_CLIENT_HOOK_FOCUS_UNSET] = NULL, - [E_CLIENT_HOOK_NEW_CLIENT] = NULL, - [E_CLIENT_HOOK_DESK_SET] = NULL, - [E_CLIENT_HOOK_MOVE_BEGIN] = NULL, - [E_CLIENT_HOOK_MOVE_UPDATE] = NULL, - [E_CLIENT_HOOK_MOVE_END] = NULL, - [E_CLIENT_HOOK_RESIZE_BEGIN] = NULL, - [E_CLIENT_HOOK_RESIZE_UPDATE] = NULL, - [E_CLIENT_HOOK_RESIZE_END] = NULL, - [E_CLIENT_HOOK_DEL] = NULL, - [E_CLIENT_HOOK_UNREDIRECT] = NULL, - [E_CLIENT_HOOK_REDIRECT] = NULL, -}; +static Eina_Inlist *_e_client_hooks[E_CLIENT_HOOK_LAST] = {NULL}; /////////////////////////////////////////// @@ -618,11 +594,12 @@ else { if (!ec->exe_inst->deleted) - ec->exe_inst->clients = eina_list_remove(ec->exe_inst->clients, ec); + { + ec->exe_inst->clients = eina_list_remove(ec->exe_inst->clients, ec); + ec->exe_inst = NULL; + } } } - if (ec->exe_inst && (!ec->exe_inst->deleted)) - ec->exe_inst = NULL; _e_client_mouse_action_end(ec); if (action_client == ec) _e_client_action_finish(); @@ -875,7 +852,7 @@ { E_FREE_FUNC(action_timer, ecore_timer_del); if (EINA_DBL_NONZERO(e_config->border_keyboard.timeout)) - action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL); + action_timer = ecore_timer_loop_add(e_config->border_keyboard.timeout, _e_client_action_move_timeout, NULL); } static Eina_Bool @@ -1095,7 +1072,7 @@ { E_FREE_FUNC(action_timer, ecore_timer_del); if (EINA_DBL_NONZERO(e_config->border_keyboard.timeout)) - action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL); + action_timer = ecore_timer_loop_add(e_config->border_keyboard.timeout, _e_client_action_resize_timeout, NULL); } static Eina_Bool @@ -1582,28 +1559,7 @@ evas_object_geometry_get(ec->frame, &x, &y, NULL, NULL); if (ec->stack.prev || ec->stack.next) { - if (ec->stack.ignore == 0) - { - Eina_List *l, *list = e_client_stack_list_prepare(ec); - E_Client *child; - Evas_Coord bx, by, bw, bh, cw, ch, dx, dy; - - child = e_client_stack_bottom_get(ec); - dx = x - ec->pre_cb.x; - dy = y - ec->pre_cb.y; - if (child != ec) - evas_object_move(child->frame, child->x + dx, child->y + dy); - evas_object_geometry_get(child->frame, &bx, &by, &bw, &bh); - EINA_LIST_FOREACH(list->next, l, child) - { - if (child == ec) continue; - evas_object_geometry_get(child->frame, NULL, NULL, &cw, &ch); - evas_object_move(child->frame, - bx + ((bw - cw) / 2), - by + ((bh - ch) / 2)); - } - e_client_stack_list_finish(list); - } + // do nothing - handled by idle enterer eval } else { @@ -1642,81 +1598,7 @@ evas_object_geometry_get(ec->frame, &x, &y, &w, &h); if (ec->stack.prev || ec->stack.next) { - if (ec->stack.ignore == 0) - { - Eina_List *l, *list = e_client_stack_list_prepare(ec); - E_Client *child; - Evas_Coord bx, by, bw, bh, cw, ch; - - if (e_client_util_resizing_get(ec)) - { - if (ec->dialog) - { - child = list->data; - evas_object_geometry_get(child->frame, &bx, &by, &bw, &bh); - EINA_LIST_FOREACH(list, l, child) - { - if (child == ec) continue; - if (!ec->dialog) - { - evas_object_resize(child->frame, bw, bh); - cw = bw; - ch = bh; - } - else - evas_object_geometry_get(child->frame, NULL, NULL, &cw, &ch); - evas_object_move(child->frame, - bx + ((bw - cw) / 2), - by + ((bh - ch) / 2)); - } - } - else - { - child = e_client_stack_bottom_get(ec); - evas_object_move(child->frame, x, y); - evas_object_resize(child->frame, w, h); - EINA_LIST_FOREACH(list->next, l, child) - { - if (child == ec) continue; - if (!ec->dialog) - { - evas_object_move(child->frame, x, y); - evas_object_resize(child->frame, w, h); - cw = w; - ch = h; - } - else - evas_object_geometry_get(child->frame, NULL, NULL, &cw, &ch); - evas_object_move(child->frame, - x + ((w - cw) / 2), - y + ((h - ch) / 2)); - } - } - } - else - { - if (ec == e_client_stack_bottom_get(ec)) - { - EINA_LIST_FOREACH(list->next, l, child) - { - if (child == ec) continue; - if (!ec->dialog) - { - evas_object_move(child->frame, x, y); - evas_object_resize(child->frame, w, h); - cw = w; - ch = h; - } - else - evas_object_geometry_get(child->frame, NULL, NULL, &cw, &ch); - evas_object_move(child->frame, - x + ((w - cw) / 2), - y + ((h - ch) / 2)); - } - } - } - e_client_stack_list_finish(list); - } + // do nothing - handled by idle enterer eval } else { @@ -1844,6 +1726,8 @@ int rem_change = 0; int send_event = 1; unsigned int prop = 0; + int zx = 0, zy = 0, zw = 0, zh = 0; + if (e_object_is_del(E_OBJECT(ec))) { @@ -1856,8 +1740,6 @@ if ((ec->new_client) && (!e_client_util_ignored_get(ec)) && (ec->zone)) { - int zx = 0, zy = 0, zw = 0, zh = 0; - _e_client_event_simple(ec, E_EVENT_CLIENT_ADD); e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh); /* enforce wm size hints for initial sizing */ @@ -1868,7 +1750,7 @@ } e_client_resize_limit(ec, &ec->w, &ec->h); - if (ec->re_manage) + if (ec->re_manage && e_comp_object_frame_exists(ec->frame)) { int x = ec->x, y = ec->y; if (ec->x) e_comp_object_frame_xy_adjust(ec->frame, ec->x, 0, &ec->x, NULL); @@ -1887,95 +1769,95 @@ evas_object_resize(ec->frame, ec2->w, ec2->h); ec->stack.ignore--; } - if (!ec->placed) + } + if ((!e_client_util_ignored_get(ec)) && ec->zone && ec->visible && (!ec->placed)) + { + if (ec->parent) { - if (ec->parent) + Eina_Bool centered = EINA_FALSE; + if (ec->parent->zone != e_zone_current_get()) { - Eina_Bool centered = EINA_FALSE; - if (ec->parent->zone != e_zone_current_get()) - { - e_client_zone_set(ec, ec->parent->zone); - e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh); - } + e_client_zone_set(ec, ec->parent->zone); + e_zone_useful_geometry_get(ec->zone, &zx, &zy, &zw, &zh); + } - if (evas_object_visible_get(ec->parent->frame)) + if (evas_object_visible_get(ec->parent->frame)) + { + if ((!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) || + (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->parent->x, ec->parent->y, ec->parent->w, ec->parent->h))) { - if ((!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) || - (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, ec->parent->x, ec->parent->y, ec->parent->w, ec->parent->h))) - { - int x, y; + int x, y; - e_comp_object_util_center_pos_get(ec->parent->frame, &x, &y); - if (E_CONTAINS(x, y, ec->w, ec->h, zx, zy, zw, zh)) - { - ec->x = x, ec->y = y; - } - else + e_comp_object_util_center_pos_get(ec->parent->frame, &x, &y); + if (E_CONTAINS(x, y, ec->w, ec->h, zx, zy, zw, zh)) + { + ec->x = x, ec->y = y; + } + else + { + x = ec->parent->x; + y = ec->parent->y; + if (!E_CONTAINS(x, y, ec->w, ec->h, zx, zy, zw, zh)) { - x = ec->parent->x; - y = ec->parent->y; - if (!E_CONTAINS(x, y, ec->w, ec->h, zx, zy, zw, zh)) - { - e_comp_object_util_center_on(ec->frame, - ec->parent->frame); - centered = 1; - } + e_comp_object_util_center_on(ec->frame, + ec->parent->frame); + centered = 1; } - ec->changes.pos = 1; } + ec->changes.pos = 1; } - else - { - e_comp_object_util_center_on(ec->frame, - ec->parent->frame); - centered = 1; - } - if (centered) //test for offscreen + } + else + { + e_comp_object_util_center_on(ec->frame, + ec->parent->frame); + centered = 1; + } + if (centered) //test for offscreen + { + if (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) { - if (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, zh)) - { - if (ec->x < zx) - ec->x = ec->parent->x; - if (ec->y < zy) - ec->y = ec->parent->y; - if (ec->x + ec->w > zx + zw) - ec->x = ec->parent->x + ec->parent->w - ec->w; - if (ec->y + ec->h > zy + zh) - ec->y = ec->parent->y + ec->parent->h - ec->h; - ec->changes.pos = 1; - } + if (ec->x < zx) + ec->x = ec->parent->x; + if (ec->y < zy) + ec->y = ec->parent->y; + if (ec->x + ec->w > zx + zw) + ec->x = ec->parent->x + ec->parent->w - ec->w; + if (ec->y + ec->h > zy + zh) + ec->y = ec->parent->y + ec->parent->h - ec->h; + ec->changes.pos = 1; } - ec->placed = 1; - ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y; } + ec->placed = 1; + ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y; + } #if 0 - else if ((ec->leader) && (ec->dialog)) + else if ((ec->leader) && (ec->dialog)) + { + /* TODO: Place in center of group */ + } +#endif + else if (ec->dialog) + { + E_Client *trans_ec = NULL; + + if (ec->icccm.transient_for) + trans_ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ec->icccm.transient_for); + if (trans_ec) { - /* TODO: Place in center of group */ + // if transient for a window and not placed, center on + // transient parent if found + ec->x = trans_ec->x + ((trans_ec->w - ec->w) / 2); + ec->y = trans_ec->y + ((trans_ec->h - ec->h) / 2); } -#endif - else if (ec->dialog) + else { - E_Client *trans_ec = NULL; - - if (ec->icccm.transient_for) - trans_ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, ec->icccm.transient_for); - if (trans_ec) - { - // if transient for a window and not placed, center on - // transient parent if found - ec->x = trans_ec->x + ((trans_ec->w - ec->w) / 2); - ec->y = trans_ec->y + ((trans_ec->h - ec->h) / 2); - } - else - { - ec->x = zx + ((zw - ec->w) / 2); - ec->y = zy + ((zh - ec->h) / 2); - } - ec->changes.pos = 1; - ec->placed = 1; - ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y; + ec->x = zx + ((zw - ec->w) / 2); + ec->y = zy + ((zh - ec->h) / 2); } + ec->changes.pos = 1; + ec->placed = 1; + ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y; } if (!ec->placed) @@ -2542,6 +2424,53 @@ if (e_config->screen_limits != E_CLIENT_OFFSCREEN_LIMIT_ALLOW_FULL) _e_client_move_lost_window_to_center(ec); } + // handle window stack + if (!ec->stack.prev && ec->stack.next) + { + if (ec->stack.ignore == 0) + { + Eina_List *ll, *list = e_client_stack_list_prepare(ec); + E_Client *child, *bottom, *moving = NULL, *rel; + int x, y; + + bottom = rel = e_client_stack_bottom_get(ec); + EINA_LIST_FOREACH(list, ll, child) + { + if (child->moving) + { + moving = child; + break; + } + } + if (moving) + { + Evas_Coord ox, oy; + + evas_object_geometry_get(ec->frame, &ox, &oy, NULL, NULL); + rel = moving; + } + EINA_LIST_FOREACH(list, ll, child) + { + if (moving) + { + if (child == moving) continue; + } + else if (child == bottom) continue; + x = rel->x + ((rel->w - child->w) / 2); + y = rel->y + ((rel->h - child->h) / 2); + if ((x != child->x) || (y != child->y)) + { + child->x = x; + child->y = y; + child->pre_cb.x = x; + child->pre_cb.y = y; + child->changes.pos = 1; + child->changed = 1; + } + } + e_client_stack_list_finish(list); + } + } } if (_e_client_layout_cb) @@ -2639,6 +2568,7 @@ focus_stack = eina_list_append(focus_stack, ec); } _e_client_event_simple(ec, E_EVENT_CLIENT_ADD); + _e_client_hook_call(E_CLIENT_HOOK_UNIGNORE, ec); } E_API E_Client * @@ -5000,7 +4930,7 @@ if ((ec->netwm.pid > 1) && (e_config->kill_process)) { kill(ec->netwm.pid, SIGINT); - ec->kill_timer = ecore_timer_add(e_config->kill_timer_wait, + ec->kill_timer = ecore_timer_loop_add(e_config->kill_timer_wait, _e_client_cb_kill_timer, ec); } else @@ -5471,7 +5401,7 @@ warp_client = ec; ecore_evas_pointer_xy_get(e_comp->ee, &warp_x[0], &warp_y[0]); if (warp_timer) ecore_timer_del(warp_timer); - warp_timer = ecore_timer_add(0.01, _e_client_pointer_warp_to_center_timer, ec); + warp_timer = ecore_timer_loop_add(0.01, _e_client_pointer_warp_to_center_timer, ec); return 1; } @@ -5530,3 +5460,51 @@ _e_client_layout_cb = cb; } +//////////////////////////////////////////// + +E_API void +e_client_parent_set(E_Client *ec, E_Client *parent) +{ + E_OBJECT_CHECK(ec); + E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); + if (parent) + { + E_OBJECT_CHECK(parent); + E_OBJECT_TYPE_CHECK(parent, E_CLIENT_TYPE); + } + + if (ec == parent) + { + ERR("refusing to set client as its own parent"); + return; + } + + if (parent && (parent->parent == ec)) + { + ERR("refusing to set client as its parent's parent"); + return; + } + + if (ec->parent == parent) return; + + /* If we already have a parent, remove it */ + if (ec->parent) + { + ec->parent->transients = eina_list_remove(ec->parent->transients, ec); + if (ec->parent->modal == ec) ec->parent->modal = NULL; + ec->parent = NULL; + } + if (parent) + { + parent->transients = eina_list_append(parent->transients, ec); + ec->parent = parent; + } + if (ec->parent && (!e_client_util_ignored_get(ec))) + { + evas_object_layer_set(ec->frame, ec->parent->layer); + + if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) || + (ec->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED))) + ec->take_focus = 1; + } +} diff -Nru e20-201702271931/src/bin/e_client.h e20-201702281931/src/bin/e_client.h --- e20-201702271931/src/bin/e_client.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_client.h 2017-02-28 19:31:37.000000000 +0000 @@ -169,6 +169,7 @@ E_CLIENT_HOOK_DEL, E_CLIENT_HOOK_UNREDIRECT, E_CLIENT_HOOK_REDIRECT, + E_CLIENT_HOOK_UNIGNORE, E_CLIENT_HOOK_LAST, } E_Client_Hook_Point; @@ -860,5 +861,6 @@ YOLO E_API void e_client_focus_stack_set(Eina_List *l); +E_API void e_client_parent_set(E_Client *ec, E_Client *parent); #include "e_client.x" #endif diff -Nru e20-201702271931/src/bin/e_client_volume.c e20-201702281931/src/bin/e_client_volume.c --- e20-201702271931/src/bin/e_client_volume.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_client_volume.c 2017-02-28 19:31:37.000000000 +0000 @@ -3,11 +3,15 @@ E_API int E_EVENT_CLIENT_VOLUME = -1; E_API int E_EVENT_CLIENT_MUTE = -1; E_API int E_EVENT_CLIENT_UNMUTE = -1; +E_API int E_EVENT_CLIENT_VOLUME_SINK_ADD = -1; +E_API int E_EVENT_CLIENT_VOLUME_SINK_DEL = -1; +E_API int E_EVENT_CLIENT_VOLUME_SINK_CHANGED = -1; static void _e_client_volume_event_simple_free(void *d, E_Event_Client *ev); static void _e_client_volume_event_simple(E_Client *ec, int type); static void _e_client_volume_object_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_client_volume_object_volume_changed(void *data, Evas_Object *obj, void *event_info); +static void _e_client_volume_object_volume_drag_stop(void *data, Evas_Object *obj, void *event_info); static Eina_Bool _e_client_volume_object_changed(void *data, int type, void *event); static void _e_client_volume_object_del_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); @@ -33,6 +37,28 @@ } static void +_e_client_volume_sink_event_simple_free(void *d EINA_UNUSED, E_Event_Client_Volume_Sink *ev) +{ + UNREFD(ev->ec, 3); + e_object_unref(E_OBJECT(ev->ec)); + free(ev); +} + +static void +_e_client_volume_sink_event_simple(E_Client *ec, E_Client_Volume_Sink *sink, int type) +{ + E_Event_Client_Volume_Sink *ev; + + ev = E_NEW(E_Event_Client_Volume_Sink, 1); + ev->ec = ec; + ev->sink = sink; + REFD(ec, 3); + e_object_ref(E_OBJECT(ec)); + ecore_event_add(type, ev, + (Ecore_End_Cb)_e_client_volume_sink_event_simple_free, NULL); +} + +static void _e_client_volume_object_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { E_Client *ec; @@ -52,6 +78,16 @@ e_client_volume_set(ec, elm_slider_value_get(obj)); } +static void +_e_client_volume_object_volume_drag_stop(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + E_Client *ec; + + ec = data; + + e_client_volume_set(ec, elm_slider_value_get(obj)); +} + static Eina_Bool _e_client_volume_object_changed(void *data, int type EINA_UNUSED, void *event) { @@ -107,6 +143,9 @@ E_EVENT_CLIENT_VOLUME = ecore_event_type_new(); E_EVENT_CLIENT_MUTE = ecore_event_type_new(); E_EVENT_CLIENT_UNMUTE = ecore_event_type_new(); + E_EVENT_CLIENT_VOLUME_SINK_ADD = ecore_event_type_new(); + E_EVENT_CLIENT_VOLUME_SINK_DEL = ecore_event_type_new(); + E_EVENT_CLIENT_VOLUME_SINK_CHANGED = ecore_event_type_new(); return EINA_TRUE; } @@ -117,7 +156,7 @@ } E_API E_Client_Volume_Sink * -e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, void *data) +e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, E_Client_Volume_Sink_Name_Get func_name_get, void *data) { E_Client_Volume_Sink *sink; @@ -126,6 +165,7 @@ sink->func_get = func_get; sink->func_min_get = func_min_get; sink->func_max_get = func_max_get; + sink->func_name_get = func_name_get; sink->data = data; return sink; @@ -140,6 +180,8 @@ { ec->sinks = eina_list_remove(ec->sinks, sink); e_comp_object_frame_volume_update(ec->frame); + _e_client_volume_sink_event_simple(ec, sink, + E_EVENT_CLIENT_VOLUME_SINK_DEL); } free(sink); } @@ -179,11 +221,79 @@ return 0; } +E_API const char * +e_client_volume_sink_name_get(const E_Client_Volume_Sink *sink) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sink, 0); + if (sink->func_name_get) + return sink->func_name_get(sink->data); + return NULL; +} + +static void +_e_client_volume_update(E_Client *ec) +{ + E_Client_Volume_Sink *sink; + Eina_List *l; + int volume_min, volume_max, volume, count; + Eina_Bool mute; + + mute = EINA_TRUE; + volume = 0; + volume_min = 9999999; + volume_max = 0; + count = 0; + EINA_LIST_FOREACH(ec->sinks, l, sink) + { + int volume_min2, volume_max2, volume2; + Eina_Bool mute2; + + volume_min2 = e_client_volume_sink_min_get(sink); + volume_max2 = e_client_volume_sink_max_get(sink); + if (volume_min2 < volume_min) volume_min = volume_min2; + if (volume_max2 > volume_max) volume_max = volume_max2; + e_client_volume_sink_get(sink, &volume2, &mute2); + if (!mute2) + { + mute = EINA_FALSE; + volume += volume2; + count++; + } + } + if (ec->sinks) + { + ec->volume_min = volume_min; + ec->volume_max = volume_max; + if (count == 0) + { + if (ec->volume < volume_min) + ec->volume = volume_min; + if (ec->volume > volume_max) + ec->volume = volume_max; + } + else + ec->volume = volume / count; + ec->mute = mute; + ec->volume_control_enabled = EINA_TRUE; + } + else + { + ec->volume_min = 0; + ec->volume_max = 0; + ec->volume = 0; + ec->mute = EINA_FALSE; + ec->volume_control_enabled = EINA_FALSE; + } + if (ec->volume_control_enabled) + { + e_comp_object_frame_volume_update(ec->frame); + e_client_volume_display_set(ec, ec->volume, ec->mute); + } +} + E_API void e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *sink) { - int volume_min; - int volume_max; int volume; Eina_Bool mute; @@ -191,24 +301,7 @@ ec->sinks = eina_list_append(ec->sinks, sink); sink->clients = eina_list_append(sink->clients, ec); - if (ec->volume_control_enabled) - { - volume_min = e_client_volume_sink_min_get(sink); - if (ec->volume_min < volume_min) - ec->volume_min = volume_min; - volume_max = e_client_volume_sink_max_get(sink); - if (ec->volume_max > volume_max) - ec->volume_max = volume_max; - if ((ec->volume_min > ec->volume) - || (ec->volume_max < ec->volume)) - e_client_volume_set(ec, ec->volume); - e_client_volume_sink_get(sink, &volume, &mute); - if ((ec->volume != volume) || (ec->mute != mute)) - { - e_client_volume_sink_set(sink, ec->volume, ec->mute); - } - } - else + if (!ec->volume_control_enabled) { ec->volume_min = e_client_volume_sink_min_get(sink); ec->volume_max = e_client_volume_sink_max_get(sink); @@ -217,7 +310,9 @@ ec->mute = !!mute; ec->volume_control_enabled = EINA_TRUE; } - e_comp_object_frame_volume_update(ec->frame); + _e_client_volume_update(ec); + _e_client_volume_sink_event_simple(ec, sink, + E_EVENT_CLIENT_VOLUME_SINK_ADD); } E_API void @@ -226,28 +321,40 @@ EINA_SAFETY_ON_NULL_RETURN(ec); ec->sinks = eina_list_remove(ec->sinks, sink); sink->clients = eina_list_remove(sink->clients, ec); - e_comp_object_frame_volume_update(ec->frame); + _e_client_volume_update(ec); + _e_client_volume_sink_event_simple(ec, sink, + E_EVENT_CLIENT_VOLUME_SINK_DEL); } E_API void e_client_volume_sink_update(E_Client_Volume_Sink *sink) { Eina_List *l; - int volume; - Eina_Bool mute; E_Client *ec; EINA_SAFETY_ON_NULL_RETURN(sink); - e_client_volume_sink_get(sink, &volume, &mute); EINA_LIST_FOREACH(sink->clients, l, ec) { - e_client_volume_set(ec, volume); - e_client_volume_mute_set(ec, mute); + _e_client_volume_update(ec); + _e_client_volume_sink_event_simple(ec, sink, + E_EVENT_CLIENT_VOLUME_SINK_CHANGED); } } E_API void +e_client_volume_display_set(E_Client *ec, int volume, Eina_Bool mute) +{ + ec->volume = volume; + ec->mute = !!mute; + if (mute) + _e_client_volume_event_simple(ec, E_EVENT_CLIENT_MUTE); + else + _e_client_volume_event_simple(ec, E_EVENT_CLIENT_UNMUTE); + _e_client_volume_event_simple(ec, E_EVENT_CLIENT_VOLUME); +} + +E_API void e_client_volume_set(E_Client *ec, int volume) { Eina_List *l; @@ -264,6 +371,7 @@ e_client_volume_sink_set(sink, ec->volume, ec->mute); } + _e_client_volume_update(ec); _e_client_volume_event_simple(ec, E_EVENT_CLIENT_VOLUME); } @@ -334,6 +442,9 @@ evas_object_smart_callback_add(o, "changed", _e_client_volume_object_volume_changed, ec); + evas_object_smart_callback_add(o, "slider,drag,stop", + _e_client_volume_object_volume_drag_stop, + ec); elm_slider_value_set(o, ec->volume); edje_object_part_swallow(bx, "e.swallow.volume", o); evas_object_show(o); diff -Nru e20-201702271931/src/bin/e_client_volume.h e20-201702281931/src/bin/e_client_volume.h --- e20-201702271931/src/bin/e_client_volume.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_client_volume.h 2017-02-28 19:31:37.000000000 +0000 @@ -2,15 +2,20 @@ #define E_CLIENT_VOLUME_H_ typedef struct _E_Client_Volume_Sink E_Client_Volume_Sink; +typedef struct _E_Event_Client_Volume_Sink E_Event_Client_Volume_Sink; typedef void (*E_Client_Volume_Sink_Get)(int *volume, Eina_Bool *mute, void *data); typedef void (*E_Client_Volume_Sink_Set)(int volume, Eina_Bool mute, void *data); typedef int (*E_Client_Volume_Sink_Min_Get)(void *data); typedef int (*E_Client_Volume_Sink_Max_Get)(void *data); +typedef const char *(*E_Client_Volume_Sink_Name_Get)(void *data); E_API extern int E_EVENT_CLIENT_VOLUME; E_API extern int E_EVENT_CLIENT_MUTE; E_API extern int E_EVENT_CLIENT_UNMUTE; +E_API extern int E_EVENT_CLIENT_VOLUME_SINK_ADD; +E_API extern int E_EVENT_CLIENT_VOLUME_SINK_DEL; +E_API extern int E_EVENT_CLIENT_VOLUME_SINK_CHANGED; struct _E_Client_Volume_Sink { @@ -18,10 +23,17 @@ E_Client_Volume_Sink_Set func_set; E_Client_Volume_Sink_Min_Get func_min_get; E_Client_Volume_Sink_Max_Get func_max_get; + E_Client_Volume_Sink_Name_Get func_name_get; void *data; Eina_List *clients; }; +struct _E_Event_Client_Volume_Sink +{ + E_Client *ec; + E_Client_Volume_Sink *sink; +}; + EINTERN int e_client_volume_init(void); EINTERN void e_client_volume_shutdown(void); @@ -31,14 +43,17 @@ E_API Evas_Object *e_client_volume_object_add(E_Client *ec, Evas *evas); -E_API E_Client_Volume_Sink *e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, void *data); +E_API E_Client_Volume_Sink *e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, E_Client_Volume_Sink_Name_Get func_name_get, void *data); E_API void e_client_volume_sink_del(E_Client_Volume_Sink *mixer); E_API void e_client_volume_sink_set(E_Client_Volume_Sink *mixer, int volume, Eina_Bool mute); E_API void e_client_volume_sink_get(const E_Client_Volume_Sink *mixer, int *volume, Eina_Bool *mute); E_API int e_client_volume_sink_min_get(const E_Client_Volume_Sink *mixer); E_API int e_client_volume_sink_max_get(const E_Client_Volume_Sink *mixer); +E_API const char * e_client_volume_sink_name_get(const E_Client_Volume_Sink *mixer); E_API void e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *mixer); E_API void e_client_volume_sink_remove(E_Client *ec, E_Client_Volume_Sink *mixer); E_API void e_client_volume_sink_update(E_Client_Volume_Sink *mixer); +E_API void e_client_volume_display_set(E_Client *ec, int volume, Eina_Bool mute); + #endif diff -Nru e20-201702271931/src/bin/e_comp.c e20-201702281931/src/bin/e_comp.c --- e20-201702271931/src/bin/e_comp.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp.c 2017-02-28 19:31:37.000000000 +0000 @@ -41,6 +41,7 @@ E_API int E_EVENT_COMPOSITOR_RESIZE = -1; E_API int E_EVENT_COMPOSITOR_DISABLE = -1; E_API int E_EVENT_COMPOSITOR_ENABLE = -1; +E_API int E_EVENT_COMPOSITOR_XWAYLAND_INIT = -1; ////////////////////////////////////////////////////////////////////////// #undef DBG @@ -408,7 +409,7 @@ Evas_Coord x = 0, y = 0, w = 0, h = 0; E_Zone *z; - t = ecore_time_get(); + t = ecore_loop_time_get(); if (conf->fps_average_range < 1) conf->fps_average_range = 30; else if (conf->fps_average_range > 120) @@ -526,7 +527,7 @@ else if ((!e_comp->nocomp) && (!e_comp->nocomp_override)) { if (!e_comp->nocomp_delay_timer) - e_comp->nocomp_delay_timer = ecore_timer_add(1.0, _e_comp_cb_nocomp_begin_timeout, NULL); + e_comp->nocomp_delay_timer = ecore_timer_loop_add(1.0, _e_comp_cb_nocomp_begin_timeout, NULL); } } } @@ -775,7 +776,7 @@ i = 0; EINA_ITERATOR_FOREACH(ti, tr) { - exr[i++] = *(Eina_Rectangle*)((char*)tr); + exr[i++] = *((Eina_Rectangle *)tr); if (i == tile_count - 1) exr = realloc(exr, sizeof(Eina_Rectangle) * (tile_count *= 2)); #ifdef SHAPE_DEBUG @@ -944,7 +945,7 @@ switch (obj->type) { case E_CLIENT_TYPE: - return ((E_Client*)obj)->frame; + return ((E_Client *)(void *)obj)->frame; case E_ZONE_TYPE: case E_COMP_TYPE: case E_MENU_TYPE: @@ -952,7 +953,7 @@ return ec ? ec->frame : NULL; } if (e_obj_is_win(obj)) - return e_win_client_get((void*)obj)->frame; + return e_win_client_get((void *)obj)->frame; ec = e_client_focused_get(); return ec ? ec->frame : NULL; } @@ -1023,6 +1024,7 @@ E_EVENT_COMP_OBJECT_ADD = ecore_event_type_new(); E_EVENT_COMPOSITOR_DISABLE = ecore_event_type_new(); E_EVENT_COMPOSITOR_ENABLE = ecore_event_type_new(); + E_EVENT_COMPOSITOR_XWAYLAND_INIT = ecore_event_type_new(); ignores = eina_hash_pointer_new(NULL); @@ -1348,7 +1350,7 @@ } evas_object_data_set(orec0, "list", style_list); evas_object_data_set(oi, "style_shadows", style_shadows); - timer = ecore_timer_add(3.0, _style_demo, oi); + timer = ecore_timer_loop_add(3.0, _style_demo, oi); evas_object_data_set(oi, "style_timer", timer); evas_object_data_set(oi, "style_demo_state", (void *)1); e_widget_size_min_get(oi, &wmw, &wmh); @@ -1607,7 +1609,7 @@ if (e_comp->nocomp_override_timer) e_comp->nocomp_override--; else - e_comp->nocomp_override_timer = ecore_timer_add(1.0, _e_comp_override_expire, NULL); + e_comp->nocomp_override_timer = ecore_timer_loop_add(1.0, _e_comp_override_expire, NULL); } E_API unsigned int @@ -1620,7 +1622,7 @@ switch (obj->type) { case E_GADCON_CLIENT_TYPE: - gc = ((E_Gadcon_Client *)(obj))->gadcon; + gc = ((E_Gadcon_Client *)(void *)(obj))->gadcon; EINA_SAFETY_ON_NULL_RETURN_VAL(gc, 0); /* no break */ case E_GADCON_TYPE: @@ -1633,7 +1635,7 @@ return E_LAYER_DESKTOP; case E_CLIENT_TYPE: - return ((E_Client *)(obj))->layer; + return ((E_Client *)(void *)(obj))->layer; /* FIXME: add more types as needed */ default: @@ -1666,11 +1668,16 @@ { if (ec) evas_object_focus_set(ec->frame, 0); + +#ifdef HAVE_WAYLAND + e_comp_wl_extension_pointer_unconstrain(NULL); +#endif } ret = EINA_TRUE; e_comp->input_mouse_grabs += mouse; e_comp->input_key_grabs += kbd; + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) { if (ec && (!e_object_is_del(E_OBJECT(ec)))) @@ -1725,13 +1732,13 @@ E_API Eina_Bool e_comp_util_kbd_grabbed(void) { - return e_menu_grab_window_get() || e_client_action_get() || e_grabinput_key_win_get(); + return e_menu_is_active() || e_client_action_get() || e_grabinput_key_win_get(); } E_API Eina_Bool e_comp_util_mouse_grabbed(void) { - return e_menu_grab_window_get() || e_client_action_get() || e_grabinput_mouse_win_get(); + return e_menu_is_active() || e_client_action_get() || e_grabinput_mouse_win_get(); } E_API void diff -Nru e20-201702271931/src/bin/e_comp_canvas.c e20-201702281931/src/bin/e_comp_canvas.c --- e20-201702271931/src/bin/e_comp_canvas.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_canvas.c 2017-02-28 19:31:37.000000000 +0000 @@ -59,6 +59,7 @@ ec->on_post_updates = EINA_FALSE; if (!e_object_is_del(E_OBJECT(ec))) e_pixmap_image_clear(ec->pixmap, 1); + evas_object_smart_callback_call(ec->frame, "post_render", NULL); UNREFD(ec, 111); e_object_unref(E_OBJECT(ec)); } @@ -206,6 +207,24 @@ static Eina_Bool _e_comp_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev) { + static int x = -9999, y = -9999; + + if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return ECORE_CALLBACK_RENEW; + if (x == -9999) + x = ev->x, y = ev->y; + if ((x == ev->x) && (y == ev->y)) return ECORE_CALLBACK_RENEW; + if (e_client_focused_get() && (!e_comp_util_mouse_grabbed())) + { + if ((!e_comp->screen) || (!e_comp->screen->relative_motion)) + { + e_comp_wl_extension_relative_motion_event(ecore_time_unix_get() * 1000ULL, + ev->x - x, ev->y - y, 0, 0); + } + x = ev->x, y = ev->y; + if (e_comp_wl_extension_pointer_constraints_update(e_client_focused_get(), ev->x, ev->y)) + return ECORE_CALLBACK_CANCEL; + } + x = ev->x, y = ev->y; return e_comp_wl_grab_client_mouse_move(ev); } #endif @@ -240,7 +259,7 @@ { if (timer_post_screensaver_on) return; /* thawed in _e_comp_screensaver_off() */ - timer_post_screensaver_on = ecore_timer_add + timer_post_screensaver_on = ecore_timer_loop_add (1.0, _e_comp_cb_screensaver_active_delay, NULL); } @@ -261,7 +280,7 @@ if (e_config->desklock_post_screensaver_time <= 1.0) e_desklock_show_autolocked(); else - timer_post_screensaver_lock = ecore_timer_add + timer_post_screensaver_lock = ecore_timer_loop_add (e_config->desklock_post_screensaver_time, _e_comp_cb_timer_post_screensaver_lock, NULL); } diff -Nru e20-201702271931/src/bin/e_comp_cfdata.h e20-201702281931/src/bin/e_comp_cfdata.h --- e20-201702271931/src/bin/e_comp_cfdata.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_cfdata.h 2017-02-28 19:31:37.000000000 +0000 @@ -65,16 +65,16 @@ const char *visibility_effect; // effect to use when showing and hiding int primary_type; // Ecore_X_Window_Type - used for borders, overrides, first one found - ECORE_X_WINDOW_TYPE_UNKNOWN if not to be used - char borderless; // used for borders, 0 == dont use, 1 == borderless, -1 == not borderless - char dialog; // used for borders, 0 == don't use, 1 == dialog, -1 == not dialog - char accepts_focus; // used for borders, 0 == don't use, 1 == accepts focus, -1 == does not accept focus - char vkbd; // used for borders, 0 == don't use, 1 == is vkbd, -1 == not vkbd - char argb; // used for borders, overrides, popups, menus, 0 == don't use, 1 == is argb, -1 == not argb - char fullscreen; // used for borders, 0 == don't use, 1 == is fullscreen, -1 == not fullscreen - char modal; // used for borders, 0 == don't use, 1 == is modal, -1 == not modal - char focus; // used for setting focus state (on popups): 1 is focused, unset is use regular logic - char urgent; // used for setting urgent state (on popups): 1 is urgent, unset is use regular logic - char no_shadow; // set whether shadow is disabled + signed char borderless; // used for borders, 0 == dont use, 1 == borderless, -1 == not borderless + signed char dialog; // used for borders, 0 == don't use, 1 == dialog, -1 == not dialog + signed char accepts_focus; // used for borders, 0 == don't use, 1 == accepts focus, -1 == does not accept focus + signed char vkbd; // used for borders, 0 == don't use, 1 == is vkbd, -1 == not vkbd + signed char argb; // used for borders, overrides, popups, menus, 0 == don't use, 1 == is argb, -1 == not argb + signed char fullscreen; // used for borders, 0 == don't use, 1 == is fullscreen, -1 == not fullscreen + signed char modal; // used for borders, 0 == don't use, 1 == is modal, -1 == not modal + signed char focus; // used for setting focus state (on popups): 1 is focused, unset is use regular logic + signed char urgent; // used for setting urgent state (on popups): 1 is urgent, unset is use regular logic + signed char no_shadow; // set whether shadow is disabled }; E_API void e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd); diff -Nru e20-201702271931/src/bin/e_comp.h e20-201702281931/src/bin/e_comp.h --- e20-201702271931/src/bin/e_comp.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp.h 2017-02-28 19:31:37.000000000 +0000 @@ -53,6 +53,7 @@ extern E_API int E_EVENT_COMPOSITOR_DISABLE; extern E_API int E_EVENT_COMPOSITOR_ENABLE; +extern E_API int E_EVENT_COMPOSITOR_XWAYLAND_INIT; typedef void (*E_Comp_Cb)(void); @@ -74,6 +75,8 @@ Eina_Bool (*key_down)(Ecore_Event_Key *ev); /* is key event eaten */ Eina_Bool (*key_up)(Ecore_Event_Key *ev); + Eina_Bool relative_motion : 1; + Eina_Bool backlight_enabled : 1; } E_Comp_Screen_Iface; /* struct to hold canvas objects so that abi doesn't break diff -Nru e20-201702271931/src/bin/e_comp_object.c e20-201702281931/src/bin/e_comp_object.c --- e20-201702271931/src/bin/e_comp_object.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_object.c 2017-02-28 19:31:37.000000000 +0000 @@ -1118,6 +1118,7 @@ { /* only update xy position of client to avoid invalid * first damage region if it is not a new_client. */ + cw->ec->placed = 1; if (!cw->ec->shading) { cw->ec->client.x = ix; @@ -1200,9 +1201,12 @@ /* do nothing until client idler loops */ if (!cw->ec->maximized) { - cw->ec->w = w, cw->ec->h = h; - cw->ec->changes.size = 1; - EC_CHANGED(cw->ec); + if ((cw->ec->w != w) || (cw->ec->h != h)) + { + cw->ec->w = w, cw->ec->h = h; + cw->ec->changes.size = 1; + EC_CHANGED(cw->ec); + } } return; } @@ -2457,6 +2461,21 @@ } static void +_e_comp_object_input_rect_update(E_Comp_Object *cw) +{ + int x, y, w, h; + + if (!cw->input_obj) return; + x = cw->input_rect.x, y = cw->input_rect.y, w = cw->input_rect.w, h = cw->input_rect.h; + + E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, cw->ec->client.w, cw->ec->client.h); + evas_object_geometry_set(cw->input_obj, + cw->x + x + (!!cw->frame_object * cw->client_inset.l), + cw->y + y + (!!cw->frame_object * cw->client_inset.t), + w, h); +} + +static void _e_comp_smart_move(Evas_Object *obj, int x, int y) { Eina_List *l; @@ -2472,10 +2491,7 @@ evas_object_move(cw->clip, 0, 0); evas_object_move(cw->effect_obj, x, y); if (cw->input_obj) - evas_object_geometry_set(cw->input_obj, - cw->x + cw->input_rect.x + (!!cw->frame_object * cw->client_inset.l), - cw->y + cw->input_rect.y + (!!cw->frame_object * cw->client_inset.t), - cw->input_rect.w, cw->input_rect.h); + _e_comp_object_input_rect_update(cw); /* this gets called once during setup to init coords offscreen and guarantee first move */ if (e_comp && cw->visible) e_comp_shape_queue(); @@ -2520,10 +2536,7 @@ evas_object_resize(cw->effect_obj, w, h); if (cw->zoomobj) e_zoomap_child_resize(cw->zoomobj, pw, ph); if (cw->input_obj) - evas_object_geometry_set(cw->input_obj, - cw->x + cw->input_rect.x + (!!cw->frame_object * cw->client_inset.l), - cw->y + cw->input_rect.y + (!!cw->frame_object * cw->client_inset.t), - cw->input_rect.w, cw->input_rect.h); + _e_comp_object_input_rect_update(cw); /* resize render update tiler */ if (!first) { @@ -2858,6 +2871,8 @@ edje_object_signal_emit(obj, "e,state,shadow,on", "e"); else edje_object_signal_emit(obj, "e,state,shadow,off", "e"); + if (evas_object_visible_get(obj)) + edje_object_signal_emit(obj, "e,state,visible", "e"); if (content) edje_object_part_swallow(obj, "e.swallow.content", content); } @@ -3150,7 +3165,6 @@ API_ENTRY; //INF("%d,%d %dx%d", x, y, w, h); - E_RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, cw->ec->client.w, cw->ec->client.h); if ((cw->input_rect.x == x) && (cw->input_rect.y == y) && (cw->input_rect.w == w) && (cw->input_rect.h == h)) return; EINA_RECTANGLE_SET(&cw->input_rect, x, y, w, h); @@ -3165,9 +3179,7 @@ evas_object_clip_set(cw->input_obj, cw->clip); evas_object_smart_member_add(cw->input_obj, obj); } - evas_object_geometry_set(cw->input_obj, - cw->ec->client.x + (!!cw->frame_object * cw->client_inset.l) + x, - cw->ec->client.y + (!!cw->frame_object * cw->client_inset.t) + y, w, h); + _e_comp_object_input_rect_update(cw); evas_object_pass_events_set(cw->obj, 1); if (cw->visible) evas_object_show(cw->input_obj); } @@ -3186,7 +3198,12 @@ API_ENTRY EINA_FALSE; if (cw->input_obj) - return E_INSIDE(x, y, cw->x + cw->input_rect.x, cw->y + cw->input_rect.y, cw->input_rect.w, cw->input_rect.h); + { + int xx, yy, ww, hh; + + evas_object_geometry_get(cw->input_obj, &xx, &yy, &ww, &hh); + return E_INSIDE(x, y, xx, yy, ww, hh); + } if (evas_object_pass_events_get(obj)) return EINA_FALSE; return E_INSIDE(x, y, cw->ec->x, cw->ec->y, cw->ec->w, cw->ec->h); } @@ -3851,7 +3868,7 @@ if (cw->ec->input_only) return; E_FREE(cw->ns); if (ns) - cw->ns = (Evas_Native_Surface*)eina_memdup((unsigned char*)ns, sizeof(Evas_Native_Surface), 0); + cw->ns = (void *)eina_memdup((unsigned char *)ns, sizeof(Evas_Native_Surface), 0); _e_comp_object_alpha_set(cw); if (cw->native) e_comp_object_native_surface_set(obj, cw->native); diff -Nru e20-201702271931/src/bin/e_comp_wl.c e20-201702281931/src/bin/e_comp_wl.c --- e20-201702271931/src/bin/e_comp_wl.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_wl.c 2017-02-28 19:31:37.000000000 +0000 @@ -7,12 +7,7 @@ #include "www-server-protocol.h" -/* When a wayland is released with this macro we can remove the ifdefs */ -#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION -# define COMPOSITOR_VERSION 4 -#else -# define COMPOSITOR_VERSION 3 -#endif +#define COMPOSITOR_VERSION 4 E_API int E_EVENT_WAYLAND_GLOBAL_ADD = -1; @@ -124,7 +119,7 @@ int w = 0, h = 0; if (e_object_is_del(E_OBJECT(ec))) return; - if (e_pixmap_usable_get(ec->pixmap)) + if (ec->changes.size || e_pixmap_usable_get(ec->pixmap)) { if (e_comp_object_frame_exists(ec->frame)) w = ec->client.w, h = ec->client.h; @@ -187,13 +182,6 @@ if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->override) e_hints_window_visible_set(ec); - - if (ec->ignored || ec->comp_data->cursor) return; - if (ec->parent && (!ec->parent->focused)) return; - if (ec->new_client) - ec->take_focus = !starting; - else - evas_object_focus_set(ec->frame, !starting); } static void @@ -265,11 +253,8 @@ if (ec->cur_mouse_action && e_grabinput_mouse_win_get()) return; /* FIXME? this is a hack to just reset the cursor whenever we mouse out. not sure if accurate */ { - Evas_Object *o; - - ecore_evas_cursor_get(e_comp->ee, &o, NULL, NULL, NULL); - if (e_comp->pointer->o_ptr != o) - e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + evas_object_show(e_comp->pointer->o_ptr); } if (e_comp_wl->ptr.ec == ec) e_comp_wl->ptr.ec = NULL; @@ -382,6 +367,7 @@ if (e_object_is_del(E_OBJECT(ec))) return; if (ec->ignored) return; if (!ec->comp_data->surface) return; + if (e_comp->input_mouse_grabs) return; if ((!e_comp_wl->drag_client) || (!e_client_has_xwindow(e_comp_wl->drag_client))) @@ -661,7 +647,7 @@ if (e_comp_util_kbd_grabbed()) return; e_comp_wl_data_device_keyboard_focus_set(); ec->comp_data->on_focus_timer = - ecore_timer_add(0.8, (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec); + ecore_timer_loop_add(0.8, (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec); } static void @@ -799,7 +785,7 @@ ec->comp_data->maximizing = 1; else if (!e_client_has_xwindow(ec)) { - int w, h, ew, eh, *ecw, *ech; + int w, h, ew = 0, eh = 0, *ecw, *ech; unsigned int pmax = ec->maximized; ec->comp_data->unmax = *max; if (ec->internal) @@ -834,7 +820,7 @@ ec->comp_data->maximizing = 1; else if (!e_client_has_xwindow(ec)) { - int w, h, ew, eh, *ecw, *ech; + int w, h, ew = 0, eh = 0, *ecw, *ech; unsigned int pmax = ec->maximized; ec->comp_data->max = *max; if (ec->internal) @@ -1234,9 +1220,10 @@ if (e_client_has_xwindow(ec) || e_comp_object_frame_exists(ec->frame)) return; window = &ec->comp_data->shell.window; if (window->x || window->y || window->w || window->h) - e_comp_object_frame_geometry_set(ec->frame, -window->x, (window->x + window->w) - state->bw, - -window->y, - (window->y + window->h) - state->bh); + e_comp_object_frame_geometry_set(ec->frame, -window->x, + (window->x + window->w) - state->bw, + -window->y, + (window->y + window->h) - state->bh); else e_comp_object_frame_geometry_set(ec->frame, 0, 0, 0, 0); } @@ -1320,7 +1307,6 @@ { Eina_Bool first = EINA_FALSE; Eina_Rectangle *dmg; - Eina_Bool placed = EINA_TRUE; int x = 0, y = 0, w, h; first = !e_pixmap_usable_get(ec->pixmap); @@ -1330,7 +1316,7 @@ #endif ec->comp_data->in_commit = 1; - if (state->new_attach && ec->ignored && (ec->comp_data->shell.surface || ec->internal_elm_win)) + if (ec->ignored && ec->comp_data->shell.surface) { EC_CHANGED(ec); ec->new_client = 1; @@ -1339,7 +1325,14 @@ } if (state->new_attach) - _e_comp_wl_surface_state_attach(ec, state); + { + _e_comp_wl_surface_state_attach(ec, state); + if (first && (!ec->comp_data->cursor)) + { + ec->take_focus = !starting || ec->internal_elm_win; + ec->want_focus = ec->override; + } + } _e_comp_wl_surface_state_buffer_set(state, NULL); @@ -1394,18 +1387,16 @@ if (state->new_attach) { - if (ec->changes.pos) + if (ec->changes.pos || ec->internal_elm_win) e_comp_object_frame_xy_unadjust(ec->frame, ec->x, ec->y, &x, &y); else { x = ec->client.x, y = ec->client.y; - if (ec->new_client) + if (first) x -= ec->comp_data->shell.window.x, y -= ec->comp_data->shell.window.y; } - if (ec->new_client) placed = ec->placed; - - if (first && e_client_has_xwindow(ec)) + if ((!ec->comp_data->buffer_commit) && e_client_has_xwindow(ec)) /* use client geometry to avoid race condition from x11 configure request */ x = ec->x, y = ec->y; else @@ -1499,9 +1490,10 @@ e_client_util_move_resize_without_frame(ec, x, y, w, h); } - if (ec->new_client) + if ((!ec->comp_data->sub.data) && (!ec->comp_data->buffer_commit)) { - ec->placed = placed; + if (!ec->internal_elm_win) + ec->placed = (!e_client_has_xwindow(ec)) && (ec->netwm.type != E_WINDOW_TYPE_NORMAL); ec->want_focus |= ec->icccm.accepts_focus && (!ec->override); } } @@ -1510,6 +1502,8 @@ state->sx = 0; state->sy = 0; + if (state->new_attach) + ec->comp_data->buffer_commit = 1; state->new_attach = EINA_FALSE; /* insert state frame callbacks into comp_data->frames @@ -1691,7 +1685,7 @@ wl_resource_set_implementation(res, NULL, ec, _e_comp_wl_frame_cb_destroy); ec->comp_data->pending.frames = - eina_list_prepend(ec->comp_data->pending.frames, res); + eina_list_append(ec->comp_data->pending.frames, res); } static void @@ -1788,10 +1782,7 @@ _e_comp_wl_surface_cb_commit, _e_comp_wl_surface_cb_buffer_transform_set, _e_comp_wl_surface_cb_buffer_scale_set, -/* remove ifdefs once damage_buffer is officially released */ -#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION _e_comp_wl_surface_cb_damage_buffer -#endif }; @@ -1869,7 +1860,7 @@ if (ec->new_client) e_comp->new_clients--; ec->new_client = 0; - if ((!ec->client.w) && (ec->client.h)) + if ((!ec->client.w) && (!ec->client.h)) ec->client.w = ec->client.h = 1; ec->comp_data->surface = res; ec->netwm.pid = pid; @@ -2489,6 +2480,8 @@ /* make sure this is a wayland client */ if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; + e_comp_wl_extension_pointer_unconstrain(ec); + /* remove sub list */ EINA_LIST_FREE(ec->comp_data->sub.list, subc) { @@ -2508,6 +2501,16 @@ _e_comp_wl_surface_state_finish(&ec->comp_data->pending); E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); + if (ec->mouse.in) + _e_comp_wl_mouse_out(ec); + else if (ec->comp_data->cursor) + { + Evas_Object *o; + + ecore_evas_cursor_get(e_comp->ee, &o, NULL, NULL, NULL); + if (o == ec->frame) + e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + } /* The resource destroy callback will walk the state->frames list, * so move the list to a temporary first. @@ -2982,6 +2985,7 @@ _e_comp_wl_surface_state_commit(ec, &ec->comp_data->pending); if (!e_comp_object_damage_exists(ec->frame)) e_pixmap_image_clear(ec->pixmap, 1); + e_comp_wl_extension_pointer_constraints_commit(ec); return EINA_TRUE; } @@ -3248,7 +3252,7 @@ *k = keycode; if ((!e_client_action_get()) && (!e_comp->input_key_grabs) && - (!e_menu_grab_window_get())) + (!e_menu_is_active())) { ec = e_client_focused_get(); if (ec && ec->comp_data->surface && e_comp_wl->kbd.focused) @@ -3298,7 +3302,7 @@ (const char *)end - (const char *)e_comp_wl->kbd.keys.data; if ((!e_client_action_get()) && (!e_comp->input_key_grabs) && - (!e_menu_grab_window_get())) + (!e_menu_is_active())) { ec = e_client_focused_get(); @@ -3321,7 +3325,7 @@ { Eina_List *l; struct wl_client *wc; - uint32_t serial, btn; + uint32_t serial, btn, *state_serial; struct wl_resource *res; if (ec->cur_mouse_action || ec->border_menu || e_comp_wl->drag) @@ -3353,12 +3357,16 @@ } if (state == WL_POINTER_BUTTON_STATE_PRESSED) - e_comp_wl->ptr.button_mask |= 1 << button_id; + { + e_comp_wl->ptr.button_mask |= 1 << button_id; + state_serial = &e_comp_wl->ptr.serial[0]; + } else { /* reject release events if button is not pressed */ if (!(e_comp_wl->ptr.button_mask & (1 << button_id))) return EINA_FALSE; e_comp_wl->ptr.button_mask &= ~(1 << button_id); + state_serial = &e_comp_wl->ptr.serial[1]; } e_comp_wl->ptr.button = btn; @@ -3368,7 +3376,7 @@ return EINA_TRUE; wc = wl_resource_get_client(ec->comp_data->surface); - serial = wl_display_next_serial(e_comp_wl->wl.disp); + *state_serial = serial = wl_display_next_serial(e_comp_wl->wl.disp); EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { diff -Nru e20-201702271931/src/bin/e_comp_wl_data.c e20-201702281931/src/bin/e_comp_wl_data.c --- e20-201702271931/src/bin/e_comp_wl_data.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_wl_data.c 2017-02-28 19:31:37.000000000 +0000 @@ -534,7 +534,9 @@ static void _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped) { + struct wl_resource *res = NULL; Evas_Object *o, *z; + E_Comp_Wl_Data_Source *data_source = e_comp_wl->drag_source; o = edje_object_part_swallow_get(drag->comp_object, "e.swallow.content"); if (eina_streq(evas_object_type_get(o), "e_comp_object")) @@ -551,53 +553,45 @@ e_comp_wl->drag = NULL; e_comp_wl->drag_client = NULL; e_screensaver_inhibit_toggle(0); - if (e_comp_wl->selection.target && (!dropped)) - { + if (dropped) return; #ifndef HAVE_WAYLAND_ONLY - if (e_client_has_xwindow(e_comp_wl->selection.target)) - { - ecore_x_client_message32_send(e_client_util_win_get(e_comp_wl->selection.target), - ECORE_X_ATOM_XDND_DROP, - ECORE_X_EVENT_MASK_NONE, - e_comp->cm_selection, 0, - ecore_x_current_time_get(), 0, 0); - } - else + if (e_comp_wl->selection.target && e_client_has_xwindow(e_comp_wl->selection.target)) + { + ecore_x_client_message32_send(e_client_util_win_get(e_comp_wl->selection.target), + ECORE_X_ATOM_XDND_DROP, + ECORE_X_EVENT_MASK_NONE, + e_comp->cm_selection, 0, + ecore_x_current_time_get(), 0, 0); + return; + } #endif - { - struct wl_resource *res; - E_Comp_Wl_Data_Source *data_source = e_comp_wl->drag_source; - res = e_comp_wl_data_find_for_client(wl_resource_get_client(e_comp_wl->selection.target->comp_data->surface)); - if (res) - { - if (data_source->accepted && data_source->current_dnd_action) - { - wl_data_device_send_drop(res); - if (wl_resource_get_version(data_source->resource) >= - WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION) - wl_data_source_send_dnd_drop_performed(data_source->resource); - - data_source->offer->in_ask = data_source->current_dnd_action == - WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK; - } - else if (wl_resource_get_version(data_source->resource) >= - WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) - wl_data_source_send_cancelled(data_source->resource); - wl_data_device_send_leave(res); - } + if (e_comp_wl->selection.target) + res = e_comp_wl_data_find_for_client(wl_resource_get_client(e_comp_wl->selection.target->comp_data->surface)); + if (res && data_source->accepted && data_source->current_dnd_action) + { + wl_data_device_send_drop(res); + if (wl_resource_get_version(data_source->resource) >= + WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION) + wl_data_source_send_dnd_drop_performed(data_source->resource); + + data_source->offer->in_ask = data_source->current_dnd_action == + WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK; + } + else if (wl_resource_get_version(data_source->resource) >= + WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) + wl_data_source_send_cancelled(data_source->resource); + if (res) wl_data_device_send_leave(res); #ifndef HAVE_WAYLAND_ONLY - if (e_comp_util_has_xwayland()) - { - ecore_x_selection_owner_set(0, ECORE_X_ATOM_SELECTION_XDND, - ecore_x_current_time_get()); - ecore_x_window_hide(e_comp->cm_selection); - } -#endif - e_comp_wl->selection.target = NULL; - e_comp_wl->drag_source = NULL; - } + if (e_comp_util_has_xwayland()) + { + ecore_x_selection_owner_set(0, ECORE_X_ATOM_SELECTION_XDND, + ecore_x_current_time_get()); + ecore_x_window_hide(e_comp->cm_selection); } +#endif + e_comp_wl->selection.target = NULL; + e_comp_wl->drag_source = NULL; } static void @@ -967,17 +961,6 @@ if (!e_client_has_xwindow(ec)) { E_Comp_Wl_Data_Source *drag_source = e_comp_wl->drag_source; - if (drag_source && - drag_source->offer) - { - E_Comp_Wl_Data_Offer *offer; - /* Unlink the offer from the source */ - offer = drag_source->offer; - offer->source = NULL; - drag_source->offer = NULL; - drag_source->accepted = 0; - wl_list_remove(&offer->source_destroy_listener.link); - } data_device_res = e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); if (!data_device_res) return; @@ -1034,8 +1017,8 @@ return; } #endif - x = wl_fixed_to_int(e_comp_wl->ptr.x) - e_comp_wl->selection.target->client.x; - y = wl_fixed_to_int(e_comp_wl->ptr.y) - e_comp_wl->selection.target->client.y; + x = e_comp_wl->ptr.x - e_comp_wl->selection.target->client.x; + y = e_comp_wl->ptr.y - e_comp_wl->selection.target->client.y; serial = wl_display_next_serial(e_comp_wl->wl.disp); wl_data_device_send_enter(data_device_res, serial, ec->comp_data->surface, wl_fixed_from_int(x), wl_fixed_from_int(y), @@ -1065,6 +1048,20 @@ return; } #endif + { + E_Comp_Wl_Data_Source *drag_source = e_comp_wl->drag_source; + if (drag_source && + drag_source->offer) + { + E_Comp_Wl_Data_Offer *offer; + /* Unlink the offer from the source */ + offer = drag_source->offer; + offer->source = NULL; + drag_source->offer = NULL; + drag_source->accepted = 0; + wl_list_remove(&offer->source_destroy_listener.link); + } + } res = e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); if (res) wl_data_device_send_leave(res); diff -Nru e20-201702271931/src/bin/e_comp_wl_extensions.c e20-201702281931/src/bin/e_comp_wl_extensions.c --- e20-201702271931/src/bin/e_comp_wl_extensions.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_wl_extensions.c 2017-02-28 19:31:37.000000000 +0000 @@ -6,6 +6,45 @@ #include "screenshooter-server-protocol.h" #include "session-recovery-server-protocol.h" #include "www-server-protocol.h" +#include "xdg-foreign-unstable-v1-server-protocol.h" +#include "relative-pointer-unstable-v1-server-protocol.h" +#include "pointer-constraints-unstable-v1-server-protocol.h" + +/* mutter uses 32, seems reasonable */ +#define HANDLE_LEN 32 + +typedef struct Exported +{ + E_Client *ec; + struct wl_resource *res; + char handle[HANDLE_LEN + 1]; + Eina_List *imported; +} Exported; + +typedef struct Imported +{ + /* child */ + E_Client *ec; + struct wl_resource *res; + Exported *ex; +} Imported; + +typedef struct Constraint +{ + E_Client *ec; + struct wl_resource *res; + struct wl_resource *seat; + struct wl_resource *surface; + Eina_Tiler *region; + Eina_Tiler *pending; + Evas_Point *pending_xy; + Evas_Point *pointer_xy; + Eina_Bool lock : 1; // if not lock, confine + Eina_Bool persistent : 1; + Eina_Bool active : 1; +} Constraint; + +static Eina_List *active_constraints; static void _e_comp_wl_extensions_client_move_begin(void *d EINA_UNUSED, E_Client *ec) @@ -207,6 +246,389 @@ e_object_ref(E_OBJECT(ec)); } +/////////////////////////////////////////////////////// + +static void +_e_comp_wl_zxdg_exported_v1_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static void _imported_v1_del(Imported *im); +static void _exported_del(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void +_exported_v1_del(Exported *ex) +{ + while (ex->imported) + { + Imported *im = eina_list_data_get(ex->imported); + + zxdg_imported_v1_send_destroyed(im->res); + _imported_v1_del(im); + } + evas_object_event_callback_del(ex->ec->frame, EVAS_CALLBACK_DEL, _exported_del); + wl_resource_set_user_data(ex->res, NULL); + eina_hash_del_by_key(e_comp_wl->extensions->zxdg_exporter_v1.surfaces, ex->handle); + free(ex); +} + +static void +_e_zxdg_exported_v1_del(struct wl_resource *resource) +{ + Exported *ex = wl_resource_get_user_data(resource); + + if (ex) _exported_v1_del(ex); +} + +static void +_exported_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + _exported_v1_del(data); +} + +static void +_e_comp_wl_zxdg_exporter_v1_exporter_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static const struct zxdg_exported_v1_interface _e_zxdg_exported_v1_interface = +{ + _e_comp_wl_zxdg_exported_v1_destroy, +}; + +static void +_e_comp_wl_zxdg_exporter_v1_export(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface) +{ + E_Client *ec = wl_resource_get_user_data(surface); + Exported *ex; + + if ((!ec) || (!ec->comp_data->is_xdg_surface) || ec->comp_data->cursor) + { + wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "invalid role for exported surface"); + return; + } + + ex = E_NEW(Exported, 1); + ex->ec = ec; + ex->res = wl_resource_create(client, &zxdg_exported_v1_interface, wl_resource_get_version(resource), id); + wl_resource_set_implementation(ex->res, &_e_zxdg_exported_v1_interface, ex, _e_zxdg_exported_v1_del); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL, _exported_del, ex); + + do + { + int n; + + for (n = 0; n < HANDLE_LEN; n++) + { + /* only printable ascii */ + ex->handle[n] = (rand() % (127 - 32)) + 32; + } + } while (eina_hash_find(e_comp_wl->extensions->zxdg_exporter_v1.surfaces, ex->handle)); + eina_hash_add(e_comp_wl->extensions->zxdg_exporter_v1.surfaces, ex->handle, ex); + + zxdg_exported_v1_send_handle(ex->res, ex->handle); +} + + +static void +_e_comp_wl_zxdg_imported_v1_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static void _imported_del(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void +_imported_v1_del(Imported *im) +{ + im->ex->imported = eina_list_remove(im->ex->imported, im); + if (im->ec) + { + evas_object_event_callback_del(im->ec->frame, EVAS_CALLBACK_DEL, _imported_del); + e_client_parent_set(im->ec, NULL); + } + if (im->res) wl_resource_set_user_data(im->res, NULL); + free(im); +} + +static void +_e_zxdg_imported_v1_del(struct wl_resource *resource) +{ + Imported *im = wl_resource_get_user_data(resource); + + if (im) _imported_v1_del(im); +} + +static void +_imported_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Imported *im = data; + + im->ec = NULL; +} + +static void +_e_comp_wl_zxdg_importer_v1_importer_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static void +_e_comp_wl_zxdg_imported_v1_set_parent_of(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *surface_resource) +{ + Imported *im = wl_resource_get_user_data(resource); + E_Client *ec = NULL; + + if (surface_resource) ec = wl_resource_get_user_data(surface_resource); + + if (ec && ((ec->netwm.type != E_WINDOW_TYPE_NORMAL) || (!ec->comp_data->is_xdg_surface))) + { + wl_resource_post_error(im->res, WL_DISPLAY_ERROR_INVALID_OBJECT, + "xdg_imported.set_parent_of called with invalid surface"); + return; + } + + if (im->ec) + evas_object_event_callback_del(im->ec->frame, EVAS_CALLBACK_DEL, _imported_del); + + im->ec = ec; + + if (ec) + { + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL, _imported_del, im); + e_client_parent_set(ec, im->ex->ec); + ec->parent->modal = ec; + ec->parent->lock_close = 1; + } +} + +static const struct zxdg_imported_v1_interface _e_zxdg_imported_v1_interface = +{ + _e_comp_wl_zxdg_imported_v1_destroy, + _e_comp_wl_zxdg_imported_v1_set_parent_of, +}; + +static void +_e_comp_wl_zxdg_importer_v1_import(struct wl_client *client, struct wl_resource *resource, uint32_t id, const char *handle) +{ + Imported *im; + Exported *ex; + + im = E_NEW(Imported, 1); + im->res = wl_resource_create(client, &zxdg_imported_v1_interface, wl_resource_get_version(resource), id); + wl_resource_set_implementation(im->res, &_e_zxdg_imported_v1_interface, NULL, _e_zxdg_imported_v1_del); + + ex = eina_hash_find(e_comp_wl->extensions->zxdg_exporter_v1.surfaces, handle); + if ((!ex) || (!ex->ec->netwm.type)) + { + zxdg_imported_v1_send_destroyed(im->res); + free(im); + return; + } + + im->ex = ex; + wl_resource_set_user_data(im->res, im); + ex->imported = eina_list_append(ex->imported, im); +} + +///////////////////////////////////////////////////////// + +static void +_e_comp_wl_zwp_relative_pointer_manager_v1_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static void +_relative_pointer_destroy(struct wl_resource *resource) +{ + e_comp_wl->extensions->zwp_relative_pointer_manager_v1.resources = + eina_list_remove(e_comp_wl->extensions->zwp_relative_pointer_manager_v1.resources, resource); +} + +static void +_e_comp_wl_zwp_relative_pointer_v1_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + + +static const struct zwp_relative_pointer_v1_interface _e_zwp_relative_pointer_v1_interface = +{ + _e_comp_wl_zwp_relative_pointer_v1_destroy, +}; + +static void +_e_comp_wl_zwp_relative_pointer_manager_v1_get_relative_pointer(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *pointer) +{ + struct wl_resource *res; + + res = wl_resource_create(client, &zwp_relative_pointer_v1_interface, wl_resource_get_version(resource), id); + wl_resource_set_implementation(res, &_e_zwp_relative_pointer_v1_interface, pointer, _relative_pointer_destroy); + e_comp_wl->extensions->zwp_relative_pointer_manager_v1.resources = + eina_list_append(e_comp_wl->extensions->zwp_relative_pointer_manager_v1.resources, res); +} + +///////////////////////////////////////////////////////// + +static void +_e_comp_wl_zwp_pointer_constraints_v1_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static void +_constraint_destroy(struct wl_resource *resource) +{ + Eina_Hash *constraints; + Constraint *c = wl_resource_get_user_data(resource); + + constraints = eina_hash_find(e_comp_wl->extensions->zwp_pointer_constraints_v1.constraints, &c->seat); + if (constraints) + eina_hash_del_by_key(constraints, &c->surface); + if (c->active) + { + active_constraints = eina_list_remove(active_constraints, c); + if (c->lock && c->pointer_xy) + ecore_evas_pointer_warp(e_comp->ee, c->ec->client.x + c->pointer_xy->x, c->ec->client.y + c->pointer_xy->y); + } + if (c->ec) + { + if (c->ec->comp_data->constraints) + c->ec->comp_data->constraints = eina_list_remove(c->ec->comp_data->constraints, c); + } + eina_tiler_free(c->pending); + eina_tiler_free(c->region); + free(c->pointer_xy); + free(c->pending_xy); + free(c); +} + +static void +_constraint_set_pending(Constraint *c) +{ + if (c->ec->comp_data->constraints) + c->ec->comp_data->constraints = eina_list_remove(c->ec->comp_data->constraints, c); + c->ec->comp_data->constraints = eina_list_append(c->ec->comp_data->constraints, c); +} + +static void +_constraint_set_region(struct wl_resource *resource, struct wl_resource *region) +{ + Constraint *c = wl_resource_get_user_data(resource); + Eina_Tiler *r = NULL; + + if (region) r = wl_resource_get_user_data(region); + else E_FREE_FUNC(c->pending, eina_tiler_free); + + if (c->pending) + eina_tiler_clear(c->pending); + else + { + c->pending = eina_tiler_new(65535, 65535); + eina_tiler_tile_size_set(c->pending, 1, 1); + } + if (r) + eina_tiler_union(c->pending, r); + _constraint_set_pending(c); +} + +static void +_e_comp_wl_locked_pointer_v1_set_region(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region) +{ + _constraint_set_region(resource, region); +} + +static void +_e_comp_wl_locked_pointer_v1_set_cursor_position_hint(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, wl_fixed_t surface_x, wl_fixed_t surface_y) +{ + Constraint *c = wl_resource_get_user_data(resource); + + if (!c->pending_xy) + c->pending_xy = E_NEW(Evas_Point, 1); + c->pending_xy->x = wl_fixed_to_int(surface_x); + c->pending_xy->y = wl_fixed_to_int(surface_y); + _constraint_set_pending(c); +} + +static const struct zwp_locked_pointer_v1_interface _e_comp_wl_locked_pointer_v1_interface = +{ + _e_comp_wl_zwp_pointer_constraints_v1_destroy, + _e_comp_wl_locked_pointer_v1_set_cursor_position_hint, + _e_comp_wl_locked_pointer_v1_set_region, +}; + + +static void +_e_comp_wl_confined_pointer_v1_set_region(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region) +{ + _constraint_set_region(resource, region); +} + +static const struct zwp_confined_pointer_v1_interface _e_comp_wl_confined_pointer_v1_interface = +{ + _e_comp_wl_zwp_pointer_constraints_v1_destroy, + _e_comp_wl_confined_pointer_v1_set_region, +}; + +static Constraint * +do_constraint(const struct wl_interface *interface, const void *impl, struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, struct wl_resource *pointer, struct wl_resource *region, uint32_t lifetime) +{ + struct wl_resource *res, *seat; + Eina_Hash *constraints; + Constraint *c; + + seat = wl_resource_get_user_data(pointer); + constraints = eina_hash_find(e_comp_wl->extensions->zwp_pointer_constraints_v1.constraints, &seat); + if (constraints) + { + c = eina_hash_find(constraints, &surface); + if (c) + { + wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, + "constraint already exists for requested seat+surface"); + return NULL; + } + } + else + { + constraints = eina_hash_pointer_new(NULL); + eina_hash_add(e_comp_wl->extensions->zwp_pointer_constraints_v1.constraints, &seat, constraints); + } + c = E_NEW(Constraint, 1); + c->seat = seat; + c->surface = surface; + c->persistent = lifetime == ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT; + c->ec = wl_resource_get_user_data(surface); + c->res = res = wl_resource_create(client, interface, wl_resource_get_version(resource), id); + wl_resource_set_implementation(res, impl, pointer, _constraint_destroy); + wl_resource_set_user_data(res, c); + _constraint_set_region(res, region); + return c; +} + +static void +_e_comp_wl_zwp_pointer_constraints_v1_lock_pointer(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, struct wl_resource *pointer, struct wl_resource *region, uint32_t lifetime) +{ + Constraint *c; + + c = do_constraint(&zwp_locked_pointer_v1_interface, &_e_comp_wl_locked_pointer_v1_interface, + client, resource, id, surface, pointer, region, lifetime); + if (c) + c->lock = 1; +} + +static void +_e_comp_wl_zwp_pointer_constraints_v1_confine_pointer(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, struct wl_resource *pointer, struct wl_resource *region, uint32_t lifetime) +{ + do_constraint(&zwp_confined_pointer_v1_interface, &_e_comp_wl_confined_pointer_v1_interface, + client, resource, id, surface, pointer, region, lifetime); +} + +///////////////////////////////////////////////////////// + static const struct zwp_e_session_recovery_interface _e_session_recovery_interface = { _e_comp_wl_session_recovery_get_uuid, @@ -224,6 +646,30 @@ _e_comp_wl_www_cb_create }; +static const struct zxdg_exporter_v1_interface _e_zxdg_exporter_v1_interface = +{ + _e_comp_wl_zxdg_exporter_v1_exporter_destroy, + _e_comp_wl_zxdg_exporter_v1_export, +}; + +static const struct zxdg_importer_v1_interface _e_zxdg_importer_v1_interface = +{ + _e_comp_wl_zxdg_importer_v1_importer_destroy, + _e_comp_wl_zxdg_importer_v1_import, +}; + +static const struct zwp_relative_pointer_manager_v1_interface _e_zwp_relative_pointer_manager_v1_interface = +{ + _e_comp_wl_zwp_relative_pointer_manager_v1_destroy, + _e_comp_wl_zwp_relative_pointer_manager_v1_get_relative_pointer, +}; + +static const struct zwp_pointer_constraints_v1_interface _e_zwp_pointer_constraints_v1_interface = +{ + _e_comp_wl_zwp_pointer_constraints_v1_destroy, + _e_comp_wl_zwp_pointer_constraints_v1_lock_pointer, + _e_comp_wl_zwp_pointer_constraints_v1_confine_pointer, +}; #define GLOBAL_BIND_CB(NAME, IFACE, ...) \ static void \ @@ -244,6 +690,10 @@ GLOBAL_BIND_CB(session_recovery, zwp_e_session_recovery_interface) GLOBAL_BIND_CB(screenshooter, zwp_screenshooter_interface) GLOBAL_BIND_CB(www, www_interface) +GLOBAL_BIND_CB(zxdg_exporter_v1, zxdg_exporter_v1_interface) +GLOBAL_BIND_CB(zxdg_importer_v1, zxdg_importer_v1_interface) +GLOBAL_BIND_CB(zwp_relative_pointer_manager_v1, zwp_relative_pointer_manager_v1_interface) +GLOBAL_BIND_CB(zwp_pointer_constraints_v1, zwp_pointer_constraints_v1_interface) #define GLOBAL_CREATE_OR_RETURN(NAME, IFACE, VERSION) \ @@ -285,6 +735,12 @@ GLOBAL_CREATE_OR_RETURN(session_recovery, zwp_e_session_recovery_interface, 1); GLOBAL_CREATE_OR_RETURN(screenshooter, zwp_screenshooter_interface, 1); GLOBAL_CREATE_OR_RETURN(www, www_interface, 1); + GLOBAL_CREATE_OR_RETURN(zxdg_exporter_v1, zxdg_exporter_v1_interface, 1); + e_comp_wl->extensions->zxdg_exporter_v1.surfaces = eina_hash_string_superfast_new(NULL); + GLOBAL_CREATE_OR_RETURN(zxdg_importer_v1, zxdg_importer_v1_interface, 1); + GLOBAL_CREATE_OR_RETURN(zwp_relative_pointer_manager_v1, zwp_relative_pointer_manager_v1_interface, 1); + GLOBAL_CREATE_OR_RETURN(zwp_pointer_constraints_v1, zwp_pointer_constraints_v1_interface, 1); + e_comp_wl->extensions->zwp_pointer_constraints_v1.constraints = eina_hash_pointer_new(NULL); ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE, _dmabuf_add, NULL); @@ -293,3 +749,229 @@ return EINA_TRUE; } + +E_API void +e_comp_wl_extension_relative_motion_event(uint64_t time_usec, double dx, double dy, double dx_unaccel, double dy_unaccel) +{ + Eina_List *l; + struct wl_resource *res; + E_Client *focused; + struct wl_client *wc; + uint32_t hi, lo; + + focused = e_client_focused_get(); + if ((!focused) || e_object_is_del(E_OBJECT(focused))) return; + + wc = wl_resource_get_client(focused->comp_data->surface); + + hi = time_usec >> 32; + lo = (uint32_t)time_usec; + + EINA_LIST_FOREACH(e_comp_wl->extensions->zwp_relative_pointer_manager_v1.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + zwp_relative_pointer_v1_send_relative_motion(res, hi, lo, wl_fixed_from_double(dx), + wl_fixed_from_double(dy), wl_fixed_from_double(dx_unaccel), wl_fixed_from_double(dy_unaccel)); + } +} + +E_API void +e_comp_wl_extension_pointer_constraints_commit(E_Client *ec) +{ + Eina_List *l; + Constraint *c; + + EINA_LIST_FOREACH(ec->comp_data->constraints, l, c) + { + if (c->pending) + { + eina_tiler_free(c->region); + c->region = c->pending; + c->pending = NULL; + } + if (c->pending_xy) + { + if (c->pointer_xy) + free(c->pointer_xy); + c->pointer_xy = c->pending_xy; + c->pending_xy = NULL; + } + } +} + +static Eina_Bool +_inside_tiler(Eina_Tiler *r, Eina_Bool active, int x, int y, int px, int py, int *ax, int *ay) +{ + Eina_Iterator *it; + Eina_Rectangle *rect; + Eina_Bool ret = EINA_FALSE; + Eina_Rectangle prect, arect; + Eina_Bool cur = EINA_FALSE, prev = EINA_FALSE; + + if (!r) return EINA_TRUE; + it = eina_tiler_iterator_new(r); + if (!it) return EINA_TRUE; + + EINA_ITERATOR_FOREACH(it, rect) + { + Eina_Bool found = EINA_FALSE; + if (active && eina_rectangle_coords_inside(rect, px, py)) + { + found = prev = EINA_TRUE; + prect = *rect; + if (cur) break; + } + if (eina_rectangle_coords_inside(rect, x, y)) + { + if (active) + { + cur = EINA_TRUE; + arect = *rect; + if (found) ret = EINA_TRUE; + if (prev) break; + } + else + ret = EINA_TRUE; + if (!active) break; + } + } + eina_iterator_free(it); + if ((!ret) && cur && prev) + { + int dx, dy; + + dx = abs(x - px); + dy = abs(y - py); + if ((!dx) || (!dy)) + { + /* line motion along a single axis: check for adjacent confine rects */ + if (dx) + ret = (arect.x + arect.w == prect.x) || (prect.x + prect.w == arect.x); + else + ret = (arect.y + arect.h == prect.y) || (prect.y + prect.h == arect.y); + } + else + { + /* check for completely contiguous regions over entire motion vector + * use rect of vector points and check for overlap + */ + Eina_Tiler *a; + int w, h; + unsigned int size, usize = 0; + + eina_tiler_area_size_get(r, &w, &h); + a = eina_tiler_new(w, h); + eina_tiler_tile_size_set(a, 1, 1); + eina_tiler_rect_add(a, &arect); + eina_tiler_rect_add(a, &prect); + eina_tiler_rect_del(a, &(Eina_Rectangle){MIN(x, px), MIN(y, py), dx, dy}); + size = (arect.w * arect.h) + (prect.w * prect.h); + it = eina_tiler_iterator_new(a); + EINA_ITERATOR_FOREACH(it, rect) + usize += rect->w * rect->h; + ret = size - dx * dy == usize; + eina_iterator_free(it); + eina_tiler_free(a); + } + } + if (prev && (!ret)) + { + if (!eina_rectangle_xcoord_inside(&prect, x)) + { + if (x < prect.x) + *ax = prect.x; + else + *ax = prect.x + prect.w - 1; + if (*ax == px) + { + if (eina_rectangle_ycoord_inside(&prect, y)) + *ay = y; + else + { + _inside_tiler(r, active, *ax, y, px, py, ax, ay); + } + } + else + *ay = lround(((y - py) / (double)(x - px)) * (*ax - x)) + y; + } + else + { + if (y < prect.y) + *ay = prect.y; + else + *ay = prect.y + prect.h - 1; + if (*ay == py) + *ax = x; + else + *ax = lround(((double)(x - px) / (y - py)) * (*ay - y)) + x; + } + } + + return ret; +} + +E_API Eina_Bool +e_comp_wl_extension_pointer_constraints_update(E_Client *ec, int x, int y) +{ + Eina_List *l, *ll; + Constraint *c; + Eina_Bool inside; + int px, py; + + inside = e_comp_object_coords_inside_input_area(ec->frame, x, y); + evas_pointer_canvas_xy_get(e_comp->evas, &px, &py); + + /* if constraint is active, check prev canvas coords and lock if */ + + EINA_LIST_FOREACH_SAFE(ec->comp_data->constraints, l, ll, c) + { + int ax = px - ec->client.x, ay = py - ec->client.y; + Eina_Bool inside_region = _inside_tiler(c->region, c->active, x - ec->client.x, y - ec->client.y, + px - ec->client.x, py - ec->client.y, &ax, &ay); + if ((!c->active) && inside && inside_region) + { + c->active = 1; + active_constraints = eina_list_append(active_constraints, c); + if (c->lock) + zwp_locked_pointer_v1_send_locked(c->res); + else + zwp_confined_pointer_v1_send_confined(c->res); + } + if (!c->active) continue; + if (c->lock || ((!inside) || (!inside_region))) + { + ecore_evas_pointer_warp(e_comp->ee, ax + ec->client.x, ay + ec->client.y); + return EINA_TRUE; + } + } + return EINA_FALSE; +} + +E_API void +e_comp_wl_extension_pointer_unconstrain(E_Client *ec) +{ + Constraint *c; + + if (ec) + { + /* deleting client */ + EINA_LIST_FREE(ec->comp_data->constraints, c) + { + c->active = EINA_FALSE; + if (c->lock) + zwp_locked_pointer_v1_send_unlocked(c->res); + else + zwp_confined_pointer_v1_send_unconfined(c->res); + active_constraints = eina_list_remove(active_constraints, c); + c->ec = NULL; + } + } + EINA_LIST_FREE(active_constraints, c) + { + c->active = EINA_FALSE; + if (c->lock) + zwp_locked_pointer_v1_send_unlocked(c->res); + else + zwp_confined_pointer_v1_send_unconfined(c->res); + } +} diff -Nru e20-201702271931/src/bin/e_comp_wl.h e20-201702281931/src/bin/e_comp_wl.h --- e20-201702271931/src/bin/e_comp_wl.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_wl.h 2017-02-28 19:31:37.000000000 +0000 @@ -39,7 +39,7 @@ # define container_of(ptr, type, member) \ ({ \ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) ); \ + (type *)(void *)( (char *)__mptr - offsetof(type,member) ); \ }) typedef struct _E_Comp_Wl_Buffer E_Comp_Wl_Buffer; @@ -97,19 +97,40 @@ typedef struct E_Comp_Wl_Extension_Data { struct - { - struct wl_global *global; - struct wl_client *client; - void (*read_pixels)(E_Comp_Wl_Output *output, void *pixels); - } screenshooter; - struct - { - struct wl_global *global; - } session_recovery; + { + struct wl_global *global; + struct wl_client *client; + void (*read_pixels)(E_Comp_Wl_Output *output, void *pixels); + } screenshooter; struct - { - struct wl_global *global; - } www; + { + struct wl_global *global; + } session_recovery; + struct + { + struct wl_global *global; + } www; + /* begin xdg-foreign */ + struct + { + struct wl_global *global; + Eina_Hash *surfaces; + } zxdg_exporter_v1; + struct + { + struct wl_global *global; + } zxdg_importer_v1; + /* end xdg-foreign */ + struct + { + struct wl_global *global; + Eina_List *resources; + } zwp_relative_pointer_manager_v1; + struct + { + struct wl_global *global; + Eina_Hash *constraints; + } zwp_pointer_constraints_v1; } E_Comp_Wl_Extension_Data; struct _E_Comp_Wl_Data @@ -174,9 +195,9 @@ struct { Eina_List *resources; - wl_fixed_t x, y; - wl_fixed_t grab_x, grab_y; + Evas_Coord x, y; uint32_t button; + uint32_t serial[2]; //down/up uint32_t button_mask; E_Client *ec; Eina_Bool enabled : 1; @@ -306,6 +327,7 @@ E_Comp_Wl_Surface_State pending; Eina_List *frames; + Eina_List *constraints; struct { @@ -332,7 +354,8 @@ Eina_Bool maximizing : 1; Eina_Bool in_commit : 1; Eina_Bool is_xdg_surface : 1; - Eina_Bool grab; + Eina_Bool grab : 1; + Eina_Bool buffer_commit : 1; }; struct _E_Comp_Wl_Output @@ -379,6 +402,11 @@ E_API Eina_Bool e_comp_wl_grab_client_mouse_move(const Ecore_Event_Mouse_Move *ev); E_API Eina_Bool e_comp_wl_grab_client_mouse_button(const Ecore_Event_Mouse_Button *ev); +E_API void e_comp_wl_extension_relative_motion_event(uint64_t time_usec, double dx, double dy, double dx_unaccel, double dy_unaccel); +E_API void e_comp_wl_extension_pointer_constraints_commit(E_Client *ec); +E_API Eina_Bool e_comp_wl_extension_pointer_constraints_update(E_Client *ec, int x, int y); +E_API void e_comp_wl_extension_pointer_unconstrain(E_Client *ec); + # ifndef HAVE_WAYLAND_ONLY EINTERN void e_comp_wl_xwayland_client_queue(E_Client *ec); static inline E_Comp_X_Client_Data * diff -Nru e20-201702271931/src/bin/e_comp_wl_input.c e20-201702281931/src/bin/e_comp_wl_input.c --- e20-201702271931/src/bin/e_comp_wl_input.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_wl_input.c 2017-02-28 19:31:37.000000000 +0000 @@ -14,6 +14,7 @@ static xkb_keycode_t (*_xkb_keymap_key_by_name)(void *, const char *); static void _e_comp_wl_input_context_keymap_set(struct xkb_keymap *keymap, struct xkb_context *context); +static Eina_Hash *input_gen_modifiers; //the following two fields are just set by e_comp_wl_input_keymap_set if it is called before e_comp_wl is valid. //when then later init is called those two fields are used in the keymap of the e_comp_wl struct @@ -59,14 +60,24 @@ if (client != wl_resource_get_client(ec->comp_data->surface)) continue; if (ec->mouse.in) { - got_mouse = EINA_TRUE; - break; + if (e_client_has_xwindow(ec)) + got_mouse = E_INSIDE(ec->mouse.current.mx, ec->mouse.current.my, + ec->client.x, ec->client.y, ec->client.w, ec->client.h); + else + got_mouse = EINA_TRUE; + break; } } - if (!got_mouse) return; + if (!got_mouse) + { + if (ec && ec->mouse.in && (!surface_resource)) + e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + return; + } if (!surface_resource) { - e_pointer_object_set(e_comp->pointer, NULL, x, y); + ecore_evas_cursor_unset(e_comp->ee); + evas_object_hide(e_comp->pointer->o_ptr); return; } ec = wl_resource_get_user_data(surface_resource); @@ -108,7 +119,6 @@ _e_comp_wl_input_cb_resource_destroy }; - static void _e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource) { @@ -134,6 +144,7 @@ e_comp_wl->ptr.resources = eina_list_append(e_comp_wl->ptr.resources, res); + wl_resource_set_user_data(res, resource); wl_resource_set_implementation(res, &_e_pointer_interface, e_comp->wl_comp_data, _e_comp_wl_input_cb_pointer_unbind); @@ -199,6 +210,7 @@ wl_client_post_no_memory(client); return; } + wl_resource_set_user_data(res, resource); e_comp_wl->kbd.resources = eina_list_append(e_comp_wl->kbd.resources, res); @@ -348,7 +360,6 @@ return fd; } - static void _e_comp_wl_input_state_update(void) { @@ -370,10 +381,8 @@ e_comp_wl->xkb.state = xkb_state_new(e_comp_wl->xkb.keymap); xkb_state_update_mask(e_comp_wl->xkb.state, 0, - latched, locked, - e_comp_wl->kbd.choosen_group, - 0, - 0); + latched, locked, e_comp_wl->kbd.choosen_group, + 0, 0); } static void @@ -494,6 +503,8 @@ { struct wl_resource *res; + E_FREE_FUNC(input_gen_modifiers, eina_hash_free); + /* destroy pointer resources */ EINA_LIST_FREE(e_comp_wl->ptr.resources, res) wl_resource_destroy(res); @@ -697,8 +708,6 @@ } else choosen_group = index; - - } E_API void @@ -781,13 +790,10 @@ Ecore_Event_Key *ev; int keycode; - /* "key" here is the platform-specific key name; - * /usr/share/X11/xkb/keycodes/evdev is probably what your system is using - */ keycode = _xkb_keymap_key_by_name(e_comp_wl->xkb.keymap, keyname ?: key); - if (!keycode) + if (keycode == -1) { - ERR("no keycode found for key '%s'", key); + ERR("no keycode found for key '%s'", keyname ?: key); return; } ev = calloc(1, sizeof(Ecore_Event_Key) + (2 * (strlen(key) + 1))); @@ -825,15 +831,134 @@ E_API void e_comp_wl_input_keyboard_event_generate(const char *key, int mods, Eina_Bool up) { + const char *keyname = NULL; + /* assumes qwerty layout */ + /* /usr/share/X11/xkb/keycodes/evdev */ + static const char *keycodes[] = + { + ['`'] = "TLDE", + ['1'] = "AE01", + ['2'] = "AE02", + ['3'] = "AE03", + ['4'] = "AE04", + ['5'] = "AE05", + ['6'] = "AE06", + ['7'] = "AE07", + ['8'] = "AE08", + ['9'] = "AE09", + ['0'] = "AE10", + ['-'] = "AE11", + ['='] = "AE12", + //''] = "BKSP", + ['\t'] = "TAB", + ['q'] = "AD01", + ['w'] = "AD02", + ['e'] = "AD03", + ['r'] = "AD04", + ['t'] = "AD05", + ['y'] = "AD06", + ['u'] = "AD07", + ['i'] = "AD08", + ['o'] = "AD09", + ['p'] = "AD10", + ['['] = "AD11", + [']'] = "AD12", + ['\\'] = "BKSL", + ['\r'] = "RTRN", + //''] = "CAPS", + ['a'] = "AC01", + ['s'] = "AC02", + ['d'] = "AC03", + ['f'] = "AC04", + ['g'] = "AC05", + ['h'] = "AC06", + ['j'] = "AC07", + ['k'] = "AC08", + ['l'] = "AC09", + [';'] = "AC10", + ['\''] = "AC11", + //''] = "LFSH", + ['z'] = "AB01", + ['x'] = "AB02", + ['c'] = "AB03", + ['v'] = "AB04", + ['b'] = "AB05", + ['n'] = "AB06", + ['m'] = "AB07", + [','] = "AB08", + ['.'] = "AB09", + ['/'] = "AB10", + //''] = "RTSH", + [' '] = "SPCE", + }; + if (!_xkb_keymap_key_by_name) { ERR("xkbcommon >= 0.6.0 required for keyboard event generation!"); return; } + EINA_SAFETY_ON_NULL_RETURN(key); + EINA_SAFETY_ON_TRUE_RETURN(!key[0]); + if (!input_gen_modifiers) + { +// = 62; +// = 64; +// = 37; +// = 105; +// = 108; +// = 133; +// = 134; +// = 135; +//alias = ; +// = 9; + static const char *modcodes[] = + { + "Shift_L", + "LFSH", + + "Control_L", + "LCTL", + + "Super_L", + "LWIN", + + "Alt_L", + "LALT", + + "Escape", + "ESC", + + "Alt_R", + "RALT", + + "Super_R", + "RWIN", + + "Menu", + "MENU", + + "Control_R", + "RCTRL", + + "Mode_switch", + "ALGR", + }; + unsigned int i; + + input_gen_modifiers = eina_hash_string_superfast_new(NULL); + for (i = 0; i < EINA_C_ARRAY_LENGTH(modcodes); i += 2) + eina_hash_add(input_gen_modifiers, modcodes[i], modcodes[i + 1]); + } if (!up) _event_generate_mods(mods, up); - _event_generate(key, NULL, mods, up); + keyname = eina_hash_find(input_gen_modifiers, key); + if ((!keyname) && (!key[1])) + { + if (key[0] < (int)EINA_C_ARRAY_LENGTH(keycodes)) + keyname = keycodes[(unsigned char)key[0]]; + } + _event_generate(key, keyname, mods, up); if (up) _event_generate_mods(mods, up); } diff -Nru e20-201702271931/src/bin/e_comp_x.c e20-201702281931/src/bin/e_comp_x.c --- e20-201702271931/src/bin/e_comp_x.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_x.c 2017-02-28 19:31:37.000000000 +0000 @@ -1482,9 +1482,9 @@ if (!ec) { if (c->x_comp_data->retry_timer) - ecore_timer_reset(c->x_comp_data->retry_timer); + ecore_timer_loop_reset(c->x_comp_data->retry_timer); else - c->x_comp_data->retry_timer = ecore_timer_add(0.02, _e_comp_x_show_retry, c); + c->x_comp_data->retry_timer = ecore_timer_loop_add(0.02, _e_comp_x_show_retry, c); c->x_comp_data->retry_clients = eina_list_append(c->x_comp_data->retry_clients, (uintptr_t*)(unsigned long)ev->win); return ECORE_CALLBACK_RENEW; } @@ -2362,7 +2362,7 @@ _e_comp_x_mouse_in_job(void *d EINA_UNUSED) { if (mouse_client) - e_client_mouse_in(mouse_client, e_comp_canvas_x_root_adjust(mouse_in_coords.x), e_comp_canvas_x_root_adjust(mouse_in_coords.y)); + e_client_mouse_in(mouse_client, e_comp_canvas_x_root_adjust(mouse_in_coords.x), e_comp_canvas_y_root_adjust(mouse_in_coords.y)); mouse_in_job = NULL; } @@ -2420,7 +2420,7 @@ E_FREE_FUNC(mouse_in_job, ecore_job_del); } if (ec->mouse.in) - e_client_mouse_out(ec, e_comp_canvas_x_root_adjust(ev->root.x), e_comp_canvas_x_root_adjust(ev->root.y)); + e_client_mouse_out(ec, e_comp_canvas_x_root_adjust(ev->root.x), e_comp_canvas_y_root_adjust(ev->root.y)); return ECORE_CALLBACK_RENEW; } @@ -2519,7 +2519,7 @@ if (top == e_comp->ee_win) return ECORE_CALLBACK_RENEW; x = e_comp_canvas_x_root_adjust(ev->root.x); - y = e_comp_canvas_x_root_adjust(ev->root.y); + y = e_comp_canvas_y_root_adjust(ev->root.y); for (tec = e_client_above_get(ec); tec; tec = e_client_above_get(tec)) { if (!evas_object_visible_get(tec->frame)) continue; @@ -2877,9 +2877,9 @@ _e_comp_x_focus_timer(void) { if (focus_timer) - ecore_timer_reset(focus_timer); + ecore_timer_loop_reset(focus_timer); else /* focus has changed twice in .002 seconds; .01 seconds should be more than enough delay */ - focus_timer = ecore_timer_add(0.01, _e_comp_x_focus_timer_cb, NULL); + focus_timer = ecore_timer_loop_add(0.01, _e_comp_x_focus_timer_cb, NULL); } static Eina_Bool @@ -3826,34 +3826,10 @@ ec->icccm.transient_for = ecore_x_icccm_transient_for_get(win); if (ec->icccm.transient_for) ec_parent = _e_comp_x_client_find_by_window(ec->icccm.transient_for); - /* If we already have a parent, remove it */ - if (ec->parent) - { - if (ec_parent != ec->parent) - { - ec->parent->transients = eina_list_remove(ec->parent->transients, ec); - if (ec->parent->modal == ec) ec->parent->modal = NULL; - ec->parent = NULL; - } - else - ec_parent = NULL; - } - if ((ec_parent) && (ec_parent != ec) && - (eina_list_data_find(ec->transients, ec_parent) != ec_parent)) - { - ec_parent->transients = eina_list_append(ec_parent->transients, ec); - ec->parent = ec_parent; - } - if (ec->parent && (!e_client_util_ignored_get(ec))) - { - evas_object_layer_set(ec->frame, ec->parent->layer); - if (ec->netwm.state.modal) - _e_comp_x_client_modal_setup(ec); - if (e_config->focus_setting == E_FOCUS_NEW_DIALOG || - (ec->parent->focused && (e_config->focus_setting == E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED))) - ec->take_focus = 1; - } + e_client_parent_set(ec, ec_parent); + if (ec->parent && (!e_client_util_ignored_get(ec)) && ec->netwm.state.modal) + _e_comp_x_client_modal_setup(ec); if ((ec_parent) && (ec->e.state.stack != ECORE_X_STACK_NONE)) { E_Client *ec2; @@ -4520,16 +4496,14 @@ } if (cd->fetch_gtk_frame_extents) { - unsigned char *data; + unsigned int *extents; int count; if (ecore_x_window_prop_property_get(win, ATM_GTK_FRAME_EXTENTS, ECORE_X_ATOM_CARDINAL, 32, - &data, &count)) + (void *)(&extents), &count)) { - unsigned int *extents = (unsigned int*)data; - /* _GTK_FRAME_EXTENTS describes a region l/r/t/b pixels * from the "window" object in which shadows will be drawn. * this area should not be accounted for in sizing or @@ -4541,7 +4515,7 @@ (ec->x == ec->comp_data->initial_attributes.x) && (ec->y == ec->comp_data->initial_attributes.y)) e_comp_object_frame_xy_adjust(ec->frame, ec->x, ec->y, &ec->x, &ec->y); - free(data); + free(extents); } cd->fetch_gtk_frame_extents = 0; } @@ -4595,7 +4569,7 @@ eina_hash_add(clients_win_hash, &win, ec); if (!ec->input_only) - ec->comp_data->first_draw_delay = ecore_timer_add(e_comp_config_get()->first_draw_delay, _e_comp_x_first_draw_delay_cb, ec); + ec->comp_data->first_draw_delay = ecore_timer_loop_add(e_comp_config_get()->first_draw_delay, _e_comp_x_first_draw_delay_cb, ec); } static void @@ -4919,13 +4893,13 @@ { saver_on = EINA_TRUE; E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del); - screensaver_eval_timer = ecore_timer_add(0.3, _e_comp_x_screensaver_eval_cb, NULL); + screensaver_eval_timer = ecore_timer_loop_add(0.3, _e_comp_x_screensaver_eval_cb, NULL); } else if ((!ev->on) && (saver_on)) { saver_on = EINA_FALSE; E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del); - screensaver_eval_timer = ecore_timer_add(0.3, _e_comp_x_screensaver_eval_cb, NULL); + screensaver_eval_timer = ecore_timer_loop_add(0.3, _e_comp_x_screensaver_eval_cb, NULL); } return ECORE_CALLBACK_PASS_ON; } diff -Nru e20-201702271931/src/bin/e_comp_x_randr.c e20-201702281931/src/bin/e_comp_x_randr.c --- e20-201702271931/src/bin/e_comp_x_randr.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_comp_x_randr.c 2017-02-28 19:31:37.000000000 +0000 @@ -21,7 +21,9 @@ .init = e_comp_x_randr_init, .shutdown = e_comp_x_randr_shutdown, .create = e_comp_x_randr_create, - .apply = e_comp_x_randr_config_apply + .apply = e_comp_x_randr_config_apply, + .relative_motion = EINA_FALSE, + .backlight_enabled = EINA_TRUE, }; static void diff -Nru e20-201702271931/src/bin/e_config.c e20-201702281931/src/bin/e_config.c --- e20-201702271931/src/bin/e_config.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -470,7 +470,6 @@ E_CONFIG_VAL(D, T, config_type, UINT); /**/ E_CONFIG_VAL(D, T, show_splash, INT); /**/ E_CONFIG_VAL(D, T, desktop_default_background, STR); /**/ - E_CONFIG_VAL(D, T, desktop_default_name, STR); /**/ E_CONFIG_LIST(D, T, desktop_backgrounds, _e_config_desktop_bg_edd); /**/ E_CONFIG_LIST(D, T, desktop_names, _e_config_desktop_name_edd); /**/ E_CONFIG_VAL(D, T, menus_scroll_speed, DOUBLE); /**/ @@ -1020,7 +1019,7 @@ _e_config_free(e_config); e_config = NULL; reload = 1; - ecore_timer_add(1.0, _e_config_cb_timer, + ecore_timer_loop_add(1.0, _e_config_cb_timer, _("Settings data needed upgrading. Your old settings have
" "been wiped and a new set of defaults initialized. This
" "will happen regularly during development, so don't report a
" @@ -1037,7 +1036,7 @@ _e_config_free(e_config); e_config = NULL; reload = 1; - ecore_timer_add(1.0, _e_config_cb_timer, + ecore_timer_loop_add(1.0, _e_config_cb_timer, _("Your settings are NEWER than Enlightenment. This is very
" "strange. This should not happen unless you downgraded
" "Enlightenment or copied the settings from a place where
" @@ -1153,7 +1152,7 @@ e_bindings = e_config_domain_system_load("e_bindings", _e_config_binding_edd); e_config_profile_set(prof); eina_stringshare_del(prof); - ecore_timer_add(1.0, _e_config_cb_timer, + ecore_timer_loop_add(1.0, _e_config_cb_timer, _("Your bindings settings version does not match the current settings version.
" "As a result, all bindings have been reloaded from defaults.
" "Sorry for the inconvenience.
")); @@ -1478,6 +1477,29 @@ e_config->modules = eina_list_append(e_config->modules, module); } } + CONFIG_VERSION_CHECK(23) + { + Eina_List *l; + E_Config_Module *em, *module; + Eina_Bool sysinfo_en = EINA_FALSE; + + CONFIG_VERSION_UPDATE_INFO(23); + + EINA_LIST_FOREACH(e_config->modules, l, em) + { + if (!em->enabled) continue; + if (eina_streq(em->name, "sysinfo")) + sysinfo_en = EINA_TRUE; + } + if (!sysinfo_en) + { + module = E_NEW(E_Config_Module, 1); + module->name = eina_stringshare_add("sysinfo"); + module->enabled = 1; + module->delayed = 1; + e_config->modules = eina_list_append(e_config->modules, module); + } + } } if (!e_config->remember_internal_fm_windows) e_config->remember_internal_fm_windows = !!(e_config->remember_internal_windows & E_REMEMBER_INTERNAL_FM_WINS); @@ -2285,11 +2307,8 @@ elm_config_save(); e_config_domain_save("e", _e_config_edd, e_config); e_config_domain_save("e_bindings", _e_config_binding_edd, e_bindings); - if (E_EFL_VERSION_MINIMUM(1, 17, 99)) - { - e_gadget_save(); - e_bryce_save(); - } + e_gadget_save(); + e_bryce_save(); _e_config_save_defer = NULL; } @@ -2382,6 +2401,7 @@ if (rem->role) eina_stringshare_del(rem->role); if (rem->prop.border) eina_stringshare_del(rem->prop.border); if (rem->prop.command) eina_stringshare_del(rem->prop.command); + eina_stringshare_del(rem->uuid); E_FREE(rem); } EINA_LIST_FREE(ecf->menu_applications, ema) @@ -2397,7 +2417,6 @@ E_FREE(cc); } if (ecf->desktop_default_background) eina_stringshare_del(ecf->desktop_default_background); - if (ecf->desktop_default_name) eina_stringshare_del(ecf->desktop_default_name); if (ecf->language) eina_stringshare_del(ecf->language); eina_stringshare_del(ecf->desklock_language); eina_stringshare_del(ecf->xkb.selected_layout); diff -Nru e20-201702271931/src/bin/e_config_dialog.c e20-201702281931/src/bin/e_config_dialog.c --- e20-201702271931/src/bin/e_config_dialog.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_config_dialog.c 2017-02-28 19:31:37.000000000 +0000 @@ -413,7 +413,7 @@ if (cfd->auto_apply_timer) ecore_timer_del(cfd->auto_apply_timer); cfd->auto_apply_timer = NULL; cfd->auto_apply_timer = - ecore_timer_add(0.5, _e_config_dialog_cb_auto_apply_timer, cfd); + ecore_timer_loop_add(0.5, _e_config_dialog_cb_auto_apply_timer, cfd); } } diff -Nru e20-201702271931/src/bin/e_config.h e20-201702281931/src/bin/e_config.h --- e20-201702271931/src/bin/e_config.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_config.h 2017-02-28 19:31:37.000000000 +0000 @@ -46,7 +46,7 @@ /* increment this whenever a new set of config values are added but the users * config doesn't need to be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 22 +#define E_CONFIG_FILE_GENERATION 23 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION) #define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!! @@ -58,7 +58,7 @@ int show_splash; // GUI const char *desktop_default_background; // GUI Eina_List *desktop_backgrounds; // GUI - const char *desktop_default_name; + const char *desktop_default_name; // DEAD Eina_List *desktop_names; // GUI double menus_scroll_speed; // GUI double menus_fast_mouse_move_threshhold; // GUI diff -Nru e20-201702271931/src/bin/e_configure.c e20-201702281931/src/bin/e_configure.c --- e20-201702271931/src/bin/e_configure.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_configure.c 2017-02-28 19:31:37.000000000 +0000 @@ -43,7 +43,7 @@ ecore_job_del(update_job); update_job = NULL; } - ecore_timer_add(0.0, _configure_init_timer, NULL); + ecore_timer_loop_add(0.0, _configure_init_timer, NULL); } E_API void diff -Nru e20-201702271931/src/bin/e_desk.c e20-201702281931/src/bin/e_desk.c --- e20-201702271931/src/bin/e_desk.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_desk.c 2017-02-28 19:31:37.000000000 +0000 @@ -119,7 +119,7 @@ if (!ok) { - snprintf(name, sizeof(name), "%s: %d,%d", _(e_config->desktop_default_name), x, y); + snprintf(name, sizeof(name), "%d,%d", x, y); desk->name = eina_stringshare_add(name); } @@ -232,9 +232,7 @@ if (!ok) { - snprintf(name, sizeof(name), "%s: %d,%d", - _(e_config->desktop_default_name), - d_x, d_y); + snprintf(name, sizeof(name), "%d,%d", d_x, d_y); e_desk_name_set(desk, name); } } diff -Nru e20-201702271931/src/bin/e_desklock.c e20-201702281931/src/bin/e_desklock.c --- e20-201702271931/src/bin/e_desklock.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_desklock.c 2017-02-28 19:31:37.000000000 +0000 @@ -295,7 +295,8 @@ if (zone->num >= EINA_C_ARRAY_LENGTH(block_rects)) { - CRI("> %lu screens connected????", EINA_C_ARRAY_LENGTH(block_rects)); + CRI("> %lu screens connected????", + (unsigned long)EINA_C_ARRAY_LENGTH(block_rects)); break; } o = evas_object_rectangle_add(e_comp->evas); @@ -710,7 +711,8 @@ EINA_SAFETY_ON_NULL_RETURN(zone); if (zone->num >= EINA_C_ARRAY_LENGTH(block_rects)) { - CRI("> %lu screens connected????", EINA_C_ARRAY_LENGTH(block_rects)); + CRI("> %lu screens connected????", + (unsigned long)EINA_C_ARRAY_LENGTH(block_rects)); return; } block_zone[zone->num] = !!block; diff -Nru e20-201702271931/src/bin/e_dialog.c e20-201702281931/src/bin/e_dialog.c --- e20-201702271931/src/bin/e_dialog.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_dialog.c 2017-02-28 19:31:37.000000000 +0000 @@ -253,7 +253,7 @@ if (!dia->resizable) { evas_object_size_hint_weight_set(dia->bg_object, 0, 0); - evas_object_size_hint_max_set(dia->bg_object, mw, mh); + e_util_win_auto_resize_fill(dia->win); } else { diff -Nru e20-201702271931/src/bin/e_dnd.c e20-201702281931/src/bin/e_dnd.c --- e20-201702271931/src/bin/e_dnd.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_dnd.c 2017-02-28 19:31:37.000000000 +0000 @@ -670,7 +670,7 @@ break; case E_GADCON_CLIENT_TYPE: - gc = ((E_Gadcon_Client *)(h->obj))->gadcon; + gc = ((E_Gadcon_Client *)(void *)(h->obj))->gadcon; e_gadcon_canvas_zone_geometry_get(gc, &px, &py, NULL, NULL); if (!gc->toolbar) break; { @@ -689,8 +689,8 @@ break; case E_CLIENT_TYPE: - px = ((E_Client *)(h->obj))->x; - py = ((E_Client *)(h->obj))->y; + px = ((E_Client *)(void *)(h->obj))->x; + py = ((E_Client *)(void *)(h->obj))->y; break; /* FIXME: add more types as needed */ @@ -716,7 +716,7 @@ switch (h->obj->type) { case E_GADCON_CLIENT_TYPE: - gc = ((E_Gadcon_Client *)(h->obj))->gadcon; + gc = ((E_Gadcon_Client *)(void *)(h->obj))->gadcon; if (!gc) return 0; /* no break */ case E_GADCON_TYPE: @@ -768,7 +768,7 @@ break; case E_GADCON_CLIENT_TYPE: - shelf = e_gadcon_shelf_get(((E_Gadcon_Client *)(h->obj))->gadcon); + shelf = e_gadcon_shelf_get(((E_Gadcon_Client *)(void *)(h->obj))->gadcon); if (shelf) e_shelf_toggle(shelf, 1); break; @@ -795,7 +795,7 @@ break; case E_GADCON_CLIENT_TYPE: - shelf = e_gadcon_shelf_get(((E_Gadcon_Client *)(h->obj))->gadcon); + shelf = e_gadcon_shelf_get(((E_Gadcon_Client *)(void *)(h->obj))->gadcon); if (shelf) e_shelf_toggle(shelf, 0); break; diff -Nru e20-201702271931/src/bin/e_dpms.c e20-201702281931/src/bin/e_dpms.c --- e20-201702271931/src/bin/e_dpms.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_dpms.c 2017-02-28 19:31:37.000000000 +0000 @@ -163,9 +163,9 @@ static Eina_Bool _e_dpms_screensaver_on() { - standby_timer = ecore_timer_add(STANDBY, _e_dpms_standby, NULL); - suspend_timer = ecore_timer_add(SUSPEND, _e_dpms_suspend, NULL); - off_timer = ecore_timer_add(OFF, _e_dpms_off, NULL); + standby_timer = ecore_timer_loop_add(STANDBY, _e_dpms_standby, NULL); + suspend_timer = ecore_timer_loop_add(SUSPEND, _e_dpms_suspend, NULL); + off_timer = ecore_timer_loop_add(OFF, _e_dpms_off, NULL); return ECORE_CALLBACK_RENEW; } diff -Nru e20-201702271931/src/bin/e_exec.c e20-201702281931/src/bin/e_exec.c --- e20-201702271931/src/bin/e_exec.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_exec.c 2017-02-28 19:31:37.000000000 +0000 @@ -548,7 +548,7 @@ inst->exe = exe; inst->startup_id = startup_id; inst->launch_time = ecore_time_get(); - inst->expire_timer = ecore_timer_add(e_config->exec.expire_timeout, + inst->expire_timer = ecore_timer_loop_add(e_config->exec.expire_timeout, _e_exec_cb_expire_timer, inst); l = eina_hash_find(e_exec_instances, inst->key); lnew = eina_list_append(l, inst); @@ -591,7 +591,6 @@ _e_exec_instance_free(E_Exec_Instance *inst) { Eina_List *instances; - E_Client *ec; if (inst->ref) return EINA_FALSE; E_FREE_LIST(inst->watchers, free); @@ -612,23 +611,11 @@ { inst->deleted = 1; inst->ref++; + E_LIST_FOREACH(inst->clients, e_object_ref); ecore_event_add(E_EVENT_EXEC_DEL, inst, _e_exec_cb_exec_del_free, inst); return EINA_FALSE; } - if (inst->desktop) - e_exec_start_pending = eina_list_remove(e_exec_start_pending, - inst->desktop); - if (inst->expire_timer) ecore_timer_del(inst->expire_timer); - EINA_LIST_FREE(inst->clients, ec) - { - ec->exe_inst = NULL; - } - if (inst->desktop) efreet_desktop_free(inst->desktop); - if (!inst->phony) - { - if (inst->exe) ecore_exe_data_set(inst->exe, NULL); - } - free(inst); + return EINA_TRUE; } @@ -666,9 +653,27 @@ _e_exec_cb_exec_del_free(void *data, void *ev EINA_UNUSED) { E_Exec_Instance *inst = data; + E_Client *ec; inst->ref--; - _e_exec_instance_free(inst); + + if (inst->desktop) + e_exec_start_pending = eina_list_remove(e_exec_start_pending, + inst->desktop); + if (inst->expire_timer) ecore_timer_del(inst->expire_timer); + + EINA_LIST_FREE(inst->clients, ec) + { + ec->exe_inst = NULL; + e_object_unref(E_OBJECT(ec)); + } + + if (inst->desktop) efreet_desktop_free(inst->desktop); + if (!inst->phony) + { + if (inst->exe) ecore_exe_data_set(inst->exe, NULL); + } + free(inst); } static Eina_Bool @@ -750,7 +755,7 @@ { inst->exe = NULL; if (inst->expire_timer) ecore_timer_del(inst->expire_timer); - inst->expire_timer = ecore_timer_add(e_config->exec.expire_timeout, _e_exec_cb_instance_finish, inst); + inst->expire_timer = ecore_timer_loop_add(e_config->exec.expire_timeout, _e_exec_cb_instance_finish, inst); } else */ diff -Nru e20-201702271931/src/bin/e_fm/e_fm_ipc.c e20-201702281931/src/bin/e_fm/e_fm_ipc.c --- e20-201702271931/src/bin/e_fm/e_fm_ipc.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_fm/e_fm_ipc.c 2017-02-28 19:31:37.000000000 +0000 @@ -718,7 +718,7 @@ relative = p; p += strlen(relative) + 1; - after = *((int *)p); + memcpy(&after, p, sizeof(int)); _e_fm_ipc_reorder(file, dst, relative, after); } @@ -1051,7 +1051,7 @@ ed->recent_mods = eina_list_append(ed->recent_mods, m); } if ((!ed->recent_clean) && (ed->recent_mods)) - ed->recent_clean = ecore_timer_add(DEF_MOD_BACKOFF, _e_fm_ipc_cb_recent_clean, ed); + ed->recent_clean = ecore_timer_loop_add(DEF_MOD_BACKOFF, _e_fm_ipc_cb_recent_clean, ed); if (skip) { // printf("SKIP MOD %s %3.3f\n", path, t_now); @@ -1370,9 +1370,9 @@ int msg_size; if (_init_timer && (!_init_timer_run)) - ecore_timer_reset(_init_timer); + ecore_timer_loop_reset(_init_timer); else if ((!_init_timer) && (!_init_timer_run)) - _init_timer = ecore_timer_add(2.0, _e_fm_ipc_timer_cb, NULL); + _init_timer = ecore_timer_loop_add(2.0, _e_fm_ipc_timer_cb, NULL); msg_data = _e_fm_shared_codec_volume_encode(v, &msg_size); if (!msg_data) return; diff -Nru e20-201702271931/src/bin/e_fm/e_fm_main_eeze.c e20-201702281931/src/bin/e_fm/e_fm_main_eeze.c --- e20-201702271931/src/bin/e_fm/e_fm_main_eeze.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_fm/e_fm_main_eeze.c 2017-02-28 19:31:37.000000000 +0000 @@ -312,7 +312,7 @@ snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_sys", eina_prefix_lib_get(pfx)); eeze_disk_mount_wrapper_set(v->disk, buf); } - v->guard = ecore_timer_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_eject_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_eject_timeout, v); eeze_disk_eject(v->disk); } @@ -505,7 +505,7 @@ snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_sys", eina_prefix_lib_get(pfx)); eeze_disk_mount_wrapper_set(v->disk, buf); } - v->guard = ecore_timer_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_unmount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_unmount_timeout, v); eeze_disk_unmount(v->disk); } @@ -541,7 +541,7 @@ snprintf(buf2, sizeof(buf2), "%s/enlightenment/utils/enlightenment_sys", eina_prefix_lib_get(pfx)); eeze_disk_mount_wrapper_set(v->disk, buf2); } - v->guard = ecore_timer_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_mount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_eeze_vol_mount_timeout, v); INF("MOUNT: %s", v->udi); if (!eeze_disk_mount(v->disk)) goto error; return; diff -Nru e20-201702271931/src/bin/e_fm/e_fm_main_udisks2.c e20-201702281931/src/bin/e_fm/e_fm_main_udisks2.c --- e20-201702271931/src/bin/e_fm/e_fm_main_udisks2.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_fm/e_fm_main_udisks2.c 2017-02-28 19:31:37.000000000 +0000 @@ -1129,13 +1129,13 @@ } if (v->mounted) { - v->guard = ecore_timer_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_unmount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_unmount_timeout, v); v->op = _volume_umount(v); vols_ejecting = eina_list_append(vols_ejecting, v); } else { - v->guard = ecore_timer_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_eject_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_eject_timeout, v); v->op = _volume_eject(v->storage->proxy); } v->optype = E_VOLUME_OP_TYPE_EJECT; @@ -1147,7 +1147,7 @@ if (!v || v->guard) return; INF("unmount %s %s", v->udi, v->mount_point); - v->guard = ecore_timer_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_unmount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_unmount_timeout, v); v->op = _volume_umount(v); v->optype = E_VOLUME_OP_TYPE_UNMOUNT; } @@ -1178,7 +1178,7 @@ else if (!strcmp(v->fstype, "ntfs")) snprintf(buf, sizeof(buf), "uid=%i", (int)getuid()); - v->guard = ecore_timer_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_mount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks2_vol_mount_timeout, v); // It was previously noted here that ubuntu 10.04 failed to mount if opt was passed to // e_udisks2_volume_mount. The reason at the time was unknown and apparently never found. diff -Nru e20-201702271931/src/bin/e_fm/e_fm_main_udisks.c e20-201702281931/src/bin/e_fm/e_fm_main_udisks.c --- e20-201702271931/src/bin/e_fm/e_fm_main_udisks.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_fm/e_fm_main_udisks.c 2017-02-28 19:31:37.000000000 +0000 @@ -835,7 +835,7 @@ static Eina_Bool _e_fm_main_udisks_cb_vol_ejecting_after_unmount(E_Volume *v) { - v->guard = ecore_timer_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_eject_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_eject_timeout, v); v->op = _volume_eject(v->storage->proxy); return ECORE_CALLBACK_CANCEL; @@ -847,7 +847,7 @@ _e_fm_main_udisks_cb_vol_unmounted(v); // delay is required for all message handlers were executed after unmount - ecore_timer_add(1.0, (Ecore_Task_Cb)_e_fm_main_udisks_cb_vol_ejecting_after_unmount, v); + ecore_timer_loop_add(1.0, (Ecore_Task_Cb)_e_fm_main_udisks_cb_vol_ejecting_after_unmount, v); } static void @@ -974,12 +974,12 @@ if (!v || v->guard) return; if (v->mounted) { - v->guard = ecore_timer_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_unmount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_unmount_timeout, v); v->op = _volume_umount(v->proxy); } else { - v->guard = ecore_timer_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_eject_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_EJECT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_eject_timeout, v); v->op = _volume_eject(v->storage->proxy); } v->optype = E_VOLUME_OP_TYPE_EJECT; @@ -991,7 +991,7 @@ if (!v || v->guard) return; INF("unmount %s %s", v->udi, v->mount_point); - v->guard = ecore_timer_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_unmount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_UNMOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_unmount_timeout, v); v->op = _volume_umount(v->proxy); v->optype = E_VOLUME_OP_TYPE_UNMOUNT; } @@ -1040,7 +1040,7 @@ opt = eina_list_append(opt, buf2); } - v->guard = ecore_timer_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_mount_timeout, v); + v->guard = ecore_timer_loop_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_mount_timeout, v); // It was previously noted here that ubuntu 10.04 failed to mount if opt was passed to // e_udisks_volume_mount. The reason at the time was unknown and apparently never found. diff -Nru e20-201702271931/src/bin/e_fm.c e20-201702281931/src/bin/e_fm.c --- e20-201702271931/src/bin/e_fm.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_fm.c 2017-02-28 19:31:37.000000000 +0000 @@ -824,8 +824,8 @@ efreet_mime_init(); /* XXX: move this to a central/global place? */ - _e_fm2_mime_flush = ecore_timer_add(60.0, _e_fm2_mime_flush_cb, NULL); - _e_fm2_mime_clear = ecore_timer_add(600.0, _e_fm2_mime_clear_cb, NULL); + _e_fm2_mime_flush = ecore_timer_loop_add(60.0, _e_fm2_mime_flush_cb, NULL); + _e_fm2_mime_clear = ecore_timer_loop_add(600.0, _e_fm2_mime_clear_cb, NULL); _e_fm2_icon_desktop_str = eina_stringshare_add("DESKTOP"); _e_fm2_icon_thumb_str = eina_stringshare_add("THUMB"); @@ -2868,7 +2868,7 @@ if (!sd->scan_timer) { sd->scan_timer = - ecore_timer_add(0.5, + ecore_timer_loop_add(0.5, _e_fm2_cb_scan_timer, sd->obj); sd->busy_count++; @@ -2883,7 +2883,7 @@ * dramatically improve load times */ ecore_timer_interval_set(sd->scan_timer, 1.5); - ecore_timer_reset(sd->scan_timer); + ecore_timer_loop_reset(sd->scan_timer); } } if (path[0] != 0) @@ -2919,7 +2919,7 @@ if (sd->scan_timer) { ecore_timer_interval_set(sd->scan_timer, 0.0001); - ecore_timer_reset(sd->scan_timer); + ecore_timer_loop_reset(sd->scan_timer); } else { @@ -2940,7 +2940,7 @@ { ecore_timer_del(sd->scan_timer); sd->scan_timer = - ecore_timer_add(0.0001, + ecore_timer_loop_add(0.0001, _e_fm2_cb_scan_timer, sd->obj); } @@ -3223,7 +3223,7 @@ if (!e->data) return; -#define UP(value, type) (value) = *(type *)p; p += sizeof(type) +#define UP(value, type) (value) = *(type *)(void *)p; p += sizeof(type) UP(percent, int); UP(seconds, int); UP(done, off_t); @@ -5960,8 +5960,8 @@ } while (0) ; - if (sd->typebuf.timer) ecore_timer_reset(sd->typebuf.timer); - else sd->typebuf.timer = ecore_timer_add(3.5, _e_fm_typebuf_timer_cb, sd); + if (sd->typebuf.timer) ecore_timer_loop_reset(sd->typebuf.timer); + else sd->typebuf.timer = ecore_timer_loop_add(3.5, _e_fm_typebuf_timer_cb, sd); return ic_match; } @@ -7023,8 +7023,8 @@ (Ecore_Cb)_e_fm2_cb_dnd_selection_notify_post_mount_fail, (Ecore_Cb)_e_fm2_cb_dnd_selection_notify_post_umount, NULL, vol); - if (sd->drop_icon->mount_timer) ecore_timer_reset(sd->drop_icon->mount_timer); - else sd->drop_icon->mount_timer = ecore_timer_add(15., (Ecore_Task_Cb)_e_fm2_cb_dnd_selection_notify_post_mount_timer, sd->drop_icon); + if (sd->drop_icon->mount_timer) ecore_timer_loop_reset(sd->drop_icon->mount_timer); + else sd->drop_icon->mount_timer = ecore_timer_loop_add(15., (Ecore_Task_Cb)_e_fm2_cb_dnd_selection_notify_post_mount_timer, sd->drop_icon); #ifndef HAVE_WAYLAND_ONLY if ((e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_ASK) || ((sd->config->view.link_drop) || (!sd->drop_icon))) @@ -7481,8 +7481,8 @@ ic->drag.dnd = EINA_FALSE; if (ic->sd->dnd_scroller) ecore_animator_del(ic->sd->dnd_scroller); ic->sd->dnd_scroller = NULL; - if (ic->drag.dnd_end_timer) ecore_timer_reset(ic->drag.dnd_end_timer); - else ic->drag.dnd_end_timer = ecore_timer_add(0.2, (Ecore_Task_Cb)_e_fm2_cb_drag_finished_show, ic); + if (ic->drag.dnd_end_timer) ecore_timer_loop_reset(ic->drag.dnd_end_timer); + else ic->drag.dnd_end_timer = ecore_timer_loop_add(0.2, (Ecore_Task_Cb)_e_fm2_cb_drag_finished_show, ic); /* NOTE: * do not touch ic after this callback; it's possible that it may have been deleted */ @@ -8439,7 +8439,7 @@ return ECORE_CALLBACK_CANCEL; } if (sd->busy_count > 0) - sd->scan_timer = ecore_timer_add(0.2, _e_fm2_cb_scan_timer, sd->obj); + sd->scan_timer = ecore_timer_loop_add(0.2, _e_fm2_cb_scan_timer, sd->obj); else { if (!sd->sort_idler) @@ -11238,7 +11238,7 @@ if ((sd->live.idler) || (sd->live.timer) || (sd->listing) || (sd->scan_timer)) return; sd->live.idler = ecore_idler_add(_e_fm2_cb_live_idler, obj); - sd->live.timer = ecore_timer_add(0.2, _e_fm2_cb_live_timer, obj); + sd->live.timer = ecore_timer_loop_add(0.2, _e_fm2_cb_live_timer, obj); sd->tmp.last_insert = NULL; } @@ -11414,7 +11414,7 @@ sd->live.deletions = EINA_FALSE; sd->live.timer = NULL; if ((!sd->queue) && (!sd->live.idler)) return ECORE_CALLBACK_CANCEL; - sd->live.timer = ecore_timer_add(0.2, _e_fm2_cb_live_timer, data); + sd->live.timer = ecore_timer_loop_add(0.2, _e_fm2_cb_live_timer, data); return ECORE_CALLBACK_CANCEL; } diff -Nru e20-201702271931/src/bin/e_fm_op.c e20-201702281931/src/bin/e_fm_op.c --- e20-201702271931/src/bin/e_fm_op.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_fm_op.c 2017-02-28 19:31:37.000000000 +0000 @@ -557,7 +557,7 @@ begin = buf; /* Check magic. */ - if (*((int *)buf) != E_FM_OP_MAGIC) + if (*((int *)(void *)buf) != E_FM_OP_MAGIC) { E_FM_OP_DEBUG("Error while reading from STDIN: magic is not correct!\n"); break; @@ -975,9 +975,9 @@ vsnprintf(str, READBUFSIZE - 3 * sizeof(int), fmt, ap); len = strlen(str); - *((int *)buf) = E_FM_OP_MAGIC; - *((int *)(buf + sizeof(int))) = type; - *((int *)(buf + (2 * sizeof(int)))) = len + 1; + *((int *)(void *)buf) = E_FM_OP_MAGIC; + *((int *)(void *)(buf + sizeof(int))) = type; + *((int *)(void *)(buf + (2 * sizeof(int)))) = len + 1; if (write(STDOUT_FILENO, buf, (3 * sizeof(int)) + len + 1) < 0) perror("write"); diff -Nru e20-201702271931/src/bin/e_focus.c e20-201702281931/src/bin/e_focus.c --- e20-201702271931/src/bin/e_focus.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_focus.c 2017-02-28 19:31:37.000000000 +0000 @@ -24,7 +24,7 @@ evas_object_raise(ec->frame); } else - ec->raise_timer = ecore_timer_add(e_config->auto_raise_delay, _e_focus_raise_timer, ec); + ec->raise_timer = ecore_timer_loop_add(e_config->auto_raise_delay, _e_focus_raise_timer, ec); } } diff -Nru e20-201702271931/src/bin/efx/efx_fade.c e20-201702281931/src/bin/efx/efx_fade.c --- e20-201702271931/src/bin/efx/efx_fade.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/efx/efx_fade.c 2017-02-28 19:31:37.000000000 +0000 @@ -130,6 +130,7 @@ { E_EFX *e; E_Efx_Fade_Data *efd; + int r, g, b, a; EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); e = evas_object_data_get(obj, "e_efx-data"); @@ -152,8 +153,11 @@ efd->alpha[1] = alpha; efd->cb = cb; efd->data = (void*)data; - evas_object_color_get(efd->clip, (int*)&efd->start.r, (int*)&efd->start.g, (int*)&efd->start.b, (int*)&alpha); - efd->alpha[0] = (unsigned char)alpha; + evas_object_color_get(efd->clip, &r, &g, &b, &a); + efd->start.r = r; + efd->start.g = g; + efd->start.b = b; + efd->alpha[0] = a; if (ec) { efd->color.r = ec->r; diff -Nru e20-201702271931/src/bin/e_gadcon.c e20-201702281931/src/bin/e_gadcon.c --- e20-201702271931/src/bin/e_gadcon.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_gadcon.c 2017-02-28 19:31:37.000000000 +0000 @@ -1939,7 +1939,7 @@ d = 1.0; if (!gcc->scroll_timer) gcc->scroll_timer = - ecore_timer_add(0.01, _e_gadcon_cb_client_scroll_timer, gcc); + ecore_timer_loop_add(0.01, _e_gadcon_cb_client_scroll_timer, gcc); if (!gcc->scroll_animator) gcc->scroll_animator = ecore_animator_add(_e_gadcon_cb_client_scroll_animator, gcc); @@ -3283,7 +3283,7 @@ if (gcc->instant_edit_timer) ecore_timer_del(gcc->instant_edit_timer); gcc->instant_edit_timer = - ecore_timer_add(1.0, _e_gadcon_client_cb_instant_edit_timer, + ecore_timer_loop_add(1.0, _e_gadcon_client_cb_instant_edit_timer, gcc); } } diff -Nru e20-201702271931/src/bin/e_gadget.c e20-201702281931/src/bin/e_gadget.c --- e20-201702271931/src/bin/e_gadget.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_gadget.c 2017-02-28 19:31:37.000000000 +0000 @@ -123,6 +123,7 @@ static void _gadget_object_finalize(E_Gadget_Config *zgc); static Eina_Bool _gadget_object_create(E_Gadget_Config *zgc); static void _editor_pointer_site_init(E_Gadget_Site_Orient orient, Evas_Object *site, Evas_Object *editor, Eina_Bool ); +static void _gadget_drop_handler_moveresize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED); static void _comp_site_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) @@ -297,6 +298,20 @@ } zgc->gadget = NULL; + if (zgc->drop_handlers) + { + Evas_Object **drop_object; + Eina_Iterator *it = eina_hash_iterator_key_new(zgc->drop_handlers); + + EINA_ITERATOR_FOREACH(it, drop_object) + { + evas_object_event_callback_del(*drop_object, EVAS_CALLBACK_MOVE, _gadget_drop_handler_moveresize); + evas_object_event_callback_del(*drop_object, EVAS_CALLBACK_RESIZE, _gadget_drop_handler_moveresize); + evas_object_event_callback_del(*drop_object, EVAS_CALLBACK_DEL, _gadget_drop_handler_del); + } + eina_iterator_free(it); + } + E_FREE_FUNC(zgc->drop_handlers, eina_hash_free); E_FREE_FUNC(zgc->gadget, evas_object_del); E_FREE_FUNC(zgc->cfg_object, evas_object_del); @@ -305,6 +320,7 @@ E_FREE(zgc->e_obj_inherit); zgc->configure = NULL; zgc->display_del = zgc->moving = zgc->resizing = 0; + if (zgc->id == -1) _gadget_free(zgc); } static void @@ -355,7 +371,7 @@ if (!zgc->site->orient) evas_object_smart_need_recalculate_set(zgc->site->layout, 1); - evas_object_event_callback_add(g, EVAS_CALLBACK_DEL, _gadget_del, zgc); + evas_object_event_callback_priority_add(g, EVAS_CALLBACK_DEL, EVAS_CALLBACK_PRIORITY_BEFORE, _gadget_del, zgc); _gadget_reparent(zgc->site, zgc); elm_object_tree_focus_allow_set(zgc->gadget, 0); evas_object_raise(zgc->site->events); @@ -1055,12 +1071,12 @@ EINA_LIST_REVERSE_FOREACH(drop->gadgets, ll, dzgc) { evas_object_smart_callback_call(zgs->layout, "gadget_moved", dzgc->gadget); + if (dzgc->id == -1) dzgc->id = 0; evas_object_del(dzgc->gadget); zgs->gadget_list = eina_inlist_prepend_relative(zgs->gadget_list, EINA_INLIST_GET(dzgc), EINA_INLIST_GET(zgc)); zgs->gadgets = eina_list_prepend_relative_list(zgs->gadgets, dzgc, l); dzgc->site = zgs; - if (dzgc->id == -1) dzgc->id = 0; dzgc->zone = -1; _gadget_object_finalize(dzgc); } @@ -1068,12 +1084,12 @@ EINA_LIST_REVERSE_FOREACH(drop->gadgets, ll, dzgc) { evas_object_smart_callback_call(zgs->layout, "gadget_moved", dzgc->gadget); + if (dzgc->id == -1) dzgc->id = 0; evas_object_del(dzgc->gadget); zgs->gadget_list = eina_inlist_append_relative(zgs->gadget_list, EINA_INLIST_GET(dzgc), EINA_INLIST_GET(zgc)); zgs->gadgets = eina_list_append_relative_list(zgs->gadgets, dzgc, l); dzgc->site = zgs; - if (dzgc->id == -1) dzgc->id = 0; dzgc->zone = -1; _gadget_object_finalize(dzgc); } @@ -1122,12 +1138,12 @@ EINA_LIST_FOREACH(drop->gadgets, l, dzgc) { evas_object_smart_callback_call(zgs->layout, "gadget_moved", dzgc->gadget); + if (dzgc->id == -1) dzgc->id = 0; evas_object_del(dzgc->gadget); zgs->gadget_list = eina_inlist_append(zgs->gadget_list, EINA_INLIST_GET(dzgc)); zgs->gadgets = eina_list_append(zgs->gadgets, dzgc); dzgc->site = zgs; - if (dzgc->id == -1) dzgc->id = 0; dzgc->zone = -1; _gadget_object_finalize(dzgc); } @@ -1168,6 +1184,7 @@ } else dzgc->zone = -1; + if (dzgc->id == -1) dzgc->id = 0; evas_object_del(dzgc->gadget); zgs->gadget_list = eina_inlist_append(zgs->gadget_list, EINA_INLIST_GET(dzgc)); @@ -1177,7 +1194,6 @@ dzgc->w = gw / (double)w; dzgc->h = gh / (double)h; dzgc->site = zgs; - if (dzgc->id == -1) dzgc->id = 0; _gadget_object_finalize(dzgc); } } @@ -1636,7 +1652,7 @@ { elm_layout_file_get(style, NULL, &grp); eina_stringshare_replace(&zgc->style.name, strrchr(grp, '/') + 1); - evas_object_event_callback_add(style, EVAS_CALLBACK_DEL, _gadget_del, zgc); + evas_object_event_callback_priority_add(style, EVAS_CALLBACK_DEL, EVAS_CALLBACK_PRIORITY_BEFORE, _gadget_del, zgc); } else eina_stringshare_replace(&zgc->style.name, NULL); diff -Nru e20-201702271931/src/bin/e_gadget.h e20-201702281931/src/bin/e_gadget.h --- e20-201702271931/src/bin/e_gadget.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_gadget.h 2017-02-28 19:31:37.000000000 +0000 @@ -16,6 +16,8 @@ "gadget_destroyed" - a gadget object was destroyed on the site; all objects created by the gadget infrastructure are now dead + - do not watch both this and EVAS_CALLBACK_DEL, as the ordering of these + callbacks is not consistent "gadget_moved" - a gadget is preparing to move from its current site "gadget_removed" diff -Nru e20-201702271931/src/bin/e.h e20-201702281931/src/bin/e.h --- e20-201702271931/src/bin/e.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e.h 2017-02-28 19:31:37.000000000 +0000 @@ -321,6 +321,8 @@ extern E_API Eina_Bool e_precache_end; extern E_API Eina_Bool x_fatal; +extern E_API Eina_Bool after_restart; + extern EINTERN const char *e_first_frame; extern EINTERN double e_first_frame_start_time; diff -Nru e20-201702271931/src/bin/e_icon.c e20-201702281931/src/bin/e_icon.c --- e20-201702271931/src/bin/e_icon.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_icon.c 2017-02-28 19:31:37.000000000 +0000 @@ -114,7 +114,7 @@ fr = (sd->frame % (sd->frame_count)) + 1; evas_object_image_animated_frame_set(sd->obj, fr); t = evas_object_image_animated_frame_duration_get(sd->obj, fr, 0); - sd->timer = ecore_timer_add(t, _frame_anim, sd); + sd->timer = ecore_timer_loop_add(t, _frame_anim, sd); return EINA_FALSE; } @@ -132,7 +132,7 @@ if (sd->frame_count < 2) return 0; if (!sd->invalid) evas_object_show(sd->obj); t = evas_object_image_animated_frame_duration_get(sd->obj, sd->frame, 0); - sd->timer = ecore_timer_add(t, _frame_anim, sd); + sd->timer = ecore_timer_loop_add(t, _frame_anim, sd); return 1; } @@ -864,7 +864,7 @@ if (sd->fdo) { if (sd->fdo_reload_timer) ecore_timer_del(sd->fdo_reload_timer); - sd->fdo_reload_timer = ecore_timer_add(0.1, _e_icon_fdo_reload, sd); + sd->fdo_reload_timer = ecore_timer_loop_add(0.1, _e_icon_fdo_reload, sd); } if ((!sd->edje) && ((sd->loading && sd->preload) || @@ -874,7 +874,7 @@ evas_object_image_scale_hint_set(sd->obj, EVAS_IMAGE_SCALE_HINT_DYNAMIC); if (!sd->guessing_animation) - sd->guessing_animation = ecore_timer_add(0.3, + sd->guessing_animation = ecore_timer_loop_add(0.3, _e_icon_guess_anim, sd); } diff -Nru e20-201702271931/src/bin/e_ilist.c e20-201702281931/src/bin/e_ilist.c --- e20-201702271931/src/bin/e_ilist.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_ilist.c 2017-02-28 19:31:37.000000000 +0000 @@ -1201,7 +1201,7 @@ if (sd->typebuf.timer) ecore_timer_del(sd->typebuf.timer); - sd->typebuf.timer = ecore_timer_add(3.0, _e_typebuf_timer_cb, obj); + sd->typebuf.timer = ecore_timer_loop_add(3.0, _e_typebuf_timer_cb, obj); } static void diff -Nru e20-201702271931/src/bin/e_init.c e20-201702281931/src/bin/e_init.c --- e20-201702271931/src/bin/e_init.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_init.c 2017-02-28 19:31:37.000000000 +0000 @@ -74,7 +74,7 @@ "Disable splash screen"); edje_object_signal_callback_add(_e_init_object, "e,state,done_ok", "e", _e_init_cb_signal_done_ok, NULL); - _e_init_timeout_timer = ecore_timer_add(240.0, _e_init_cb_timeout, NULL); + _e_init_timeout_timer = ecore_timer_loop_add(240.0, _e_init_cb_timeout, NULL); e_init_title_set(_("Enlightenment")); e_init_version_set(VERSION); } diff -Nru e20-201702271931/src/bin/e_int_gadcon_config.c e20-201702281931/src/bin/e_int_gadcon_config.c --- e20-201702271931/src/bin/e_int_gadcon_config.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_int_gadcon_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -722,7 +722,7 @@ //////////////////////////////////////////////////////////// e_widget_toolbook_page_show(otb, 0); if (cfdata->load_timer) ecore_timer_del(cfdata->load_timer); - cfdata->load_timer = ecore_timer_add(0.01, _cb_load_timer, cfdata); + cfdata->load_timer = ecore_timer_loop_add(0.01, _cb_load_timer, cfdata); elm_win_center(cfd->dia->win, 1, 1); @@ -756,7 +756,7 @@ e_widget_table_object_append(ot, cfdata->o_del, 1, 1, 1, 1, 1, 1, 1, 0); if (cfdata->load_timer) ecore_timer_del(cfdata->load_timer); - cfdata->load_timer = ecore_timer_add(0.01, _cb_load_timer, cfdata); + cfdata->load_timer = ecore_timer_loop_add(0.01, _cb_load_timer, cfdata); elm_win_center(cfd->dia->win, 1, 1); diff -Nru e20-201702271931/src/bin/e_int_menus.c e20-201702281931/src/bin/e_int_menus.c --- e20-201702271931/src/bin/e_int_menus.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_int_menus.c 2017-02-28 19:31:37.000000000 +0000 @@ -344,18 +344,15 @@ e_menu_pre_activate_callback_set(subm, _e_int_menus_shelves_pre_cb, NULL); e_menu_item_submenu_set(mi, subm); - if (E_EFL_VERSION_MINIMUM(1, 17, 99)) - { - mi = e_menu_item_new(m); - e_menu_item_label_set(mi, _("Add Bryce")); - e_util_menu_item_theme_icon_set(mi, "list-add"); - e_menu_item_callback_set(mi, _e_int_menus_bryce_cb, NULL); + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Add Bryce")); + e_util_menu_item_theme_icon_set(mi, "list-add"); + e_menu_item_callback_set(mi, _e_int_menus_bryce_cb, NULL); - mi = e_menu_item_new(m); - e_menu_item_label_set(mi, _("Add Gadgets To Desktop")); - e_util_menu_item_theme_icon_set(mi, "list-add"); - e_menu_item_callback_set(mi, _e_int_menus_desktop_gadget_add_cb, NULL); - } + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Add Gadgets To Desktop")); + e_util_menu_item_theme_icon_set(mi, "list-add"); + e_menu_item_callback_set(mi, _e_int_menus_desktop_gadget_add_cb, NULL); mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); @@ -911,9 +908,9 @@ e_object_del_attach_func_set(E_OBJECT(mn), NULL); if (_e_int_menus_app_cleaner) - ecore_timer_reset(_e_int_menus_app_cleaner); + ecore_timer_loop_reset(_e_int_menus_app_cleaner); else - _e_int_menus_app_cleaner = ecore_timer_add(300, _e_int_menus_app_cleaner_cb, NULL); + _e_int_menus_app_cleaner = ecore_timer_loop_add(300, _e_int_menus_app_cleaner_cb, NULL); eina_stringshare_del(dir); if (m) { @@ -955,7 +952,7 @@ } if (!menu) return; if (_e_int_menus_app_cleaner) - ecore_timer_reset(_e_int_menus_app_cleaner); + ecore_timer_loop_reset(_e_int_menus_app_cleaner); eina_stringshare_del(dir); _e_int_menus_apps_scan(m, menu); if (m->pre_activate_cb.func == _e_int_menus_apps_start) diff -Nru e20-201702271931/src/bin/e_log.c e20-201702281931/src/bin/e_log.c --- e20-201702271931/src/bin/e_log.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_log.c 2017-02-28 19:31:37.000000000 +0000 @@ -39,6 +39,9 @@ if (level < 1) eina_log_print_cb_set(_e_log_cb, NULL); } +#ifndef E_RELEASE_BUILD + eina_log_abort_on_critical_set(1); +#endif return e_log_dom != -1; } diff -Nru e20-201702271931/src/bin/e_main.c e20-201702281931/src/bin/e_main.c --- e20-201702271931/src/bin/e_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -111,6 +111,7 @@ E_API Eina_Bool stopping = EINA_FALSE; E_API Eina_Bool restart = EINA_FALSE; E_API Eina_Bool e_nopause = EINA_FALSE; +E_API Eina_Bool after_restart = EINA_FALSE; EINTERN const char *e_first_frame = NULL; EINTERN double e_first_frame_start_time = -1; @@ -213,7 +214,6 @@ { Eina_Bool nostartup = EINA_FALSE; Eina_Bool safe_mode = EINA_FALSE; - Eina_Bool after_restart = EINA_FALSE; Eina_Bool waslocked = EINA_FALSE; Eina_Stringshare *strshare; double t = 0.0, tstart = 0.0; @@ -909,16 +909,12 @@ TS("E_Remember Init Done"); _e_main_shutdown_push(e_remember_shutdown); - if (E_EFL_VERSION_MINIMUM(1, 17, 99)) - { - if (e_config->show_splash) - e_init_status_set(_("Setup Gadgets")); - TS("E_Gadget Init"); - e_gadget_init(); - TS("E_Gadget Init Done"); - _e_main_shutdown_push((void*)e_gadget_shutdown); - } - + if (e_config->show_splash) + e_init_status_set(_("Setup Gadgets")); + TS("E_Gadget Init"); + e_gadget_init(); + TS("E_Gadget Init Done"); + _e_main_shutdown_push((void*)e_gadget_shutdown); if (e_config->show_splash) e_init_status_set(_("Setup Gadcon")); @@ -1046,7 +1042,7 @@ TS("Run Startup Apps Done"); if (e_config->show_splash && (!after_restart)) - ecore_timer_add(2.0, _e_main_cb_startup_fake_end, NULL); + ecore_timer_loop_add(2.0, _e_main_cb_startup_fake_end, NULL); TS("E_Comp Thaw"); e_comp_all_thaw(); diff -Nru e20-201702271931/src/bin/e_menu.c e20-201702281931/src/bin/e_menu.c --- e20-201702271931/src/bin/e_menu.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_menu.c 2017-02-28 19:31:37.000000000 +0000 @@ -83,7 +83,7 @@ static void _e_menu_cb_mouse_evas_down(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED); /* local subsystem globals */ -static Ecore_Window _e_menu_win = 0; +static Ecore_Window _e_menu_win = UINT_MAX; static Eina_List *_e_active_menus = NULL; static E_Menu_Item *_e_active_menu_item = NULL; static E_Menu_Item *_e_prev_active_menu_item = NULL; @@ -1182,19 +1182,19 @@ if (!_e_active_menus) { - if (_e_menu_win) + if (_e_menu_win == e_comp->ee_win) { e_comp_ungrab_input(1, 1); - _e_menu_win = 0; + _e_menu_win = UINT_MAX; e_bindings_disabled_set(0); } } } -E_API Ecore_Window -e_menu_grab_window_get(void) +E_API Eina_Bool +e_menu_is_active(void) { - return _e_menu_win; + return _e_menu_win == e_comp->ee_win; } /* local subsystem functions */ @@ -1626,6 +1626,7 @@ } m->comp_object = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_MENU); + evas_object_data_set(m->comp_object, "E_Menu", m); if (!m->parent_item) e_comp_object_util_autoclose(m->comp_object, _e_menu_cb_mouse_evas_down, _e_menu_cb_key_down, m); evas_object_name_set(m->comp_object, "m->comp_object"); @@ -1873,12 +1874,12 @@ m->pre_activate_cb.func(m->pre_activate_cb.data, m); m->fast_mouse = 0; m->pending_new_submenu = 0; - if (!_e_menu_win) + if (_e_menu_win != e_comp->ee_win) { _e_menu_win = e_comp->ee_win; if (!e_comp_grab_input(1, 1)) { - _e_menu_win = 0; + _e_menu_win = UINT_MAX; return; } e_bindings_disabled_set(1); diff -Nru e20-201702271931/src/bin/e_menu.h e20-201702281931/src/bin/e_menu.h --- e20-201702271931/src/bin/e_menu.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_menu.h 2017-02-28 19:31:37.000000000 +0000 @@ -203,7 +203,7 @@ E_API void e_menu_idler_before(void); -E_API Ecore_Window e_menu_grab_window_get(void); +E_API Eina_Bool e_menu_is_active(void); #endif #endif diff -Nru e20-201702271931/src/bin/e_module.c e20-201702281931/src/bin/e_module.c --- e20-201702271931/src/bin/e_module.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_module.c 2017-02-28 19:31:37.000000000 +0000 @@ -154,6 +154,7 @@ const char *list[] = { "xwayland", + "wl_buffer", "wl_desktop_shell", "wl_drm", "wl_fb", @@ -831,7 +832,7 @@ dd->title = strdup(title); dd->body = strdup(body); dd->m = m; - ecore_timer_add(1.5, (Ecore_Task_Cb)_e_module_dialog_disable_timer, dd); + ecore_timer_loop_add(1.5, (Ecore_Task_Cb)_e_module_dialog_disable_timer, dd); } static void @@ -1033,6 +1034,7 @@ "shot", "start", "syscon", + "sysinfo", "systray", "tasks", "teamwork", @@ -1042,6 +1044,7 @@ "winlist", "wireless", "wizard", + "wl_buffer", "wl_desktop_shell", "wl_x11", "wl_wl", @@ -1115,7 +1118,7 @@ #endif if (eina_list_count(badl) != known) - ecore_timer_add(1.5, _e_module_whitelist_dialog_timer, badl); + ecore_timer_loop_add(1.5, _e_module_whitelist_dialog_timer, badl); else { EINA_LIST_FREE(badl, s) diff -Nru e20-201702271931/src/bin/e_mouse.c e20-201702281931/src/bin/e_mouse.c --- e20-201702271931/src/bin/e_mouse.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_mouse.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,10 +1,6 @@ #include "e.h" -#ifdef HAVE_WL_DRM -# ifdef HAVE_DRM2 -# include -# else -# include -# endif +#ifdef USE_MODULE_WL_DRM +# include #endif E_API int @@ -49,8 +45,7 @@ } #endif -#ifdef HAVE_WL_DRM -# ifdef HAVE_DRM2 +#ifdef USE_MODULE_WL_DRM if (strstr(ecore_evas_engine_name_get(e_comp->ee), "drm")) { Ecore_Drm2_Device *dev; @@ -59,19 +54,6 @@ if (dev) ecore_drm2_device_pointer_left_handed_set(dev, (Eina_Bool)!e_config->mouse_hand); } -# else - if (strstr(ecore_evas_engine_name_get(e_comp->ee), "drm")) - { - const Eina_List *list, *l; - Ecore_Drm_Device *dev; - - list = ecore_drm_devices_get(); - EINA_LIST_FOREACH(list, l, dev) - { - ecore_drm_device_pointer_left_handed_set(dev, (Eina_Bool)!e_config->mouse_hand); - } - } -# endif #endif return 1; } diff -Nru e20-201702271931/src/bin/e_notification.c e20-201702281931/src/bin/e_notification.c --- e20-201702271931/src/bin/e_notification.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_notification.c 2017-02-28 19:31:37.000000000 +0000 @@ -416,7 +416,7 @@ for (y = 0; y < notify->icon.raw.height; y++) { s = notify->icon.raw.data + (y * notify->icon.raw.rowstride); - d = (int *)(imgdata + (y * rowstride)); + d = (int *)(void *)(imgdata + (y * rowstride)); for (x = 0; x < notify->icon.raw.width; x++, s += notify->icon.raw.channels, d++) diff -Nru e20-201702271931/src/bin/e_order.c e20-201702281931/src/bin/e_order.c --- e20-201702271931/src/bin/e_order.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_order.c 2017-02-28 19:31:37.000000000 +0000 @@ -252,7 +252,7 @@ E_Order *eo = data; if (eo->delay) ecore_timer_del(eo->delay); - eo->delay = ecore_timer_add(0.2, _e_order_cb_monitor_delay, eo); + eo->delay = ecore_timer_loop_add(0.2, _e_order_cb_monitor_delay, eo); } static void diff -Nru e20-201702271931/src/bin/e_pixmap.c e20-201702281931/src/bin/e_pixmap.c --- e20-201702271931/src/bin/e_pixmap.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_pixmap.c 2017-02-28 19:31:37.000000000 +0000 @@ -346,7 +346,7 @@ else { pixmaps[type] = eina_hash_int64_new((Eina_Free_Cb)_e_pixmap_free); - wayland_time_base = ecore_time_get(); + wayland_time_base = ecore_loop_time_get(); } cp = _e_pixmap_new(type); cp->win = id; @@ -457,11 +457,6 @@ EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE); - if (!cp->usable) - { - cp->failures++; - return EINA_FALSE; - } if (!cp->dirty) return EINA_TRUE; switch (cp->type) { @@ -472,6 +467,11 @@ int pw, ph; E_Comp_X_Client_Data *cd = NULL; + if (!cp->usable) + { + cp->failures++; + return EINA_FALSE; + } pixmap = ecore_x_composite_name_window_pixmap_get(cp->parent ?: (Ecore_X_Window)cp->win); if (cp->client) { @@ -803,7 +803,7 @@ cd->frames = NULL; EINA_LIST_FREE(free_list, cb) { - double t = ecore_time_get() - wayland_time_base; + double t = ecore_loop_time_get() - wayland_time_base; wl_callback_send_done(cb, t * 1000); wl_resource_destroy(cb); } diff -Nru e20-201702271931/src/bin/e_place.c e20-201702281931/src/bin/e_place.c --- e20-201702271931/src/bin/e_place.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_place.c 2017-02-28 19:31:37.000000000 +0000 @@ -77,6 +77,7 @@ if (eina_list_data_find(skiplist, ec)) return EINA_TRUE; if (e_client_util_ignored_get(ec)) return EINA_TRUE; if (!evas_object_visible_get(ec->frame)) return EINA_TRUE; + if ((!e_client_has_xwindow(ec)) && (ec->netwm.type != E_WINDOW_TYPE_NORMAL)) return EINA_TRUE; return EINA_FALSE; } diff -Nru e20-201702271931/src/bin/e_pointer.c e20-201702281931/src/bin/e_pointer.c --- e20-201702271931/src/bin/e_pointer.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_pointer.c 2017-02-28 19:31:37.000000000 +0000 @@ -129,7 +129,7 @@ { _e_pointer_active(ptr); if (ptr->idle_tmr) - ecore_timer_reset(ptr->idle_tmr); + ecore_timer_loop_reset(ptr->idle_tmr); else { E_FREE_FUNC(ptr->idle_poll, ecore_poller_del); @@ -459,16 +459,7 @@ _e_pointer_hot_update(ptr, x, y); if (ptr->canvas) - { - E_Client *ec = e_client_top_get(); - - if (ec && (e_comp->comp_type == E_PIXMAP_TYPE_WL) && - (!e_pixmap_is_x(ec->pixmap)) && ec->override && - eina_streq(type, "default")) - e_pointer_object_set(ptr, ec->frame, 0, 0); - else - e_pointer_object_set(ptr, NULL, 0, 0); - } + e_pointer_object_set(ptr, NULL, 0, 0); else evas_object_show(ptr->o_ptr); @@ -598,6 +589,14 @@ } E_API void +e_pointer_show(E_Pointer *ptr) +{ + if ((!ptr->buffer_evas) && ptr->win) _e_pointer_canvas_add(ptr); + if (ptr->canvas) + evas_object_show(ptr->o_ptr); +} + +E_API void e_pointer_type_push(E_Pointer *ptr, void *obj, const char *type) { E_Pointer_Stack *stack; @@ -777,8 +776,9 @@ { Evas_Object *o; E_Client *ec; + int px, py; - ecore_evas_cursor_get(ptr->ee, &o, NULL, NULL, NULL); + ecore_evas_cursor_get(ptr->ee, &o, NULL, &px, &py); if (o) { if (o == obj) @@ -790,17 +790,20 @@ if (ec) ec->hidden = 1; } - ecore_evas_cursor_unset(ptr->ee); if (obj) { ec = e_comp_object_client_get(obj); if (ec) ec->hidden = 1; + ecore_evas_cursor_unset(ptr->ee); ecore_evas_object_cursor_set(ptr->ee, obj, E_LAYER_MAX - 1, x, y); } - else - ecore_evas_object_cursor_set(ptr->ee, ptr->o_ptr, E_LAYER_MAX - 1, ptr->hot.x, ptr->hot.y); + else if ((o != ptr->o_ptr) || (x != px) || (y != py)) + { + ecore_evas_cursor_unset(ptr->ee); + ecore_evas_object_cursor_set(ptr->ee, ptr->o_ptr, E_LAYER_MAX - 1, ptr->hot.x, ptr->hot.y); + } } E_API void diff -Nru e20-201702271931/src/bin/e_pointer.h e20-201702281931/src/bin/e_pointer.h --- e20-201702271931/src/bin/e_pointer.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_pointer.h 2017-02-28 19:31:37.000000000 +0000 @@ -66,6 +66,7 @@ E_API void e_pointers_size_set(int size); E_API void e_pointer_hide(E_Pointer *ptr); +E_API void e_pointer_show(E_Pointer *ptr); E_API void e_pointer_type_push(E_Pointer *ptr, void *obj, const char *type); E_API void e_pointer_type_pop(E_Pointer *ptr, void *obj, const char *type); E_API void e_pointer_mode_push(void *obj, E_Pointer_Mode mode); diff -Nru e20-201702271931/src/bin/e_powersave.c e20-201702281931/src/bin/e_powersave.c --- e20-201702271931/src/bin/e_powersave.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_powersave.c 2017-02-28 19:31:37.000000000 +0000 @@ -45,7 +45,7 @@ pa = calloc(1, sizeof(E_Powersave_Deferred_Action)); if (!pa) return NULL; if (deferred_timer) ecore_timer_del(deferred_timer); - deferred_timer = ecore_timer_add(defer_time, + deferred_timer = ecore_timer_loop_add(defer_time, _e_powersave_cb_deferred_timer, NULL); pa->func = func; @@ -165,7 +165,7 @@ if (!EINA_DBL_EQ(t, defer_time)) { if (deferred_timer) ecore_timer_del(deferred_timer); - deferred_timer = ecore_timer_add(defer_time, + deferred_timer = ecore_timer_loop_add(defer_time, _e_powersave_cb_deferred_timer, NULL); defer_time = t; diff -Nru e20-201702271931/src/bin/e_randr2.c e20-201702281931/src/bin/e_randr2.c --- e20-201702271931/src/bin/e_randr2.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_randr2.c 2017-02-28 19:31:37.000000000 +0000 @@ -235,7 +235,7 @@ { if (_target_to == 255) { - _apply_delay = ecore_timer_add(5.0, _cb_delay_timer, NULL); + _apply_delay = ecore_timer_loop_add(5.0, _cb_delay_timer, NULL); _do_apply(); _screen_check_unconfigured(e_randr2, e_randr2_cfg); } @@ -1105,9 +1105,9 @@ // delay handling of screen shances as they can come in in a series over // time and thus we can batch up responding to them by waiting 1.0 sec if (_screen_delay_timer) - ecore_timer_reset(_screen_delay_timer); + ecore_timer_loop_reset(_screen_delay_timer); else - _screen_delay_timer = ecore_timer_add(1.0, _cb_screen_change_delay, NULL); + _screen_delay_timer = ecore_timer_loop_add(1.0, _cb_screen_change_delay, NULL); event_screen |= !!lid_event; } diff -Nru e20-201702271931/src/bin/e_remember.c e20-201702281931/src/bin/e_remember.c --- e20-201702271931/src/bin/e_remember.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_remember.c 2017-02-28 19:31:37.000000000 +0000 @@ -70,6 +70,11 @@ h = e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, _e_remember_cb_hook_eval_post_new_client, NULL); if (h) hooks = eina_list_append(hooks, h); + h = e_client_hook_add(E_CLIENT_HOOK_UNIGNORE, + _e_remember_cb_hook_pre_post_fetch, NULL); + h = e_client_hook_add(E_CLIENT_HOOK_UNIGNORE, + _e_remember_cb_hook_eval_post_new_client, NULL); + if (h) hooks = eina_list_append(hooks, h); _e_remember_init_edd(); remembers = e_config_domain_load("e_remember_restart", e_remember_list_edd); @@ -688,7 +693,6 @@ E_API void e_remember_update(E_Client *ec) { - if (ec->new_client) return; if (((!ec->remember) || ec->remember->keep_settings) && (!ec->sr_remember)) return; if (ec->remember) _e_remember_update(ec, ec->remember); if (ec->sr_remember) _e_remember_update(ec, ec->sr_remember); @@ -902,6 +906,7 @@ return rem; } } + else if (rem->apply & E_REMEMBER_APPLY_UUID) continue; if (ec->netwm.name) title = ec->netwm.name; else title = ec->icccm.title; @@ -983,8 +988,8 @@ rem->apply = E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE | E_REMEMBER_APPLY_BORDER; e_remember_use(rem); - e_remember_update(ec); ec->remember = rem; + e_remember_update(ec); } } diff -Nru e20-201702271931/src/bin/e_screensaver.c e20-201702281931/src/bin/e_screensaver.c --- e20-201702271931/src/bin/e_screensaver.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_screensaver.c 2017-02-28 19:31:37.000000000 +0000 @@ -114,7 +114,7 @@ { E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del); if (timeout) - _e_screensaver_timer = ecore_timer_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1); + _e_screensaver_timer = ecore_timer_loop_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1); } #endif } @@ -238,7 +238,7 @@ if (_e_screensaver_suspend_timer) ecore_timer_del(_e_screensaver_suspend_timer); _e_screensaver_suspend_timer = - ecore_timer_add(e_config->screensaver_suspend_delay, + ecore_timer_loop_add(e_config->screensaver_suspend_delay, _e_screensaver_suspend_cb, NULL); } return ECORE_CALLBACK_PASS_ON; @@ -257,7 +257,7 @@ } if (e_config->screensaver_suspend) _e_screensaver_suspend_timer = - ecore_timer_add(e_config->screensaver_suspend_delay, + ecore_timer_loop_add(e_config->screensaver_suspend_delay, _e_screensaver_suspend_cb, NULL); last_start = ecore_loop_time_get(); _e_screensaver_ask_presentation_count = 0; @@ -288,7 +288,7 @@ _e_screensaver_ask_presentation_count = 0; #ifdef HAVE_WAYLAND if (_e_screensaver_timeout && (e_comp->comp_type == E_PIXMAP_TYPE_WL)) - _e_screensaver_timer = ecore_timer_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1); + _e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1); #endif return ECORE_CALLBACK_PASS_ON; } @@ -499,7 +499,7 @@ if (t < 1.0) t = 1.0; E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del); if (e_config->screensaver_enable) - screensaver_idle_timer = ecore_timer_add + screensaver_idle_timer = ecore_timer_loop_add (t, _e_screensaver_idle_timer_cb, NULL); if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_DIM) { @@ -543,10 +543,10 @@ if (e_screensaver_on_get()) { ecore_event_add(E_EVENT_SCREENSAVER_OFF_PRE, NULL, NULL, NULL); - _e_screensaver_timer = ecore_timer_add(0.2, _e_screensaver_idle_timeout_cb, NULL); + _e_screensaver_timer = ecore_timer_loop_add(0.2, _e_screensaver_idle_timeout_cb, NULL); } else if (_e_screensaver_timeout) - _e_screensaver_timer = ecore_timer_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1); + _e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1); #endif } diff -Nru e20-201702271931/src/bin/e_shelf.c e20-201702281931/src/bin/e_shelf.c --- e20-201702271931/src/bin/e_shelf.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_shelf.c 2017-02-28 19:31:37.000000000 +0000 @@ -489,7 +489,7 @@ { _e_shelf_cb_instant_hide_timer(es); es->hide_timer = - ecore_timer_add(es->cfg->hide_timeout, + ecore_timer_loop_add(es->cfg->hide_timeout, _e_shelf_cb_hide_urgent_timer, es); } else @@ -517,7 +517,7 @@ es->hidden = 1; if (!es->instant_timer) es->instant_timer = - ecore_timer_add(es->instant_delay, + ecore_timer_loop_add(es->instant_delay, _e_shelf_cb_instant_hide_timer, es); } else @@ -530,7 +530,7 @@ es->hidden = 1; if (es->hide_timer) ecore_timer_del(es->hide_timer); es->hide_timer = - ecore_timer_add(es->cfg->hide_timeout, + ecore_timer_loop_add(es->cfg->hide_timeout, _e_shelf_cb_hide_animator_timer, es); } } @@ -1911,10 +1911,10 @@ * back to mouse in/out events */ inside = E_INSIDE(e_comp_canvas_x_root_adjust(ev->root.x), - e_comp_canvas_x_root_adjust(ev->root.y), + e_comp_canvas_y_root_adjust(ev->root.y), es->zone->x, es->zone->y, es->zone->w + 4, es->zone->h + 4); x = e_comp_canvas_x_root_adjust(ev->root.x) - es->zone->x; - y = e_comp_canvas_x_root_adjust(ev->root.y) - es->zone->y; + y = e_comp_canvas_y_root_adjust(ev->root.y) - es->zone->y; if (inside) inside = ( ((E_INSIDE(x, y, es->x, es->y, es->w, es->h)) || @@ -1924,9 +1924,9 @@ if (inside) { if (es->autohide_timer) - ecore_timer_reset(es->autohide_timer); + ecore_timer_loop_reset(es->autohide_timer); else - es->autohide_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_e_shelf_cb_mouse_move_autohide_fuck_systray, es); + es->autohide_timer = ecore_timer_loop_add(0.5, (Ecore_Task_Cb)_e_shelf_cb_mouse_move_autohide_fuck_systray, es); } if (inside) { @@ -2143,7 +2143,7 @@ { es->hidden = 1; if (!es->hide_timer) - es->hide_timer = ecore_timer_add(es->cfg->hide_timeout, _e_shelf_cb_hide_animator_timer, es); + es->hide_timer = ecore_timer_loop_add(es->cfg->hide_timeout, _e_shelf_cb_hide_animator_timer, es); } if (es->hidden && (!es->hide_timer)) edje_object_signal_emit(es->o_base, "e,state,hidden", "e"); diff -Nru e20-201702271931/src/bin/e_slider.c e20-201702281931/src/bin/e_slider.c --- e20-201702271931/src/bin/e_slider.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_slider.c 2017-02-28 19:31:37.000000000 +0000 @@ -283,7 +283,7 @@ _e_smart_value_update(E_Smart_Data *sd) { if (sd->set_timer) ecore_timer_del(sd->set_timer); - sd->set_timer = ecore_timer_add(0.05, _e_smart_set_timer, sd); + sd->set_timer = ecore_timer_loop_add(0.05, _e_smart_set_timer, sd); } static void diff -Nru e20-201702271931/src/bin/e_spectrum.c e20-201702281931/src/bin/e_spectrum.c --- e20-201702271931/src/bin/e_spectrum.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_spectrum.c 2017-02-28 19:31:37.000000000 +0000 @@ -348,7 +348,7 @@ if (!sp || !sp->cv) return; if (sp->draw_timer) ecore_timer_del(sp->draw_timer); - sp->draw_timer = ecore_timer_add(.001, _e_spectrum_redraw, sp); + sp->draw_timer = ecore_timer_loop_add(.001, _e_spectrum_redraw, sp); } Evas_Object * diff -Nru e20-201702271931/src/bin/e_sys.c e20-201702281931/src/bin/e_sys.c --- e20-201702271931/src/bin/e_sys.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_sys.c 2017-02-28 19:31:37.000000000 +0000 @@ -46,8 +46,8 @@ static Eina_Bool systemd_works = EINA_FALSE; static int _e_sys_systemd_inhibit_fd = -1; -static const int E_LOGOUT_AUTO_TIME = 60; -static const int E_LOGOUT_WAIT_TIME = 15; +static const int E_LOGOUT_AUTO_TIME = 60.0; +static const int E_LOGOUT_WAIT_TIME = 3.0; static Ecore_Timer *action_timeout = NULL; @@ -108,29 +108,36 @@ } static void -_e_sys_comp_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_Bool nocomp_push) +_e_sys_comp_zones_fade(const char *sig, Eina_Bool out) { const Eina_List *l; E_Zone *zone; - Eina_Bool first = EINA_TRUE; - - if (_e_sys_comp_waiting == 0) _e_sys_comp_waiting++; - if (nocomp_push) e_comp_override_add(); - else e_comp_override_timed_pop(); - printf("_e_sys_comp_emit_cb_wait - [%x] %s %s\n", a, sig, rep); EINA_LIST_FOREACH(e_comp->zones, l, zone) { - e_zone_fade_handle(zone, nocomp_push, 0.5); + e_zone_fade_handle(zone, out, 0.5); edje_object_signal_emit(zone->base, sig, "e"); edje_object_signal_emit(zone->over, sig, "e"); - if ((rep) && (first)) - edje_object_signal_callback_add(zone->over, rep, "e", _e_sys_comp_done_cb, (void *)(long)a); - first = EINA_FALSE; } +} + +static void +_e_sys_comp_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_Bool nocomp_push) +{ + E_Zone *zone; + + if (_e_sys_comp_waiting == 0) _e_sys_comp_waiting++; + if (nocomp_push) e_comp_override_add(); + else e_comp_override_timed_pop(); + printf("_e_sys_comp_emit_cb_wait - [%x] %s %s\n", a, sig, rep); + + _e_sys_comp_zones_fade(sig, nocomp_push); + if (rep) { + zone = eina_list_data_get(e_comp->zones); + if (zone) edje_object_signal_callback_add(zone->over, rep, "e", _e_sys_comp_done_cb, (void *)(long)a); if (action_timeout) ecore_timer_del(action_timeout); - action_timeout = ecore_timer_add(ACTION_TIMEOUT, (Ecore_Task_Cb)_e_sys_comp_action_timeout, (intptr_t*)(long)a); + action_timeout = ecore_timer_loop_add(ACTION_TIMEOUT, (Ecore_Task_Cb)_e_sys_comp_action_timeout, (intptr_t*)(long)a); } } @@ -168,7 +175,7 @@ _e_sys_comp_resume(void) { evas_damage_rectangle_add(e_comp->evas, 0, 0, e_comp->w, e_comp->h); - _e_sys_comp_emit_cb_wait(E_SYS_SUSPEND, "e,state,sys,resume", NULL, EINA_FALSE); + _e_sys_comp_zones_fade("e,state,sys,resume", EINA_FALSE); e_screensaver_deactivate(); } @@ -429,7 +436,7 @@ fail: systemd_works = EINA_FALSE; /* delay this for 1.0 seconds while the rest of e starts up */ - ecore_timer_add(1.0, _e_sys_cb_timer, NULL); + ecore_timer_loop_add(1.0, _e_sys_cb_timer, NULL); } static void @@ -485,7 +492,7 @@ ecore_timer_del(_e_sys_susp_hib_check_timer); _e_sys_susp_hib_check_last_tick = ecore_time_unix_get(); _e_sys_susp_hib_check_timer = - ecore_timer_add(0.1, _e_sys_susp_hib_check_timer_cb, NULL); + ecore_timer_loop_add(0.1, _e_sys_susp_hib_check_timer_cb, NULL); } /* local subsystem functions */ @@ -589,7 +596,7 @@ _e_sys_cb_logout_wait(void *data EINA_UNUSED, E_Dialog *dia) { if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer); - _e_sys_logout_timer = ecore_timer_add(0.5, _e_sys_cb_logout_timer, NULL); + _e_sys_logout_timer = ecore_timer_loop_add(0.5, _e_sys_cb_logout_timer, NULL); _e_sys_logout_begin_time = ecore_time_get(); e_object_del(E_OBJECT(dia)); _e_sys_logout_confirm_dialog = NULL; @@ -672,9 +679,8 @@ } else { - /* it has taken 15 seconds of waiting and we still have apps that - * will not go away - */ + // it has taken E_LOGOUT_WAIT_TIME seconds of waiting and we still + // have apps that will not go away double now = ecore_loop_time_get(); if ((now - _e_sys_logout_begin_time) > E_LOGOUT_WAIT_TIME) { @@ -686,6 +692,7 @@ _e_sys_logout_confirm_dialog = dia; e_dialog_title_set(dia, _("Logout problems")); e_dialog_icon_set(dia, "system-log-out", 64); + _e_sys_logout_confirm_dialog_update(E_LOGOUT_AUTO_TIME); e_dialog_button_add(dia, _("Logout now"), NULL, _e_sys_cb_logout_logout, NULL); e_dialog_button_add(dia, _("Wait longer"), NULL, @@ -693,7 +700,6 @@ e_dialog_button_add(dia, _("Cancel Logout"), NULL, _e_sys_cb_logout_abort, NULL); e_dialog_button_focus_num(dia, 1); - _e_sys_logout_confirm_dialog_update(E_LOGOUT_AUTO_TIME); elm_win_center(dia->win, 1, 1); e_win_no_remember_set(dia->win, 1); e_dialog_show(dia); @@ -749,7 +755,7 @@ /* and poll to see if all pending windows are gone yet every 0.5 sec */ _e_sys_logout_begin_time = ecore_time_get(); if (_e_sys_logout_timer) ecore_timer_del(_e_sys_logout_timer); - _e_sys_logout_timer = ecore_timer_add(0.5, _e_sys_cb_logout_timer, NULL); + _e_sys_logout_timer = ecore_timer_loop_add(0.5, _e_sys_cb_logout_timer, NULL); } static void diff -Nru e20-201702271931/src/bin/e_sys_main.c e20-201702281931/src/bin/e_sys_main.c --- e20-201702271931/src/bin/e_sys_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_sys_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -179,6 +179,8 @@ if (!action) exit(1); fprintf(stderr, "action %s %i\n", action, argc); + eina_init(); + uid = getuid(); gid = getgid(); egid = getegid(); @@ -199,8 +201,6 @@ exit(7); } - eina_init(); - if (!auth_action_ok(action, gid, gl, gn, egid)) { printf("ERROR: ACTION NOT ALLOWED: %s\n", action); diff -Nru e20-201702271931/src/bin/e_test.c e20-201702281931/src/bin/e_test.c --- e20-201702271931/src/bin/e_test.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_test.c 2017-02-28 19:31:37.000000000 +0000 @@ -33,7 +33,7 @@ _e_test_internal(); #ifdef DESKMIRROR_TEST - ecore_timer_add(2.0, deskmirror_test, NULL); + ecore_timer_loop_add(2.0, deskmirror_test, NULL); #endif } @@ -48,14 +48,14 @@ { e_menu_deactivate(m); e_object_del(E_OBJECT(m)); - ecore_timer_add(0.05, _e_test_timer, NULL); + ecore_timer_loop_add(0.05, _e_test_timer, NULL); return 0; } m = e_int_menus_main_new(); e_menu_activate_mouse(m, eina_list_data_get(e_comp->zones), 0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0); - ecore_timer_add(0.05, _e_test_timer, m); + ecore_timer_loop_add(0.05, _e_test_timer, m); return 0; } @@ -131,7 +131,7 @@ e_menu_activate_mouse(m, eina_list_data_get(e_comp->zones), 0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0); - ecore_timer_add(0.02, _e_test_timer, m); + ecore_timer_loop_add(0.02, _e_test_timer, m); } #elif 0 @@ -230,13 +230,13 @@ if (data == NULL) { dia = _e_test_dia(tcon); - ecore_timer_add(0.2, _e_test_timer, dia); + ecore_timer_loop_add(0.2, _e_test_timer, dia); } else { dia = data; e_object_del(E_OBJECT(dia)); - ecore_timer_add(0.2, _e_test_timer, NULL); + ecore_timer_loop_add(0.2, _e_test_timer, NULL); } return 0; } @@ -744,7 +744,7 @@ static void _e_test_internal(void) { - ecore_timer_add(1.0, _e_test_timer, c); + ecore_timer_loop_add(1.0, _e_test_timer, c); } #elif 0 @@ -811,7 +811,7 @@ static void _e_test_internal(void) { - ecore_timer_add(1.0, _e_test_timer, c); + ecore_timer_loop_add(1.0, _e_test_timer, c); } #elif 0 @@ -878,7 +878,7 @@ static void _e_test_internal(void) { - ecore_timer_add(1.0, _e_test_timer, c); + ecore_timer_loop_add(1.0, _e_test_timer, c); } #else diff -Nru e20-201702271931/src/bin/e_thumb.c e20-201702281931/src/bin/e_thumb.c --- e20-201702271931/src/bin/e_thumb.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_thumb.c 2017-02-28 19:31:37.000000000 +0000 @@ -9,13 +9,17 @@ const char *file; const char *key; char *sort_id; + struct { + int x, y, x_count, y_count; + } desk_pan; + Eina_List *sigsrc; unsigned char queued : 1; unsigned char busy : 1; unsigned char done : 1; }; /* local subsystem functions */ -static void _e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h); +static void _e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h, int desk_x, int desk_y, int desk_x_count, int desk_y_count, Eina_List *sigsrc); static void _e_thumb_gen_end(int objid); static void _e_thumb_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_thumb_hash_add(int objid, Evas_Object *obj); @@ -148,12 +152,20 @@ eth2->busy = 1; _pending++; if (_pending == 1) _e_thumb_thumbnailers_kill_cancel(); - _e_thumb_gen_begin(eth2->objid, eth2->file, eth2->key, eth2->w, eth2->h); + _e_thumb_gen_begin(eth2->objid, eth2->file, eth2->key, + eth2->w, eth2->h, + eth2->desk_pan.x, eth2->desk_pan.y, + eth2->desk_pan.x_count, eth2->desk_pan.y_count, + eth2->sigsrc); } eth->busy = 1; _pending++; if (_pending == 1) _e_thumb_thumbnailers_kill_cancel(); - _e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h); + _e_thumb_gen_begin(eth->objid, eth->file, eth->key, + eth->w, eth->h, + eth->desk_pan.x, eth->desk_pan.y, + eth->desk_pan.x_count, eth->desk_pan.y_count, + eth->sigsrc); } E_API void @@ -190,6 +202,28 @@ e_thumb_icon_begin(obj); } +E_API void +e_thumb_desk_pan_set(Evas_Object *obj, int x, int y, int x_count, int y_count) +{ + E_Thumb *eth; + eth = evas_object_data_get(obj, "e_thumbdata"); + if (!eth) return; + eth->desk_pan.x = x; + eth->desk_pan.y = y; + eth->desk_pan.x_count = x_count; + eth->desk_pan.y_count = y_count; +} + +E_API void +e_thumb_signal_add(Evas_Object *obj, const char *sig, const char *src) +{ + E_Thumb *eth; + eth = evas_object_data_get(obj, "e_thumbdata"); + if (!eth) return; + eth->sigsrc = eina_list_append(eth->sigsrc, eina_stringshare_add(sig)); + eth->sigsrc = eina_list_append(eth->sigsrc, eina_stringshare_add(src)); +} + #define A(v) (((v) >> 24) & 0xff) #define R(v) (((v) >> 16) & 0xff) #define G(v) (((v) >> 8) & 0xff) @@ -274,7 +308,11 @@ eth->busy = 1; _pending++; if (_pending == 1) _e_thumb_thumbnailers_kill_cancel(); - _e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h); + _e_thumb_gen_begin(eth->objid, eth->file, eth->key, + eth->w, eth->h, + eth->desk_pan.x, eth->desk_pan.y, + eth->desk_pan.x_count, eth->desk_pan.y_count, + eth->sigsrc); } } } @@ -289,25 +327,75 @@ /* local subsystem functions */ static void -_e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h) +_e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h, + int desk_x, int desk_y, int desk_x_count, int desk_y_count, + Eina_List *sigsrc) { - char *buf; - int l1, l2; + char *buf, *p; + int l1, l2, size, *desk; Ecore_Ipc_Client *cli; + Eina_List *l; + const char *s; /* send thumb req */ + // figure out buffer size needed l1 = strlen(file); l2 = 0; if (key) l2 = strlen(key); - buf = alloca(l1 + 1 + l2 + 1); - strcpy(buf, file); - if (key) strcpy(buf + l1 + 1, key); - else buf[l1 + 1] = 0; + size = (4 * sizeof(int)); // desk_x/y/count + size += l1 + 1; // file + size += l2 + 1; // key + EINA_LIST_FOREACH(sigsrc, l, s) + { + size += strlen(s) + 1; + } + buf = alloca(size); + p = buf; + + // fill in buffer data + // data is: + // [int]desk_x + // [int]desk_y + // [int]desk_x_count + // [int]desk_y_count + // [char[]]file + // [char[]]key + // optional: + // [char[]]sig1 + // [char[]]src1 + // [char[]]sig2 + // [char[]]src2 + // ... + desk = (int *)(void *)buf; + desk[0] = desk_x; + desk[1] = desk_y; + desk[2] = desk_x_count; + desk[3] = desk_y_count; + p += (4 * sizeof(int)); + strcpy(p, file); + p += l1 + 1; + if (key) + { + strcpy(p, key); + p += l2 + 1; + } + else + { + p[0] = 0; + p += 1; + } + EINA_LIST_FOREACH(sigsrc, l, s) + { + strcpy(p, s); + p += strlen(s) + 1; + } + + // actually send it off cli = eina_list_data_get(_thumbnailers); if (!cli) return; _thumbnailers = eina_list_remove_list(_thumbnailers, _thumbnailers); _thumbnailers = eina_list_append(_thumbnailers, cli); - ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 1, objid, w, h, buf, l1 + 1 + l2 + 1); + ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 1, objid, w, h, buf, size); } static void @@ -327,6 +415,7 @@ _e_thumb_del_hook(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { E_Thumb *eth; + const char *s; eth = evas_object_data_get(obj, "e_thumbdata"); if (!eth) return; @@ -344,6 +433,7 @@ if (eth->file) eina_stringshare_del(eth->file); if (eth->key) eina_stringshare_del(eth->key); free(eth->sort_id); + EINA_LIST_FREE(eth->sigsrc, s) eina_stringshare_del(s); free(eth); } @@ -379,7 +469,7 @@ _e_thumb_thumbnailers_kill(void) { if (_kill_timer) ecore_timer_del(_kill_timer); - _kill_timer = ecore_timer_add(1.0, _e_thumb_cb_kill, NULL); + _kill_timer = ecore_timer_loop_add(1.0, _e_thumb_cb_kill, NULL); } static void diff -Nru e20-201702271931/src/bin/e_thumb.h e20-201702281931/src/bin/e_thumb.h --- e20-201702271931/src/bin/e_thumb.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_thumb.h 2017-02-28 19:31:37.000000000 +0000 @@ -13,7 +13,9 @@ E_API void e_thumb_icon_size_set(Evas_Object *obj, int w, int h); E_API void e_thumb_icon_begin(Evas_Object *obj); E_API void e_thumb_icon_end(Evas_Object *obj); -E_API void e_thumb_icon_rethumb(Evas_Object *obj); +E_API void e_thumb_icon_rethumb(Evas_Object *obj); +E_API void e_thumb_desk_pan_set(Evas_Object *obj, int x, int y, int x_count, int y_count); +E_API void e_thumb_signal_add(Evas_Object *obj, const char *sig, const char *src); E_API const char *e_thumb_sort_id_get(Evas_Object *obj); E_API void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e); diff -Nru e20-201702271931/src/bin/e_thumb_main.c e20-201702281931/src/bin/e_thumb_main.c --- e20-201702271931/src/bin/e_thumb_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_thumb_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -35,10 +35,12 @@ struct _E_Thumb { - int objid; - int w, h; - char *file; - char *key; + int objid; + int w, h; + int desk_x, desk_y, desk_x_count, desk_y_count; + Eina_List *sigsrc; + char *file; + char *key; }; /* local subsystem functions */ @@ -55,7 +57,12 @@ static Eina_Bool _e_cb_timer(void *data); static void _e_thumb_generate(E_Thumb *eth); static char *_e_thumb_file_id(char *file, - char *key); + char *key, + int desk_x, + int desk_y, + int desk_x_count, + int desk_y_count, + Eina_List *sigsrc); /* local subsystem globals */ static Ecore_Ipc_Server *_e_ipc_server = NULL; @@ -184,8 +191,8 @@ Ecore_Ipc_Event_Server_Data *e; E_Thumb *eth; Eina_List *l; - char *file = NULL; - char *key = NULL; + const char *file = NULL; + const char *key = NULL; e = event; if (e->major != 5 /*E_IPC_DOMAIN_THUMB*/) return ECORE_CALLBACK_PASS_ON; @@ -194,14 +201,28 @@ case 1: if (e->data) { + const char *s, *start; + const int *desk; + Eina_List *sigsrc = NULL; + /* begin thumb */ /* don't check stuff. since this connects TO E it is connecting */ /* TO a trusted process that WILL send this message properly */ /* formatted. if the thumbnailer dies anyway - it's not a big loss */ /* but it is a sign of a bug in e formatting messages maybe */ - file = e->data; - key = file + strlen(file) + 1; + s = start = e->data; + desk = (const int *)(void *)(s); + s += (4 * sizeof(int)); + file = s; + s += strlen(s) + 1; + key = s; + s += strlen(s) + 1; if (!key[0]) key = NULL; + while ((s - start) < e->size) + { + sigsrc = eina_list_append(sigsrc, eina_stringshare_add(s)); + s += strlen(s) + 1; + } eth = calloc(1, sizeof(E_Thumb)); if (eth) { @@ -209,9 +230,14 @@ eth->w = e->ref_to; eth->h = e->response; eth->file = strdup(file); + eth->desk_x = desk[0]; + eth->desk_y = desk[1]; + eth->desk_x_count = desk[2]; + eth->desk_y_count = desk[3]; + eth->sigsrc = sigsrc; if (key) eth->key = strdup(key); _thumblist = eina_list_append(_thumblist, eth); - if (!_timer) _timer = ecore_timer_add(0.001, _e_cb_timer, NULL); + if (!_timer) _timer = ecore_timer_loop_add(0.001, _e_cb_timer, NULL); } } break; @@ -253,14 +279,17 @@ /* take thumb at head of list */ if (_thumblist) { + const char *s; + eth = eina_list_data_get(_thumblist); _thumblist = eina_list_remove_list(_thumblist, _thumblist); _e_thumb_generate(eth); + EINA_LIST_FREE(eth->sigsrc, s) eina_stringshare_del(s); free(eth->file); free(eth->key); free(eth); - if (_thumblist) _timer = ecore_timer_add(0.01, _e_cb_timer, NULL); + if (_thumblist) _timer = ecore_timer_loop_add(0.01, _e_cb_timer, NULL); else _timer = NULL; } else @@ -290,7 +319,7 @@ const unsigned int *data = NULL; time_t mtime_orig, mtime_thumb; - id = _e_thumb_file_id(eth->file, eth->key); + id = _e_thumb_file_id(eth->file, eth->key, eth->desk_x, eth->desk_y, eth->desk_x_count, eth->desk_y_count, eth->sigsrc); if (!id) return; td = strdup(id); @@ -338,6 +367,8 @@ ((!strcasecmp(ext, ".edj")) || (!strcasecmp(ext, ".eap")))) { + Eina_List *l; + ww = eth->w; hh = eth->h; im = ecore_evas_object_image_new(ee); @@ -358,6 +389,37 @@ evas_object_resize(edje, ww * 4, hh * 4); evas_object_show(edje); } + if ((eth->desk_x_count > 0) && + (eth->desk_y_count > 0)) + { + Edje_Message_Float_Set *msg; + + msg = alloca(sizeof(Edje_Message_Float_Set) + + (4 * sizeof(double))); + msg->count = 5; + msg->val[0] = 0.0; + msg->val[1] = eth->desk_x; + msg->val[2] = eth->desk_x_count; + msg->val[3] = eth->desk_y; + msg->val[4] = eth->desk_y_count; + edje_object_message_send(edje, EDJE_MESSAGE_FLOAT_SET, + 0, msg); + } + l = eth->sigsrc; + while (l) + { + const char *sig, *src; + + sig = l->data; + l = l->next; + if (l) + { + src = l->data; + l = l->next; + edje_object_signal_emit(edje, sig, src); + } + } + edje_object_message_signal_process(edje); evas_object_move(im, 0, 0); evas_object_resize(im, ww, hh); sortkey = EINA_TRUE; @@ -605,28 +667,32 @@ static char * _e_thumb_file_id(char *file, - char *key) + char *key, + int desk_x, + int desk_y, + int desk_x_count, + int desk_y_count, + Eina_List *sigsrc) { char s[64]; - const char *chmap = "0123456789abcdef"; - unsigned char *buf, id[20]; - int i, len, lenf; - - len = 0; - lenf = strlen(file); - len += lenf; - len++; - if (key) + const char *chmap = "0123456789abcdef", *str; + unsigned char id[20], *st; + Eina_Strbuf *sbuf; + int i; + Eina_List *l; + + sbuf = eina_strbuf_new(); + EINA_LIST_FOREACH(sigsrc, l, str) { - key += strlen(key); - len++; + eina_strbuf_append_printf(sbuf, "<<%s>>", str); } - buf = alloca(len); + eina_strbuf_append_printf(sbuf, "|%i.%i.%i.%i|", + desk_x, desk_y, desk_x_count, desk_y_count); + eina_strbuf_append_printf(sbuf, "///%s", file); + if (key) eina_strbuf_append_printf(sbuf, "/%s", key); - strcpy((char *)buf, file); - if (key) strcpy((char *)(buf + lenf + 1), key); - - e_sha1_sum(buf, len, id); + st = (unsigned char *)eina_strbuf_string_get(sbuf); + e_sha1_sum(st, eina_strbuf_length_get(sbuf), id); for (i = 0; i < 20; i++) { @@ -634,6 +700,8 @@ s[(i * 2) + 1] = chmap[(id[i]) & 0xf]; } s[(i * 2)] = 0; + eina_strbuf_free(sbuf); + return strdup(s); } diff -Nru e20-201702271931/src/bin/e_update.c e20-201702281931/src/bin/e_update.c --- e20-201702271931/src/bin/e_update.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_update.c 2017-02-28 19:31:37.000000000 +0000 @@ -235,7 +235,7 @@ later++; t *= (later * later); } - update_timer = ecore_timer_add(t, _update_timeout_cb, data); + update_timer = ecore_timer_loop_add(t, _update_timeout_cb, data); return EINA_FALSE; } diff -Nru e20-201702271931/src/bin/e_utils.c e20-201702281931/src/bin/e_utils.c --- e20-201702271931/src/bin/e_utils.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_utils.c 2017-02-28 19:31:37.000000000 +0000 @@ -24,7 +24,7 @@ e_util_wakeup(void) { if (_e_util_dummy_timer) return; - _e_util_dummy_timer = ecore_timer_add(0.0, _e_util_wakeup_cb, NULL); + _e_util_dummy_timer = ecore_timer_loop_add(0.0, _e_util_wakeup_cb, NULL); } E_API void @@ -916,13 +916,13 @@ { if (loaded > current) { - ecore_timer_add(1.0, _e_util_conf_timer_new, strdup(module_name)); + ecore_timer_loop_add(1.0, _e_util_conf_timer_new, strdup(module_name)); return EINA_FALSE; } loaded -= loaded % 1000000, current -= current % 1000000; if (loaded < current) { - ecore_timer_add(1.0, _e_util_conf_timer_old, strdup(module_name)); + ecore_timer_loop_add(1.0, _e_util_conf_timer_old, strdup(module_name)); return EINA_FALSE; } @@ -1049,8 +1049,8 @@ fprintf(stderr, "RESTACK %s %d OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", evas_object_layer_get(obj), name ?: "", name ? "|" : "", obj, x, y, w, h); } -static void -_e_util_size_debug(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +E_API void +e_util_size_debug(Evas_Object *obj) { int x, y, w, h; const char *name; @@ -1060,6 +1060,12 @@ fprintf(stderr, "%s %d OBJ[%s%s%p]: (%d,%d) - %dx%d\n", evas_object_visible_get(obj) ? "VIS" : "HID", evas_object_layer_get(obj), name ?: "", name ? "|" : "", obj, x, y, w, h); } +static void +_e_util_size_debug(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + e_util_size_debug(obj); +} + E_API void e_util_size_debug_set(Evas_Object *obj, Eina_Bool enable) { diff -Nru e20-201702271931/src/bin/e_utils.h e20-201702281931/src/bin/e_utils.h --- e20-201702271931/src/bin/e_utils.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_utils.h 2017-02-28 19:31:37.000000000 +0000 @@ -50,6 +50,7 @@ E_API Eina_Bool e_util_fullscreen_current_any(void); E_API Eina_Bool e_util_fullscreen_any(void); E_API const char *e_util_time_str_get(long int seconds); +E_API void e_util_size_debug(Evas_Object *obj); E_API void e_util_size_debug_set(Evas_Object *obj, Eina_Bool enable); E_API Efreet_Desktop *e_util_terminal_desktop_get(void); E_API void e_util_gadcon_orient_icon_set(E_Gadcon_Orient orient, Evas_Object *obj); diff -Nru e20-201702271931/src/bin/e_video.c e20-201702281931/src/bin/e_video.c --- e20-201702271931/src/bin/e_video.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_video.c 2017-02-28 19:31:37.000000000 +0000 @@ -123,7 +123,7 @@ Vidimg *vi = data; if (vi->offtimer) ecore_timer_del(vi->offtimer); - vi->offtimer = ecore_timer_add(10.0, vidimg_cb_suspend, vi); + vi->offtimer = ecore_timer_loop_add(10.0, vidimg_cb_suspend, vi); return ECORE_CALLBACK_PASS_ON; } diff -Nru e20-201702271931/src/bin/e_widget_bgpreview.c e20-201702281931/src/bin/e_widget_bgpreview.c --- e20-201702271931/src/bin/e_widget_bgpreview.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_widget_bgpreview.c 2017-02-28 19:31:37.000000000 +0000 @@ -10,11 +10,12 @@ typedef struct _E_Widget_Desk_Data E_Widget_Desk_Data; struct _E_Widget_Desk_Data { - Evas_Object *icon, *thumb, *live, *cont; + Evas_Object *icon, *live, *cont; int zone, x, y; Ecore_Event_Handler *bg_upd_hdl; Ecore_Job *resize_job; Eina_Bool configurable : 1; + Eina_Bool thumb : 1; }; /* local function prototypes */ @@ -26,21 +27,6 @@ static void _e_wid_cb_resize(void *data, Evas *evas, Evas_Object *obj, void *event); static Eina_Bool _e_wid_cb_bg_update(void *data, int type, void *event); -static void -_bgpreview_viewport_update(Evas_Object *o, const E_Zone *zone, int x, int y) -{ - Edje_Message_Float_Set *msg; - - msg = alloca(sizeof(Edje_Message_Float_Set) + (4 * sizeof(double))); - msg->count = 5; - msg->val[0] = 0.2 * (!!e_config->desk_flip_animate_mode);//e_config->desk_flip_animate_time; - msg->val[1] = x; - msg->val[2] = zone->desk_x_count; - msg->val[3] = y; - msg->val[4] = zone->desk_y_count; - edje_object_message_send(o, EDJE_MESSAGE_FLOAT_SET, 0, msg); -} - E_API Evas_Object * e_widget_bgpreview_add(Evas *evas, int nx, int ny) { @@ -96,14 +82,16 @@ dd->cont = evas_object_table_add(e); + dd->thumb = EINA_FALSE; if (eina_str_has_extension(bgfile, ".edj")) { - dd->live = e_livethumb_add(e); - dd->thumb = o = edje_object_add(e_livethumb_evas_get(dd->live)); - edje_object_file_set(o, bgfile, "e/desktop/background"); - _bgpreview_viewport_update(o, zone, x, y); - e_livethumb_thumb_set(dd->live, o); - evas_object_show(dd->thumb); + dd->live = o = e_thumb_icon_add(e); + e_thumb_icon_size_set(o, zone->w / 8, zone->h / 8); + e_thumb_icon_file_set(o, bgfile, "e/desktop/background"); + e_thumb_desk_pan_set(o, x, y, zone->desk_x_count, zone->desk_y_count); + e_icon_fill_inside_set(o, EINA_FALSE); + e_thumb_icon_begin(o); + dd->thumb = EINA_TRUE; } else if ((eina_str_has_extension(bgfile, ".gif")) || (eina_str_has_extension(bgfile, ".png")) || @@ -165,6 +153,9 @@ if (dd->thumb) { + const char *bgfile; + + bgfile = e_bg_file_get(dd->zone, dd->x, dd->y); zone = e_comp_object_util_zone_get(dd->live); if (!zone) zone = eina_list_data_get(e_comp->zones); evas_object_geometry_get(dd->cont, NULL, NULL, &w, &h); @@ -183,7 +174,10 @@ w = (zone->w * h) / zone->h; } } - e_livethumb_vsize_set(dd->live, w, h); + e_thumb_icon_size_set(dd->live, w, h); + e_thumb_icon_file_set(dd->live, bgfile, "e/desktop/background"); + e_icon_fill_inside_set(dd->live, EINA_FALSE); + e_thumb_icon_rethumb(dd->live); } dd->resize_job = NULL; } @@ -359,19 +353,20 @@ zone = e_comp_zone_number_get(dd->zone); bgfile = e_bg_file_get(dd->zone, dd->x, dd->y); - if (dd->thumb) evas_object_del(dd->thumb); - dd->thumb = NULL; if (dd->live) evas_object_del(dd->live); dd->live = NULL; + dd->thumb = EINA_FALSE; if (eina_str_has_extension(bgfile, ".edj")) { - dd->live = e_livethumb_add(e); - dd->thumb = o = edje_object_add(e_livethumb_evas_get(dd->live)); - edje_object_file_set(o, bgfile, "e/desktop/background"); - _bgpreview_viewport_update(o, zone, dd->x, dd->y); - e_livethumb_thumb_set(dd->live, o); - evas_object_show(dd->thumb); + dd->live = o = e_thumb_icon_add(e); + e_thumb_icon_size_set(o, zone->w / 8, zone->h / 8); + e_thumb_icon_file_set(o, bgfile, "e/desktop/background"); + e_thumb_desk_pan_set(o, dd->x, dd->y, zone->desk_x_count, zone->desk_y_count); + e_icon_fill_inside_set(o, EINA_FALSE); + e_thumb_icon_begin(o); + dd->thumb = EINA_TRUE; + _e_wid_livethumb_resize_job(dd); } else if ((eina_str_has_extension(bgfile, ".gif")) || (eina_str_has_extension(bgfile, ".png")) || @@ -387,7 +382,6 @@ { dd->live = o = e_video_add(e, bgfile, EINA_TRUE); } - _e_wid_livethumb_resize_job(dd); eina_stringshare_del(bgfile); evas_object_size_hint_weight_set(dd->live, 1, 1); diff -Nru e20-201702271931/src/bin/e_widget_ilist.c e20-201702281931/src/bin/e_widget_ilist.c --- e20-201702271931/src/bin/e_widget_ilist.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_widget_ilist.c 2017-02-28 19:31:37.000000000 +0000 @@ -219,7 +219,7 @@ if (!wd) return; if (!wd->queue.queue) return; if (wd->queue.timer) return; - wd->queue.timer = ecore_timer_add(0.00001, _queue_timer, obj); + wd->queue.timer = ecore_timer_loop_add(0.00001, _queue_timer, obj); } static void diff -Nru e20-201702271931/src/bin/e_xkb.c e20-201702281931/src/bin/e_xkb.c --- e20-201702271931/src/bin/e_xkb.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_xkb.c 2017-02-28 19:31:37.000000000 +0000 @@ -94,7 +94,7 @@ ecore_timer_del(save_group); - save_group = ecore_timer_add(0.5, _e_xkb_save_group, (void*)(intptr_t)ev->group); + save_group = ecore_timer_loop_add(0.5, _e_xkb_save_group, (void*)(intptr_t)ev->group); return ECORE_CALLBACK_PASS_ON; } @@ -118,7 +118,7 @@ _e_xkb_type_reconfig(comp_type); if (comp_type == E_PIXMAP_TYPE_X) - ecore_timer_add(1.5, _e_xkb_init_timer, NULL); + ecore_timer_loop_add(1.5, _e_xkb_init_timer, NULL); else if (comp_type == E_PIXMAP_TYPE_WL) { _eval_cur_group(); diff -Nru e20-201702271931/src/bin/e_xsettings.c e20-201702281931/src/bin/e_xsettings.c --- e20-201702271931/src/bin/e_xsettings.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_xsettings.c 2017-02-28 19:31:37.000000000 +0000 @@ -166,7 +166,7 @@ _e_xsettings_retry(Settings_Manager *sm) { if (sm->timer_retry) return; - sm->timer_retry = ecore_timer_add + sm->timer_retry = ecore_timer_loop_add (RETRY_TIMEOUT, _e_xsettings_activate_retry, sm); } @@ -273,13 +273,16 @@ { size_t str_len; size_t len; + C16 tmp16; + C32 tmp32; buffer[0] = s->type; buffer[1] = 0; buffer += 2; str_len = strlen(s->name); - *(C16 *)(buffer) = str_len; + tmp16 = str_len; + memcpy(buffer, &tmp16, sizeof(C16)); buffer += 2; memcpy(buffer, s->name, str_len); @@ -289,19 +292,22 @@ memset(buffer, 0, len); buffer += len; - *(C32 *)(buffer) = s->last_change; + tmp32 = s->last_change; + memcpy(buffer, &tmp32, sizeof(C32)); buffer += 4; switch (s->type) { case SETTING_TYPE_INT: - *(C32 *)(buffer) = s->i.value; + tmp32 = s->i.value; + memcpy(buffer, &tmp32, sizeof(C32)); buffer += 4; break; case SETTING_TYPE_STRING: str_len = strlen(s->s.value); - *(C32 *)(buffer) = str_len; + tmp32 = str_len; + memcpy(buffer, &tmp32, sizeof(C32)); buffer += 4; memcpy(buffer, s->s.value, str_len); @@ -313,11 +319,18 @@ break; case SETTING_TYPE_COLOR: - *(C16 *)(buffer) = s->c.red; - *(C16 *)(buffer + 2) = s->c.green; - *(C16 *)(buffer + 4) = s->c.blue; - *(C16 *)(buffer + 6) = s->c.alpha; - buffer += 8; + tmp16 = s->c.red; + memcpy(buffer, &tmp16, sizeof(C16)); + buffer += 2; + tmp16 = s->c.green; + memcpy(buffer, &tmp16, sizeof(C16)); + buffer += 2; + tmp16 = s->c.blue; + memcpy(buffer, &tmp16, sizeof(C16)); + buffer += 2; + tmp16 = s->c.alpha; + memcpy(buffer, &tmp16, sizeof(C16)); + buffer += 2; break; } @@ -332,6 +345,7 @@ size_t len = 12; Setting *s; Eina_List *l; + C32 tmp32; EINA_LIST_FOREACH(settings, l, s) len += s->length; @@ -346,9 +360,11 @@ #endif pos += 4; - *(C32 *)pos = sm->serial++; + tmp32 = sm->serial++; + memcpy(pos, &tmp32, sizeof(C32)); pos += 4; - *(C32 *)pos = eina_list_count(settings); + tmp32 = eina_list_count(settings); + memcpy(pos, &tmp32, sizeof(C32)); pos += 4; EINA_LIST_FOREACH(settings, l, s) diff -Nru e20-201702271931/src/bin/e_zone.c e20-201702281931/src/bin/e_zone.c --- e20-201702271931/src/bin/e_zone.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/e_zone.c 2017-02-28 19:31:37.000000000 +0000 @@ -628,7 +628,7 @@ zone->flip.ev = zev; zone->flip.bind = binding; zone->flip.switching = edge; - binding->timer = ecore_timer_add(((double)binding->delay), _e_zone_cb_edge_timer, zone); + binding->timer = ecore_timer_loop_add(((double)binding->delay), _e_zone_cb_edge_timer, zone); } } @@ -1398,13 +1398,13 @@ if (obs->owner->type == E_DESK_TYPE) { - desk = (E_Desk*)obs->owner; + desk = (void *)obs->owner; if (desk->visible) e_zone_useful_geometry_dirty(desk->zone); } else { - zone = (E_Zone*)obs->owner; + zone = (void *)obs->owner; e_zone_useful_geometry_dirty(zone); } } @@ -1696,14 +1696,14 @@ if (obs->owner->type == E_DESK_TYPE) { - desk = (E_Desk*)obs->owner; + desk = (void *)obs->owner; desk->obstacles = eina_inlist_remove(desk->obstacles, EINA_INLIST_GET(obs)); if (desk->visible) e_zone_useful_geometry_dirty(desk->zone); } else { - zone = (E_Zone*)obs->owner; + zone = (void *)obs->owner; zone->obstacles = eina_inlist_remove(zone->obstacles, EINA_INLIST_GET(obs)); e_zone_useful_geometry_dirty(zone); } diff -Nru e20-201702271931/src/bin/Makefile.mk e20-201702281931/src/bin/Makefile.mk --- e20-201702271931/src/bin/Makefile.mk 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/bin/Makefile.mk 2017-02-28 19:31:37.000000000 +0000 @@ -443,11 +443,23 @@ src/bin/generated/www-protocol.c \ src/bin/generated/www-server-protocol.h \ src/bin/generated/screenshooter-protocol.c \ -src/bin/generated/screenshooter-server-protocol.h +src/bin/generated/screenshooter-server-protocol.h \ +src/bin/generated/xdg-foreign-unstable-v1-protocol.c \ +src/bin/generated/xdg-foreign-unstable-v1-server-protocol.h \ +src/bin/generated/relative-pointer-unstable-v1-protocol.c \ +src/bin/generated/relative-pointer-unstable-v1-server-protocol.h \ +src/bin/generated/pointer-constraints-unstable-v1-protocol.c \ +src/bin/generated/pointer-constraints-unstable-v1-server-protocol.h src/bin/e_comp_wl_extensions.c: \ src/bin/generated/screenshooter-server-protocol.h \ - src/bin/generated/session-recovery-server-protocol.h + src/bin/generated/session-recovery-server-protocol.h \ + src/bin/generated/xdg-foreign-unstable-v1-protocol.c \ + src/bin/generated/xdg-foreign-unstable-v1-server-protocol.h \ + src/bin/generated/relative-pointer-unstable-v1-protocol.c \ + src/bin/generated/relative-pointer-unstable-v1-server-protocol.h \ + src/bin/generated/pointer-constraints-unstable-v1-protocol.c \ + src/bin/generated/pointer-constraints-unstable-v1-server-protocol.h src/bin/e_comp_wl.c: \ src/bin/generated/www-server-protocol.h diff -Nru e20-201702271931/src/modules/appmenu/e_mod_appmenu_render.c e20-201702281931/src/modules/appmenu/e_mod_appmenu_render.c --- e20-201702271931/src/modules/appmenu/e_mod_appmenu_render.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/appmenu/e_mod_appmenu_render.c 2017-02-28 19:31:37.000000000 +0000 @@ -168,7 +168,7 @@ menu_w = w; menu_h = h; if (menu_timer) ecore_timer_del(menu_timer); - menu_timer = ecore_timer_add(0.33, item_menu_delay, NULL); + menu_timer = ecore_timer_loop_add(0.33, item_menu_delay, NULL); } static void diff -Nru e20-201702271931/src/modules/backlight/e_mod_main.c e20-201702281931/src/modules/backlight/e_mod_main.c --- e20-201702271931/src/modules/backlight/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/backlight/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -399,13 +399,13 @@ { ecore_timer_del(inst->popup_timer); e_widget_slider_value_double_set(inst->o_slider, inst->val); - inst->popup_timer = ecore_timer_add(1.0, _backlight_popup_timer_cb, inst); + inst->popup_timer = ecore_timer_loop_add(1.0, _backlight_popup_timer_cb, inst); } } else { _backlight_popup_new(inst); - inst->popup_timer = ecore_timer_add(1.0, _backlight_popup_timer_cb, inst); + inst->popup_timer = ecore_timer_loop_add(1.0, _backlight_popup_timer_cb, inst); } } diff -Nru e20-201702271931/src/modules/battery/batget.c e20-201702281931/src/modules/battery/batget.c --- e20-201702271931/src/modules/battery/batget.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/battery/batget.c 2017-02-28 19:31:37.000000000 +0000 @@ -327,12 +327,12 @@ free(sysev); if (re_init_timer) ecore_timer_del(re_init_timer); - re_init_timer = ecore_timer_add(1.0, linux_sys_class_power_supply_cb_re_init, NULL); + re_init_timer = ecore_timer_loop_add(1.0, linux_sys_class_power_supply_cb_re_init, NULL); } else { if (sys_class_delay_check) ecore_timer_del(sys_class_delay_check); - sys_class_delay_check = ecore_timer_add(0.2, linux_sys_class_power_supply_cb_delay_check, NULL); + sys_class_delay_check = ecore_timer_loop_add(0.2, linux_sys_class_power_supply_cb_delay_check, NULL); } } return ECORE_CALLBACK_CANCEL; @@ -756,7 +756,7 @@ void *event EINA_UNUSED) { if (delay_check) ecore_timer_del(delay_check); - delay_check = ecore_timer_add(0.2, linux_acpi_cb_delay_check, NULL); + delay_check = ecore_timer_loop_add(0.2, linux_acpi_cb_delay_check, NULL); return ECORE_CALLBACK_PASS_ON; } @@ -792,7 +792,7 @@ else { if (delay_check) ecore_timer_del(delay_check); - delay_check = ecore_timer_add(0.2, linux_acpi_cb_delay_check, NULL); + delay_check = ecore_timer_loop_add(0.2, linux_acpi_cb_delay_check, NULL); } } return ECORE_CALLBACK_RENEW; diff -Nru e20-201702271931/src/modules/battery/e_mod_main.c e20-201702281931/src/modules/battery/e_mod_main.c --- e20-201702271931/src/modules/battery/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/battery/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -500,7 +500,7 @@ (!battery_config->alert_timer)) { battery_config->alert_timer = - ecore_timer_add(battery_config->alert_timeout, + ecore_timer_loop_add(battery_config->alert_timeout, _battery_cb_warning_popup_timeout, inst); } } diff -Nru e20-201702271931/src/modules/battery/e_mod_sysctl.c e20-201702281931/src/modules/battery/e_mod_sysctl.c --- e20-201702271931/src/modules/battery/e_mod_sysctl.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/battery/e_mod_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -11,15 +11,15 @@ #include "e.h" #include "e_mod_main.h" -static Eina_Bool _battery_sysctl_battery_update_poll(void *data); +static Eina_Bool _battery_sysctl_battery_update_poll(void *data EINA_UNUSED); static int _battery_sysctl_battery_update(); extern Eina_List *device_batteries; extern Eina_List *device_ac_adapters; extern double init_time; -Ac_Adapter *ac = NULL; -Battery *bat = NULL; +static Ac_Adapter *ac = NULL; +static Battery *bat = NULL; int _battery_sysctl_start(void) @@ -138,8 +138,8 @@ if (ac) { eina_stringshare_del(ac->udi); - free(ac->mib); - free(ac); + E_FREE(ac->mib); + E_FREE(ac); } if (bat) @@ -150,17 +150,17 @@ eina_stringshare_del(bat->vendor); ecore_poller_del(bat->poll); #if defined(__FreeBSD__) || defined(__DragonFly__) - free(bat->mib_state); - free(bat->mib_time); - free(bat->mib_units); + E_FREE(bat->mib_state); + E_FREE(bat->mib_time); + E_FREE(bat->mib_units); #endif - free(bat->mib); - free(bat); + E_FREE(bat->mib); + E_FREE(bat); } } static Eina_Bool -_battery_sysctl_battery_update_poll(void *data) +_battery_sysctl_battery_update_poll(void *data EINA_UNUSED) { _battery_sysctl_battery_update(); return EINA_TRUE; @@ -201,7 +201,7 @@ } /* This is a workaround because there's an ACPI bug */ - if (charge == 0 || bat->last_full_charge == 0) + if ((EINA_FLT_EQ(charge, 0.0)) || (EINA_FLT_EQ(bat->last_full_charge, 0.0))) { /* last full capacity */ bat->mib[3] = 8; @@ -219,9 +219,11 @@ charge = (double)s.value; } } + + bat->got_prop = 1; _time = ecore_time_get(); - if ((bat->got_prop) && (charge != bat->current_charge)) + if ((bat->got_prop) && (!EINA_FLT_EQ(charge, bat->current_charge))) bat->charge_rate = ((charge - bat->current_charge) / (_time - bat->last_update)); bat->last_update = _time; bat->current_charge = charge; @@ -328,12 +330,13 @@ #endif } - if (bat) - { - if (bat->got_prop) - _battery_device_update(); - bat->got_prop = 1; - } + if (bat) + { + if (bat->got_prop) + _battery_device_update(); + bat->got_prop = 1; + } + return 1; } diff -Nru e20-201702271931/src/modules/clock/e_mod_main.c e20-201702281931/src/modules/clock/e_mod_main.c --- e20-201702271931/src/modules/clock/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/clock/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -540,7 +540,7 @@ t_tomorrow = mktime(&today) + 24 * 60 * 60; if (update_today) ecore_timer_interval_set(update_today, t_tomorrow - t); - else update_today = ecore_timer_add(t_tomorrow - t, _update_today_timer, NULL); + else update_today = ecore_timer_loop_add(t_tomorrow - t, _update_today_timer, NULL); return EINA_TRUE; } diff -Nru e20-201702271931/src/modules/conf/e_mod_main.c e20-201702281931/src/modules/conf/e_mod_main.c --- e20-201702271931/src/modules/conf/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -373,7 +373,7 @@ if (obj->type == E_COMP_TYPE) zone = e_zone_current_get(); else if (obj->type == E_ZONE_TYPE) - zone = ((E_Zone *)obj); + zone = (void *)obj; else zone = e_zone_current_get(); } diff -Nru e20-201702271931/src/modules/conf_applications/e_int_config_apps.c e20-201702281931/src/modules/conf_applications/e_int_config_apps.c --- e20-201702271931/src/modules/conf_applications/e_int_config_apps.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_applications/e_int_config_apps.c 2017-02-28 19:31:37.000000000 +0000 @@ -217,9 +217,9 @@ _cache_update() { if (cache_timer) - ecore_timer_reset(cache_timer); + ecore_timer_loop_reset(cache_timer); else - cache_timer = ecore_timer_add(1.0, _cache_update_timer, NULL); + cache_timer = ecore_timer_loop_add(1.0, _cache_update_timer, NULL); return ECORE_CALLBACK_RENEW; } @@ -363,7 +363,7 @@ e_widget_toolbook_page_show(otb, 0); if (cfdata->fill_delay) ecore_timer_del(cfdata->fill_delay); - cfdata->fill_delay = ecore_timer_add(0.2, _cb_fill_delay, cfdata); + cfdata->fill_delay = ecore_timer_loop_add(0.2, _cb_fill_delay, cfdata); elm_win_center(cfd->dia->win, 1, 1); return otb; diff -Nru e20-201702271931/src/modules/conf_display/e_int_config_desk.c e20-201702281931/src/modules/conf_display/e_int_config_desk.c --- e20-201702271931/src/modules/conf_display/e_int_config_desk.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_display/e_int_config_desk.c 2017-02-28 19:31:37.000000000 +0000 @@ -77,7 +77,7 @@ } if (!ok) { - snprintf(name, sizeof(name), "%s: %d,%d", _(e_config->desktop_default_name), cfdata->desk_x, cfdata->desk_y); + snprintf(name, sizeof(name), "%d,%d", cfdata->desk_x, cfdata->desk_y); cfdata->name = strdup(name); } } @@ -110,8 +110,7 @@ if ((!cfdata->name) || (!cfdata->name[0])) { - snprintf(name, sizeof(name), "%s: %d,%d", _(e_config->desktop_default_name), - cfdata->desk_x, cfdata->desk_y); + snprintf(name, sizeof(name), "%d,%d", cfdata->desk_x, cfdata->desk_y); free(cfdata->name); cfdata->name = strdup(name); } diff -Nru e20-201702271931/src/modules/conf_display/e_int_config_desklock.c e20-201702281931/src/modules/conf_display/e_int_config_desklock.c --- e20-201702271931/src/modules/conf_display/e_int_config_desklock.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_display/e_int_config_desklock.c 2017-02-28 19:31:37.000000000 +0000 @@ -279,11 +279,8 @@ e_widget_disabled_set(cfdata->lock_cmd_entry, (cfdata->desklock_auth_method != E_DESKLOCK_AUTH_METHOD_EXTERNAL)); - if (E_EFL_VERSION_MINIMUM(1, 17, 99)) - { - e_widget_list_object_append(ol, of, 1, 1, 0.5); - ow = e_widget_button_add(evas, _("Configure Lockscreen Gadgets"), "configure", _cb_lockscreen_gadgets, NULL, NULL); - } + e_widget_list_object_append(ol, of, 1, 1, 0.5); + ow = e_widget_button_add(evas, _("Configure Lockscreen Gadgets"), "configure", _cb_lockscreen_gadgets, NULL, NULL); e_widget_list_object_append(ol, ow, 1, 1, 0.5); e_widget_toolbook_page_append(otb, NULL, _("Locking"), ol, diff -Nru e20-201702271931/src/modules/conf_theme/e_int_config_fonts.c e20-201702281931/src/modules/conf_theme/e_int_config_fonts.c --- e20-201702271931/src/modules/conf_theme/e_int_config_fonts.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_theme/e_int_config_fonts.c 2017-02-28 19:31:37.000000000 +0000 @@ -50,7 +50,7 @@ const char *font; const char *style; Evas_Font_Size size; - unsigned char enabled; + int enabled; }; const E_Text_Class_Pair text_class_predefined_names[] = { @@ -815,7 +815,7 @@ } tc = e_widget_ilist_selected_data_get(cfdata->gui.class_list); if (!tc) return; - e_widget_check_valptr_set(cfdata->gui.enabled, (int*)&tc->enabled); + e_widget_check_valptr_set(cfdata->gui.enabled, &tc->enabled); cfdata->cur_class = tc; diff -Nru e20-201702271931/src/modules/conf_theme/e_int_config_theme.c e20-201702281931/src/modules/conf_theme/e_int_config_theme.c --- e20-201702271931/src/modules/conf_theme/e_int_config_theme.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_theme/e_int_config_theme.c 2017-02-28 19:31:37.000000000 +0000 @@ -761,6 +761,8 @@ file = ecore_file_file_get(cfdata->theme); name = ecore_file_strip_ext(file); + if (!!e_config->show_splash != !!cfdata->show_splash) + e_config_save_queue(); e_config->show_splash = cfdata->show_splash; if (name) { diff -Nru e20-201702271931/src/modules/conf_theme/e_int_config_xsettings.c e20-201702281931/src/modules/conf_theme/e_int_config_xsettings.c --- e20-201702271931/src/modules/conf_theme/e_int_config_xsettings.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_theme/e_int_config_xsettings.c 2017-02-28 19:31:37.000000000 +0000 @@ -159,7 +159,6 @@ e_config->xsettings.match_e17_icon_theme = cfdata->match_e17_icon_theme; e_config_save_queue(); -#ifdef EFL_VERSION_1_18 if (cfdata->match_e17_icon_theme && strcmp(e_config->icon_theme, elm_config_icon_theme_get())) { @@ -167,7 +166,6 @@ elm_config_all_flush(); elm_config_save(); } -#endif e_util_env_set("E_ICON_THEME", e_config->icon_theme); ev = E_NEW(E_Event_Config_Icon_Theme, 1); diff -Nru e20-201702271931/src/modules/conf_window_remembers/e_int_config_remembers.c e20-201702281931/src/modules/conf_window_remembers/e_int_config_remembers.c --- e20-201702271931/src/modules/conf_window_remembers/e_int_config_remembers.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/conf_window_remembers/e_int_config_remembers.c 2017-02-28 19:31:37.000000000 +0000 @@ -224,6 +224,7 @@ if ((rem->name) && (!strcmp(rem->name, "E"))) continue; /* Filter out the module config remembers */ if ((rem->class) && (rem->class[0] == '_')) continue; + if (rem->apply & E_REMEMBER_APPLY_UUID) continue; if (rem->name) e_widget_ilist_append(cfdata->list, NULL, rem->name, NULL, rem, NULL); diff -Nru e20-201702271931/src/modules/cpufreq/e_mod_main.c e20-201702281931/src/modules/cpufreq/e_mod_main.c --- e20-201702271931/src/modules/cpufreq/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/cpufreq/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -6,7 +6,7 @@ * in s->frequencies instead of available frequencies. */ -#if defined (__FreeBSD__) || defined (__OpenBSD__) +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined (__OpenBSD__) # include #endif @@ -96,6 +96,7 @@ _button_cb_mouse_down, inst); cpufreq_config->instances = eina_list_append(cpufreq_config->instances, inst); + _cpufreq_face_update_available(inst); cpufreq_config->handler = @@ -488,6 +489,9 @@ { char buf[4096]; int ret; + struct stat st; + + if (stat(cpufreq_config->set_exe_path, &st) < 0) return; snprintf(buf, sizeof(buf), "%s %s %s", cpufreq_config->set_exe_path, "governor", governor); @@ -515,7 +519,7 @@ char buf[4096]; int ret; -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) frequency /= 1000; #endif if (!cpufreq_config->status->can_set_frequency) @@ -564,12 +568,14 @@ void _cpufreq_set_pstate(int min, int max) { +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) + (void) min; + (void) max; +#else char buf[4096]; - int ret; - snprintf(buf, sizeof(buf), "%s %s %i %i %i", cpufreq_config->set_exe_path, "pstate", min, max, cpufreq_config->status->pstate_turbo); - ret = system(buf); + int ret = system(buf); if (ret != 0) { E_Dialog *dia; @@ -585,6 +591,7 @@ elm_win_center(dia->win, 1, 1); e_dialog_show(dia); } +#endif } static Cpu_Status * @@ -631,9 +638,11 @@ static void _cpufreq_status_check_available(Cpu_Status *s) { + // FIXME: this assumes all cores accept the same freqs/ might be wrong +#if !defined(__OpenBSD__) char buf[4096]; Eina_List *l; - // FIXME: this assumes all cores accept the same freqs/ might be wrong +#endif #if defined (__OpenBSD__) int p; @@ -646,14 +655,14 @@ /* storing percents */ p = 100; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); p = 75; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); p = 50; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); p = 25; - s->frequencies = eina_list_append(s->frequencies, (void *)p); -#elif defined (__FreeBSD__) + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); +#elif defined (__FreeBSD__) || defined(__DragonFly__) int freq; size_t len = sizeof(buf); char *pos, *q; @@ -847,7 +856,7 @@ s->can_set_frequency = 1; s->cur_governor = NULL; -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD__) || defined(__DragonFly__) size_t len = sizeof(frequency); s->active = 0; @@ -1019,6 +1028,10 @@ edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_STRING_SET, 2, governor_msg); free(governor_msg); } +#if defined(__OpenBSD__) + _cpufreq_face_update_current(inst); +#endif + } static void @@ -1465,7 +1478,6 @@ cpufreq_config->module = m; e_gadcon_provider_register(&_gadcon_class); - snprintf(buf, sizeof(buf), "%s/e-module-cpufreq.edj", e_module_dir_get(m)); e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "preferences-advanced"); diff -Nru e20-201702271931/src/modules/everything/e_mod_main.c e20-201702281931/src/modules/everything/e_mod_main.c --- e20-201702271931/src/modules/everything/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/everything/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -142,7 +142,7 @@ e_module_delayed_set(m, 1); /* cleanup every hour :) */ - cleanup_timer = ecore_timer_add(3600, _cleanup_history, NULL); + cleanup_timer = ecore_timer_loop_add(3600, _cleanup_history, NULL); return m; } diff -Nru e20-201702271931/src/modules/everything/evry.c e20-201702281931/src/modules/everything/evry.c --- e20-201702271931/src/modules/everything/evry.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/everything/evry.c 2017-02-28 19:31:37.000000000 +0000 @@ -177,7 +177,7 @@ if (win->delay_hide_action) ecore_timer_del(win->delay_hide_action); - win->delay_hide_action = ecore_timer_add(0.0, _evry_focus_out_timer, win); + win->delay_hide_action = ecore_timer_loop_add(0.0, _evry_focus_out_timer, win); } static void @@ -301,7 +301,7 @@ win->func.hide = &_evry_hide_func; - win->delay_hide_action = ecore_timer_add(0.2, _evry_delay_hide_timer, win); + win->delay_hide_action = ecore_timer_loop_add(0.2, _evry_delay_hide_timer, win); return win; } @@ -606,7 +606,7 @@ ecore_timer_del(sel->action_timer); _evry_selector_item_clear(sel); - sel->action_timer = ecore_timer_add(0.2, _evry_timer_cb_actions_get, sel); + sel->action_timer = ecore_timer_loop_add(0.2, _evry_timer_cb_actions_get, sel); } void @@ -2314,7 +2314,7 @@ ecore_timer_del(sel->update_timer); sel->update_timer = - ecore_timer_add(MATCH_LAG, _evry_cb_update_timer, sel); + ecore_timer_loop_add(MATCH_LAG, _evry_cb_update_timer, sel); edje_object_signal_emit(win->o_main, "list:e,signal,update", "e"); } @@ -2668,7 +2668,7 @@ edje_object_signal_emit(v->o_list, "e,action,hide,list", "e"); /* FIXME get signal from theme when anim finished */ - v->state->clear_timer = ecore_timer_add(1.5, _clear_timer, win); + v->state->clear_timer = ecore_timer_loop_add(1.5, _clear_timer, win); if (v->o_bar) { diff -Nru e20-201702271931/src/modules/everything/evry_util.c e20-201702281931/src/modules/everything/evry_util.c --- e20-201702271931/src/modules/everything/evry_util.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/everything/evry_util.c 2017-02-28 19:31:37.000000000 +0000 @@ -199,11 +199,19 @@ { ii = 0; /* go to next word */ - for (; (p[0] && (s_len - (p - str) >= ii)) && !((isspace(*p) || (ip && ispunct(*p)))); p += ii) - if (!eina_unicode_utf8_next_get(p, &ii)) break; + for (; (p[0] && (s_len - (p - str) >= (unsigned int)ii)) && + !((isspace(*p) || (ip && ispunct(*p)))); + p += ii) + { + if (!eina_unicode_utf8_next_get(p, &ii)) break; + } ii = 0; - for (; (p[0] && (s_len - (p - str) >= ii)) && ((isspace(*p) || (ip && ispunct(*p)))); p += ii) - if (!eina_unicode_utf8_next_get(p, &ii)) break; + for (; (p[0] && (s_len - (p - str) >= (unsigned int)ii)) && + ((isspace(*p) || (ip && ispunct(*p)))); + p += ii) + { + if (!eina_unicode_utf8_next_get(p, &ii)) break; + } cnt++; next = p; m_cnt = 0; diff -Nru e20-201702271931/src/modules/everything/evry_view_tabs.c e20-201702281931/src/modules/everything/evry_view_tabs.c --- e20-201702271931/src/modules/everything/evry_view_tabs.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/everything/evry_view_tabs.c 2017-02-28 19:31:37.000000000 +0000 @@ -125,7 +125,7 @@ if (!w && !v->timer) { - v->timer = ecore_timer_add(0.001, _timer_cb, v); + v->timer = ecore_timer_loop_add(0.001, _timer_cb, v); return; } diff -Nru e20-201702271931/src/modules/everything/md5.c e20-201702281931/src/modules/everything/md5.c --- e20-201702271931/src/modules/everything/md5.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/everything/md5.c 2017-02-28 19:31:37.000000000 +0000 @@ -82,8 +82,9 @@ if (t) { - unsigned char *p = (unsigned char *)ctx->in + t; + unsigned char *p = (void *)ctx->in; + p += t; t = 64 - t; if (len < t) { @@ -91,8 +92,8 @@ return; } memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *)ctx->in); + byteReverse((void *)ctx->in, 16); + MD5Transform(ctx->buf, ctx->in); buf += t; len -= t; } @@ -100,8 +101,8 @@ while (len >= 64) { memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *)ctx->in); + byteReverse((void *)ctx->in, 16); + MD5Transform(ctx->buf, ctx->in); buf += 64; len -= 64; } @@ -126,7 +127,8 @@ /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ - p = ctx->in + count; + p = (void *)ctx->in; + p += count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ @@ -137,8 +139,8 @@ { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *)ctx->in); + byteReverse((void *)ctx->in, 16); + MD5Transform(ctx->buf, ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); @@ -147,13 +149,14 @@ /* Pad block to 56 bytes */ memset(p, 0, count - 8); } - byteReverse(ctx->in, 14); + byteReverse((void *)ctx->in, 14); /* Append length in bits and transform */ - ctx->in[14] = ctx->bits[0]; - ctx->in[15] = ctx->bits[1]; + p = (void *)ctx->in; + p[14] = ctx->bits[0]; + p[15] = ctx->bits[1]; - MD5Transform(ctx->buf, (uint32_t *)ctx->in); + MD5Transform(ctx->buf, ctx->in); byteReverse((unsigned char *)ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset((char *)ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ diff -Nru e20-201702271931/src/modules/everything/md5.h e20-201702281931/src/modules/everything/md5.h --- e20-201702271931/src/modules/everything/md5.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/everything/md5.h 2017-02-28 19:31:37.000000000 +0000 @@ -9,7 +9,7 @@ typedef struct MD5Context { uint32_t buf[4]; uint32_t bits[2]; - unsigned char in[64]; + uint32_t in[16]; } MD5_CTX; extern void MD5Init(MD5_CTX *context); diff -Nru e20-201702271931/src/modules/fileman/e_fwin.c e20-201702281931/src/modules/fileman/e_fwin.c --- e20-201702271931/src/modules/fileman/e_fwin.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/fileman/e_fwin.c 2017-02-28 19:31:37.000000000 +0000 @@ -361,9 +361,9 @@ { drag_fwin = fwin; if (fwin->spring_timer) - ecore_timer_reset(fwin->spring_timer); + ecore_timer_loop_reset(fwin->spring_timer); else - fwin->spring_timer = ecore_timer_add(fileman_config->view.spring_delay, (Ecore_Task_Cb)_e_fwin_spring_cb, fwin); + fwin->spring_timer = ecore_timer_loop_add(fileman_config->view.spring_delay, (Ecore_Task_Cb)_e_fwin_spring_cb, fwin); } static void @@ -393,7 +393,7 @@ if (fwin->spring_parent && (!fwin->spring_child)) { if (!fwin->spring_close_timer) - fwin->spring_close_timer = ecore_timer_add(0.01, (Ecore_Task_Cb)_e_fwin_dnd_close_cb, fwin); + fwin->spring_close_timer = ecore_timer_loop_add(0.01, (Ecore_Task_Cb)_e_fwin_dnd_close_cb, fwin); } drag_fwin = NULL; } @@ -963,7 +963,7 @@ if (fwin->popup_timer) ecore_timer_del(fwin->popup_timer); fwin->popup_timer = NULL; if (!fileman_config->tooltip.enable) return; - fwin->popup_timer = ecore_timer_add(fileman_config->tooltip.delay, _e_fwin_icon_popup, fwin); + fwin->popup_timer = ecore_timer_loop_add(fileman_config->tooltip.delay, _e_fwin_icon_popup, fwin); if (fwin->over_file) eina_stringshare_del(fwin->over_file); fwin->over_file = NULL; if (ici->file) fwin->over_file = eina_stringshare_add(ici->file); @@ -3133,7 +3133,7 @@ _e_fwin_op_registry_free_data(void *data) { Ecore_Timer *t; - t = ecore_timer_add(5.0, _e_fwin_op_registry_free_data_delayed, data); + t = ecore_timer_loop_add(5.0, _e_fwin_op_registry_free_data_delayed, data); evas_object_data_set(data, "_e_fwin_op_registry_thingy", t); evas_object_event_callback_add(data, EVAS_CALLBACK_FREE, _e_fwin_op_registry_free_check, data); } diff -Nru e20-201702271931/src/modules/fileman/e_mod_config.c e20-201702281931/src/modules/fileman/e_mod_config.c --- e20-201702271931/src/modules/fileman/e_mod_config.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/fileman/e_mod_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -6,7 +6,7 @@ /* general view mode */ struct { - E_Fm2_View_Mode mode; + int mode; int open_dirs_in_place; int selector; int single_click; @@ -27,8 +27,8 @@ { double delay; double size; - Eina_Bool enable; - Eina_Bool clamp_size; + int enable; + int clamp_size; Evas_Object *check_clamp_size; Evas_Object *delay_slider_text; Evas_Object *delay_slider; @@ -234,7 +234,7 @@ E_Config_Dialog_Data *cfdata) { return - (fileman_config->view.mode != cfdata->view.mode) || + ((int)fileman_config->view.mode != cfdata->view.mode) || (fileman_config->view.open_dirs_in_place != cfdata->view.open_dirs_in_place) || (fileman_config->view.single_click != cfdata->view.single_click) || (e_config->filemanager_copy != cfdata->copy) || @@ -310,7 +310,7 @@ o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("View Mode"), 0); - rg = e_widget_radio_group_new((int*)&(cfdata->view.mode)); + rg = e_widget_radio_group_new(&cfdata->view.mode); /* ob = e_widget_radio_add(evas, _("Icons"), 0, rg); */ /* e_widget_disabled_set(ob, 1); */ /* e_widget_framelist_object_append(of, ob); */ @@ -464,11 +464,11 @@ ///////////////////////////////////////////////////////////// o = e_widget_list_add(evas, 1, 0); ob = e_widget_check_add(evas, _("Show tooltip"), - (int*)&(cfdata->tooltip.enable)); + &cfdata->tooltip.enable); e_widget_on_change_hook_set(ob, _tooltip_changed, cfdata); e_widget_list_object_append(o, ob, 1, 1, 0.5); cfdata->tooltip.check_clamp_size = ob = e_widget_check_add(evas, _("Clamp video size"), - (int*)&(cfdata->tooltip.clamp_size)); + &cfdata->tooltip.clamp_size); e_widget_list_object_append(o, ob, 1, 1, 0.5); cfdata->tooltip.delay_slider_text = ob = e_widget_label_add(evas, _("Tooltip delay")); e_widget_list_object_append(o, ob, 1, 1, 0.5); diff -Nru e20-201702271931/src/modules/fileman_opinfo/e_mod_main.c e20-201702281931/src/modules/fileman_opinfo/e_mod_main.c --- e20-201702271931/src/modules/fileman_opinfo/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/fileman_opinfo/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -221,7 +221,7 @@ static void _opinfo_op_registry_free_data(void *data) { - ecore_timer_add(5.0, _opinfo_op_registry_free_data_delayed, data); + ecore_timer_loop_add(5.0, _opinfo_op_registry_free_data_delayed, data); } static Eina_Bool diff -Nru e20-201702271931/src/modules/ibar/e_mod_main.c e20-201702281931/src/modules/ibar/e_mod_main.c --- e20-201702271931/src/modules/ibar/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/ibar/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -863,9 +863,9 @@ evas_object_event_callback_del(obj, EVAS_CALLBACK_HIDE, _ibar_cb_icon_menu_client_menu_del); if (!b->menu_icon) return; if (b->menu_icon->hide_timer) - ecore_timer_reset(b->menu_icon->hide_timer); + ecore_timer_loop_reset(b->menu_icon->hide_timer); else - b->menu_icon->hide_timer = ecore_timer_add(0.5, _ibar_cb_out_hide_delay, b->menu_icon); + b->menu_icon->hide_timer = ecore_timer_loop_add(0.5, _ibar_cb_out_hide_delay, b->menu_icon); } static void @@ -1097,7 +1097,7 @@ } static void -_ibar_cb_icon_menu_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +_ibar_cb_icon_menu_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info) { IBar_Icon *ic; E_Client *ec = data; @@ -1231,9 +1231,9 @@ if (e_comp_util_mouse_grabbed()) return; if (ic->hide_timer) - ecore_timer_reset(ic->hide_timer); + ecore_timer_loop_reset(ic->hide_timer); else - ic->hide_timer = ecore_timer_add(0.5, _ibar_cb_out_hide_delay, ic); + ic->hide_timer = ecore_timer_loop_add(0.5, _ibar_cb_out_hide_delay, ic); } static void @@ -1515,9 +1515,9 @@ if (!ic->ibar->inst->ci->dont_icon_menu_mouseover) { if (ic->show_timer) - ecore_timer_reset(ic->show_timer); + ecore_timer_loop_reset(ic->show_timer); else - ic->show_timer = ecore_timer_add(0.2, _ibar_icon_mouse_in_timer, ic); + ic->show_timer = ecore_timer_loop_add(0.2, _ibar_icon_mouse_in_timer, ic); } } @@ -1546,9 +1546,9 @@ if (!ic->ibar->inst->ci->dont_icon_menu_mouseover) { if (ic->hide_timer) - ecore_timer_reset(ic->hide_timer); + ecore_timer_loop_reset(ic->hide_timer); else - ic->hide_timer = ecore_timer_add(0.75, _ibar_cb_out_hide_delay, ic); + ic->hide_timer = ecore_timer_loop_add(0.75, _ibar_cb_out_hide_delay, ic); } } @@ -1578,7 +1578,7 @@ ic->drag.dnd = 0; ic->mouse_down = 1; if (!ic->timer) - ic->timer = ecore_timer_add(0.35, _ibar_cb_icon_menu_cb, ic); + ic->timer = ecore_timer_loop_add(0.35, _ibar_cb_icon_menu_cb, ic); } else if (ev->button == 2) { @@ -1846,7 +1846,7 @@ } _ibar_icon_signal_emit(ic, "e,action,exec", "e"); if (keep_going) - ic->reset_timer = ecore_timer_add(1.0, _ibar_cb_icon_reset, ic); + ic->reset_timer = ecore_timer_loop_add(1.0, _ibar_cb_icon_reset, ic); } static void diff -Nru e20-201702271931/src/modules/luncher/bar.c e20-201702281931/src/modules/luncher/bar.c --- e20-201702271931/src/modules/luncher/bar.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/luncher/bar.c 2017-02-28 19:31:37.000000000 +0000 @@ -20,6 +20,29 @@ } static Eina_Bool +_bar_check_for_iconic(Icon *ic) +{ + Eina_List *l, *ll, *clients = NULL; + E_Client *ec; + E_Exec_Instance *ex; + + EINA_LIST_FOREACH(ic->execs, l, ex) + { + EINA_LIST_FOREACH(ex->clients, ll, ec) + clients = eina_list_append(clients, ec); + } + EINA_LIST_FOREACH(ic->clients, l, ec) + clients = eina_list_append(clients, ec); + + EINA_LIST_FREE(clients, ec) + { + if (ec->iconic) + return EINA_TRUE; + } + return EINA_FALSE; +} + +static Eina_Bool _bar_check_for_duplicates(Icon *ic, E_Client *dupe) { Eina_List *l, *ll, *clients = NULL; @@ -37,7 +60,10 @@ EINA_LIST_FREE(clients, ec) { if (ec == dupe) - return EINA_TRUE; + { + eina_list_free(clients); + return EINA_TRUE; + } } return EINA_FALSE; } @@ -61,7 +87,8 @@ return config_luncher(e_zone_current_get(), inst, EINA_TRUE); } -static void _bar_popup_dismissed(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static void +_bar_popup_dismissed(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { E_FREE_FUNC(obj, evas_object_del); } @@ -179,7 +206,7 @@ if (has_desktop) { ic = eina_hash_find(inst->icons_desktop_hash, ec->exe_inst->desktop->orig_path); - if ((ic) && (ic2 = eina_hash_find(inst->icons_clients_hash, ec))) + if ((ic) && (ic2 = eina_hash_find(inst->icons_clients_hash, &ec))) { ic2->execs = eina_list_remove(ic2->execs, ec->exe_inst); ic2->clients = eina_list_remove(ic2->clients, ec); @@ -194,9 +221,9 @@ } } if (has_desktop && !ic) - ic = eina_hash_find(inst->icons_clients_hash, ec); + ic = eina_hash_find(inst->icons_clients_hash, &ec); if (!ic) - ic = eina_hash_find(inst->icons_clients_hash, ec); + ic = eina_hash_find(inst->icons_clients_hash, &ec); return ic; } @@ -220,6 +247,10 @@ if (!eina_list_data_find(ic->execs, ex)) ic->execs = eina_list_append(ic->execs, ex); break; + case E_EXEC_WATCH_TIMEOUT: + case E_EXEC_WATCH_STOPPED: + ic->exec = NULL; + break; default: break; } @@ -376,7 +407,7 @@ { path = icon; } - if (!path) + if (!path && icon) { snprintf(buf, sizeof(buf), "e/icons/%s", icon); if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) @@ -390,6 +421,11 @@ k = "e/icons/unknown"; } } + else if (!path && !icon) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } if (path && icon) { len = strlen(icon); @@ -422,9 +458,11 @@ { Icon *ic = data; + if (!ic) return EINA_FALSE; + ic->mouse_out_timer = NULL; - if (!ic->preview) + if (!ic->preview || ic->preview_dismissed) return EINA_FALSE; E_FREE_FUNC(ic->preview_box, evas_object_del); @@ -509,7 +547,7 @@ ic->drag.x = ev->output.x; ic->drag.y = ev->output.y; E_FREE_FUNC(ic->drag_timer, ecore_timer_del); - ic->drag_timer = ecore_timer_add(.35, _bar_drag_timer, ic); + ic->drag_timer = ecore_timer_loop_add(.35, _bar_drag_timer, ic); } if (ev->button == 3) { @@ -666,7 +704,7 @@ if (current_preview_menu) return; E_FREE_FUNC(ic->mouse_out_timer, ecore_timer_del); - ic->mouse_out_timer = ecore_timer_add(0.25, _bar_icon_preview_hide, ic); + ic->mouse_out_timer = ecore_timer_loop_add(0.25, _bar_icon_preview_hide, ic); } static void @@ -887,8 +925,10 @@ clients = EINA_TRUE; if (clients && current_preview && !current_preview_menu) _bar_icon_preview_show(ic); + else if (_bar_check_for_iconic(ic)) + _bar_icon_preview_show(ic); else if (clients && !current_preview) - ic->mouse_in_timer = ecore_timer_add(0.3, _bar_icon_preview_show, ic); + ic->mouse_in_timer = ecore_timer_loop_add(0.3, _bar_icon_preview_show, ic); } static void @@ -899,7 +939,7 @@ elm_object_tooltip_hide(obj); E_FREE_FUNC(ic->mouse_in_timer, ecore_timer_del); E_FREE_FUNC(ic->mouse_out_timer, ecore_timer_del); - ic->mouse_out_timer = ecore_timer_add(0.25, _bar_icon_preview_hide, ic); + ic->mouse_out_timer = ecore_timer_loop_add(0.25, _bar_icon_preview_hide, ic); } static void @@ -914,6 +954,110 @@ } static void +_bar_icon_file_set(Icon *ic, Efreet_Desktop *desktop, E_Client *non_desktop_client) +{ + const char *path = NULL, *k = NULL; + char buf[4096]; + int len = 0; + if (desktop) + { + if (!desktop->icon) + path = NULL; + else if (strncmp(desktop->icon, "/", 1) && !ecore_file_exists(desktop->icon)) + { + path = efreet_icon_path_find(e_config->icon_theme, desktop->icon, ic->inst->size); + if (!path) + { + if (e_util_strcmp(e_config->icon_theme, "hicolor")) + path = efreet_icon_path_find("hicolor", desktop->icon, ic->inst->size); + } + } + else if (ecore_file_exists(desktop->icon)) + { + path = desktop->icon; + } + if (!path && desktop->icon) + { + snprintf(buf, sizeof(buf), "e/icons/%s", desktop->icon); + if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) + { + path = e_theme_edje_file_get("base/theme/icons", buf); + k = buf; + } + else + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + } + else if (!path && !desktop->icon) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + if (path && desktop->icon && !k) + { + len = strlen(desktop->icon); + if ((len > 4) && (!strcasecmp(desktop->icon + len - 4, ".edj"))) + k = "icon"; + } + } + else if (non_desktop_client) + { + Evas_Object *tmp; + const char *file, *group; + Eina_Bool ret = EINA_FALSE; + + tmp = e_client_icon_add(non_desktop_client, evas_object_evas_get(ic->o_layout)); + if (isedje(tmp)) + { + edje_object_file_get(tmp, &file, &group); + if (file && group) + ret = EINA_TRUE; + } + else + ret = e_icon_file_get(tmp, &file, &group); + if (ret) + { + eina_stringshare_replace(&ic->icon, file); + eina_stringshare_replace(&ic->key, group); + path = ic->icon; + k = ic->key; + } + evas_object_del(tmp); + } + else if (ic->icon) + { + if (strncmp(ic->icon, "/", 1) && !ecore_file_exists(ic->icon)) + { + path = efreet_icon_path_find(e_config->icon_theme, ic->icon, ic->inst->size); + if (!path) + { + if (e_util_strcmp(e_config->icon_theme, "hicolor")) + path = efreet_icon_path_find("hicolor", ic->icon, ic->inst->size); + } + } + else if (ecore_file_exists(ic->icon)) + { + path = ic->icon; + k = ic->key; + } + if (!path) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + } + else + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + elm_image_file_set(ic->o_icon, path, k); + elm_image_file_set(ic->o_overlay, path, k); +} + +static void _bar_icon_resized(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { //This code is supposed to adjust aspect correctly when there is an effect happening. Uncomment to test. @@ -950,9 +1094,7 @@ static Icon * _bar_icon_add(Instance *inst, Efreet_Desktop *desktop, E_Client *non_desktop_client) { - const char *path = NULL, *k = NULL; - char buf[4096], ori[32]; - int len = 0; + char ori[32]; Icon *ic; const Eina_List *l; Edje_Message_String *msg; @@ -995,58 +1137,7 @@ ic->o_overlay = elm_icon_add(ic->o_layout); E_EXPAND(ic->o_overlay); - if (desktop) - { - if (!desktop->icon) - path = NULL; - else if (strncmp(desktop->icon, "/", 1) && !ecore_file_exists(desktop->icon)) - { - path = efreet_icon_path_find(e_config->icon_theme, desktop->icon, inst->size); - if (!path) - { - if (e_util_strcmp(e_config->icon_theme, "hicolor")) - path = efreet_icon_path_find("hicolor", desktop->icon, inst->size); - } - } - else if (ecore_file_exists(desktop->icon)) - { - path = desktop->icon; - } - if (!path) - { - snprintf(buf, sizeof(buf), "e/icons/%s", desktop->icon); - printf("%s\n", buf); - if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) - { - path = e_theme_edje_file_get("base/theme/icons", buf); - k = buf; - } - else - { - path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); - k = "e/icons/unknown"; - } - } - if (path && desktop->icon && !k) - { - len = strlen(desktop->icon); - if ((len > 4) && (!strcasecmp(desktop->icon + len - 4, ".edj"))) - k = "icon"; - } - } - else if (non_desktop_client) - { - Evas_Object *tmp; - const char *file, *group; - tmp = e_client_icon_add(non_desktop_client, evas_object_evas_get(ic->o_layout)); - e_icon_file_get(tmp, &file, &group); - eina_stringshare_replace(&ic->icon, file); - eina_stringshare_replace(&ic->key, group); - path = ic->icon; - k = ic->key; - evas_object_del(tmp); - } - elm_image_file_set(ic->o_icon, path, k); + _bar_icon_file_set(ic, desktop, non_desktop_client); if (desktop) elm_object_tooltip_text_set(ic->o_icon, desktop->name); @@ -1077,7 +1168,6 @@ _bar_icon_mouse_out, ic); evas_object_show(ic->o_icon); - elm_image_file_set(ic->o_overlay, path, k); evas_object_size_hint_aspect_set(ic->o_overlay, EVAS_ASPECT_CONTROL_BOTH, 1, 1); elm_layout_content_set(ic->o_layout, "e.swallow.overlay", ic->o_overlay); evas_object_show(ic->o_overlay); @@ -1085,7 +1175,7 @@ if (desktop) eina_hash_add(inst->icons_desktop_hash, eina_stringshare_add(desktop->orig_path), ic); else - eina_hash_add(inst->icons_clients_hash, non_desktop_client, ic); + eina_hash_add(inst->icons_clients_hash, &non_desktop_client, ic); if (desktop) { @@ -1132,9 +1222,15 @@ { snprintf(ori, sizeof(ori), "e,state,off,%s", _bar_location_get(inst)); elm_layout_signal_emit(ic->o_layout, ori, "e"); + if (ic->preview) + _bar_icon_preview_hide(ic); if (!ic->in_order) _bar_icon_del(inst, ic); } + else if (ic->preview && (current_preview == ic->preview)) + { + _bar_icon_preview_show(ic); + } } } return ECORE_CALLBACK_RENEW; @@ -1175,9 +1271,15 @@ { snprintf(ori, sizeof(ori), "e,state,off,%s", _bar_location_get(inst)); elm_layout_signal_emit(ic->o_layout, ori, "e"); + if (ic->preview) + _bar_icon_preview_hide(ic); if (!ic->in_order) _bar_icon_del(inst, ic); } + else if (ic->preview && (current_preview == ic->preview)) + { + _bar_icon_preview_show(ic); + } } } return ECORE_CALLBACK_RENEW; @@ -1276,6 +1378,8 @@ ic->clients = eina_list_remove(ic->clients, ev->ec); if (!eina_list_count(ic->execs) && !eina_list_count(ic->clients)) { + if (ic->preview) + _bar_icon_preview_hide(ic); if (!ic->in_order) _bar_icon_del(inst, ic); else @@ -1284,6 +1388,10 @@ elm_layout_signal_emit(ic->o_layout, ori, "e"); } } + else if (ic->preview && (current_preview == ic->preview)) + { + _bar_icon_preview_show(ic); + } } } return ECORE_CALLBACK_RENEW; @@ -1371,13 +1479,9 @@ { if (inst->icons) { - Icon *ic; - Eina_List *l; - elm_box_clear(inst->o_icon_con); - EINA_LIST_FOREACH(inst->icons, l, ic) - _bar_icon_del(inst, ic); - eina_list_free(inst->icons); + while (inst->icons) + _bar_icon_del(inst, eina_list_data_get(inst->icons)); inst->icons = NULL; } } @@ -1414,7 +1518,7 @@ EINA_LIST_FOREACH(ex->clients, lll, ec) { - if (!ec->netwm.state.skip_taskbar && !ec->internal_elm_win) + if (!ec->netwm.state.skip_taskbar) { skip = EINA_FALSE; } @@ -1426,7 +1530,10 @@ ic->execs = eina_list_append(ic->execs, ex); continue; } - ic = _bar_icon_add(inst, ex->desktop, NULL); + if (!ec->internal_elm_win) + ic = _bar_icon_add(inst, ex->desktop, NULL); + else + ic = _bar_icon_add(inst, NULL, ec); snprintf(ori, sizeof(ori), "e,state,on,%s", _bar_location_get(inst)); elm_layout_signal_emit(ic->o_layout, ori, "e"); ic->in_order = EINA_FALSE; @@ -1483,80 +1590,7 @@ } inst->size = size; EINA_LIST_FOREACH(inst->icons, l, ic) - { - const char *path = NULL, *key = NULL; - int len = 0; - - if (ic->desktop) - { - if (!ic->desktop->icon) - path = NULL; - else if (strncmp(ic->desktop->icon, "/", 1) && !ecore_file_exists(ic->desktop->icon)) - { - path = efreet_icon_path_find(e_config->icon_theme, ic->desktop->icon, inst->size); - if (!path) - { - if (e_util_strcmp(e_config->icon_theme, "hicolor")) - path = efreet_icon_path_find("hicolor", ic->desktop->icon, inst->size); - } - } - else if (ecore_file_exists(ic->desktop->icon)) - { - path = ic->desktop->icon; - } - if (!path) - { - elm_image_file_set(ic->o_icon, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - elm_image_file_set(ic->o_overlay, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - } - if (path && ic->desktop->icon) - { - len = strlen(ic->desktop->icon); - if ((len > 4) && (!strcasecmp(ic->desktop->icon + len - 4, ".edj"))) - key = "icon"; - - elm_image_file_set(ic->o_icon, path, key); - elm_image_file_set(ic->o_overlay, path, key); - } - } - else if (ic->icon) - { - if (strncmp(ic->icon, "/", 1) && !ecore_file_exists(ic->icon)) - { - path = efreet_icon_path_find(e_config->icon_theme, ic->icon, inst->size); - if (!path) - { - if (e_util_strcmp(e_config->icon_theme, "hicolor")) - path = efreet_icon_path_find("hicolor", ic->icon, inst->size); - } - } - else if (ecore_file_exists(ic->icon)) - { - path = ic->icon; - } - if (!path) - { - elm_image_file_set(ic->o_icon, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - elm_image_file_set(ic->o_overlay, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - } - else - { - elm_image_file_set(ic->o_icon, path, ic->key); - elm_image_file_set(ic->o_overlay, path, ic->key); - } - } - else - { - elm_image_file_set(ic->o_icon, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - elm_image_file_set(ic->o_overlay, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - } - } + _bar_icon_file_set(ic, ic->desktop, NULL); inst->resize_job = NULL; } } @@ -1656,6 +1690,8 @@ e_object_del(E_OBJECT(inst->order)); E_FREE_FUNC(inst->drop_handler, evas_object_del); + eina_hash_free(inst->icons_desktop_hash); + eina_hash_free(inst->icons_clients_hash); luncher_instances = eina_list_remove(luncher_instances, inst); free(inst); } @@ -1768,8 +1804,6 @@ luncher_config->items = eina_list_remove(luncher_config->items, inst->cfg); eina_stringshare_del(inst->cfg->style); eina_stringshare_del(inst->cfg->dir); - eina_hash_free(inst->icons_desktop_hash); - eina_hash_free(inst->icons_clients_hash); E_FREE(inst->cfg); } @@ -1798,6 +1832,7 @@ ic = _bar_icon_match(inst, ec); if (!ic) return EINA_FALSE; + ec->layer_block = 1; evas_object_layer_set(ec->frame, E_LAYER_CLIENT_PRIO); evas_object_geometry_get(ic->o_layout, &ox, &oy, &ow, &oh); diff -Nru e20-201702271931/src/modules/luncher/config.c e20-201702281931/src/modules/luncher/config.c --- e20-201702271931/src/modules/luncher/config.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/luncher/config.c 2017-02-28 19:31:37.000000000 +0000 @@ -238,7 +238,7 @@ { path = icon; } - if (!path) + if (!path && icon) { snprintf(buf, sizeof(buf), "e/icons/%s", icon); if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) @@ -252,6 +252,11 @@ k = "e/icons/unknown"; } } + else if (!path && !icon) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } if (path && icon) { len = strlen(icon); diff -Nru e20-201702271931/src/modules/luncher/grid.c e20-201702281931/src/modules/luncher/grid.c --- e20-201702271931/src/modules/luncher/grid.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/luncher/grid.c 2017-02-28 19:31:37.000000000 +0000 @@ -154,7 +154,7 @@ ic->drag.x = ev->output.x; ic->drag.y = ev->output.y; E_FREE_FUNC(ic->drag_timer, ecore_timer_del); - ic->drag_timer = ecore_timer_add(.35, _grid_drag_timer, ic); + ic->drag_timer = ecore_timer_loop_add(.35, _grid_drag_timer, ic); } if (ev->button == 3) { @@ -240,11 +240,83 @@ return ic->o_layout; } -static Icon * -_grid_icon_add(Instance *inst, Efreet_Desktop *desktop) +static void +_grid_icon_file_set(Icon *ic, Efreet_Desktop *desktop) { const char *path = NULL, *k = NULL; char buf[4096]; + + if (desktop) + { + if (!desktop->icon) + path = NULL; + else if (strncmp(desktop->icon, "/", 1) && !ecore_file_exists(desktop->icon)) + { + path = efreet_icon_path_find(e_config->icon_theme, desktop->icon, ic->inst->size); + if (!path) + { + if (e_util_strcmp(e_config->icon_theme, "hicolor")) + path = efreet_icon_path_find("hicolor", desktop->icon, ic->inst->size); + } + } + else if (ecore_file_exists(desktop->icon)) + { + path = desktop->icon; + } + if (!path && desktop->icon) + { + snprintf(buf, sizeof(buf), "e/icons/%s", desktop->icon); + if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) + { + path = e_theme_edje_file_get("base/theme/icons", buf); + k = buf; + } + else + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + } + else if (!path && !desktop->icon) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + } + else if (ic->icon) + { + if (strncmp(ic->icon, "/", 1) && !ecore_file_exists(ic->icon)) + { + path = efreet_icon_path_find(e_config->icon_theme, ic->icon, ic->inst->size); + if (!path) + { + if (e_util_strcmp(e_config->icon_theme, "hicolor")) + path = efreet_icon_path_find("hicolor", ic->icon, ic->inst->size); + } + } + else if (ecore_file_exists(ic->icon)) + { + path = ic->icon; + k = ic->key; + } + if (!path) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + } + else + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + elm_image_file_set(ic->o_icon, path, k); + elm_image_file_set(ic->o_overlay, path, k); +} + +static Icon * +_grid_icon_add(Instance *inst, Efreet_Desktop *desktop) +{ Icon *ic; ic = E_NEW(Icon, 1); @@ -271,36 +343,8 @@ ic->o_overlay = elm_icon_add(ic->o_layout); E_EXPAND(ic->o_overlay); - if (!desktop->icon) - path = NULL; - else if (strncmp(desktop->icon, "/", 1) && !ecore_file_exists(desktop->icon)) - { - path = efreet_icon_path_find(e_config->icon_theme, desktop->icon, inst->size); - if (!path) - { - if (e_util_strcmp(e_config->icon_theme, "hicolor")) - path = efreet_icon_path_find("hicolor", desktop->icon, inst->size); - } - } - else if (ecore_file_exists(desktop->icon)) - { - path = desktop->icon; - } - if (!path) - { - snprintf(buf, sizeof(buf), "e/icons/%s", desktop->icon); - if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) - { - path = e_theme_edje_file_get("base/theme/icons", buf); - k = buf; - } - else - { - path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); - k = "e/icons/unknown"; - } - } - elm_image_file_set(ic->o_icon, path, k); + _grid_icon_file_set(ic, desktop); + elm_object_tooltip_text_set(ic->o_icon, desktop->name); elm_object_tooltip_orient_set(ic->o_icon, ELM_TOOLTIP_ORIENT_CENTER); elm_object_tooltip_style_set(ic->o_icon, "luncher"); @@ -318,7 +362,6 @@ _grid_icon_mouse_out, ic); evas_object_show(ic->o_icon); - elm_image_file_set(ic->o_overlay, path, k); evas_object_size_hint_aspect_set(ic->o_overlay, EVAS_ASPECT_CONTROL_BOTH, 1, 1); elm_layout_content_set(ic->o_layout, "e.swallow.overlay", ic->o_overlay); evas_object_show(ic->o_overlay); @@ -336,14 +379,10 @@ { if (inst->icons) { - Icon *ic; - Eina_List *l; - elm_gengrid_clear(inst->o_icon_con); - EINA_LIST_FOREACH(inst->icons, l, ic) - _grid_icon_del(inst, ic); - eina_list_free(inst->icons); - inst->icons = NULL; + while (inst->icons) + _grid_icon_del(inst, eina_list_data_get(inst->icons)); + inst->icons = NULL; } } @@ -378,80 +417,7 @@ elm_layout_sizing_eval(inst->o_main); _grid_aspect(inst); EINA_LIST_FOREACH(inst->icons, l, ic) - { - const char *path = NULL, *key = NULL; - int len = 0; - - if (ic->desktop) - { - if (!ic->desktop->icon) - path = NULL; - else if (strncmp(ic->desktop->icon, "/", 1) && !ecore_file_exists(ic->desktop->icon)) - { - path = efreet_icon_path_find(e_config->icon_theme, ic->desktop->icon, inst->size); - if (!path) - { - if (e_util_strcmp(e_config->icon_theme, "hicolor")) - path = efreet_icon_path_find("hicolor", ic->desktop->icon, inst->size); - } - } - else if (ecore_file_exists(ic->desktop->icon)) - { - path = ic->desktop->icon; - } - if (!path) - { - elm_image_file_set(ic->o_icon, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - elm_image_file_set(ic->o_overlay, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - } - if (path && ic->desktop->icon) - { - len = strlen(ic->desktop->icon); - if ((len > 4) && (!strcasecmp(ic->desktop->icon + len - 4, ".edj"))) - key = "icon"; - - elm_image_file_set(ic->o_icon, path, key); - elm_image_file_set(ic->o_overlay, path, key); - } - } - else if (ic->icon) - { - if (strncmp(ic->icon, "/", 1) && !ecore_file_exists(ic->icon)) - { - path = efreet_icon_path_find(e_config->icon_theme, ic->icon, inst->size); - if (!path) - { - if (e_util_strcmp(e_config->icon_theme, "hicolor")) - path = efreet_icon_path_find("hicolor", ic->icon, inst->size); - } - } - else if (ecore_file_exists(ic->icon)) - { - path = ic->icon; - } - if (!path) - { - elm_image_file_set(ic->o_icon, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - elm_image_file_set(ic->o_overlay, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - } - else - { - elm_image_file_set(ic->o_icon, path, ic->key); - elm_image_file_set(ic->o_overlay, path, ic->key); - } - } - else - { - elm_image_file_set(ic->o_icon, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - elm_image_file_set(ic->o_overlay, e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"), - "e/icons/unknown"); - } - } + _grid_icon_file_set(ic, ic->desktop); inst->resize_job = NULL; } } diff -Nru e20-201702271931/src/modules/Makefile.mk e20-201702281931/src/modules/Makefile.mk --- e20-201702271931/src/modules/Makefile.mk 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/Makefile.mk 2017-02-28 19:31:37.000000000 +0000 @@ -113,6 +113,8 @@ include src/modules/Makefile_wl_drm.mk +include src/modules/Makefile_wl_buffer.mk + include src/modules/Makefile_wl_wl.mk include src/modules/Makefile_wl_desktop_shell.mk diff -Nru e20-201702271931/src/modules/Makefile_sysinfo.mk e20-201702281931/src/modules/Makefile_sysinfo.mk --- e20-201702271931/src/modules/Makefile_sysinfo.mk 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/Makefile_sysinfo.mk 2017-02-28 19:31:37.000000000 +0000 @@ -17,6 +17,7 @@ src/modules/sysinfo/batman/batman.h \ src/modules/sysinfo/batman/batman.c \ src/modules/sysinfo/batman/batman_fallback.c \ + src/modules/sysinfo/batman/batman_config.c \ src/modules/sysinfo/thermal/thermal.h \ src/modules/sysinfo/thermal/thermal.c \ src/modules/sysinfo/thermal/thermal_fallback.c \ @@ -25,12 +26,15 @@ src/modules/sysinfo/cpuclock/cpuclock_sysfs.c \ src/modules/sysinfo/cpumonitor/cpumonitor.h \ src/modules/sysinfo/cpumonitor/cpumonitor.c \ + src/modules/sysinfo/cpumonitor/cpumonitor_config.c \ src/modules/sysinfo/cpumonitor/cpumonitor_proc.c \ src/modules/sysinfo/memusage/memusage.h \ src/modules/sysinfo/memusage/memusage.c \ + src/modules/sysinfo/memusage/memusage_config.c \ src/modules/sysinfo/memusage/memusage_proc.c \ src/modules/sysinfo/netstatus/netstatus.h \ src/modules/sysinfo/netstatus/netstatus.c \ + src/modules/sysinfo/netstatus/netstatus_config.c \ src/modules/sysinfo/netstatus/netstatus_proc.c \ src/modules/sysinfo/sysinfo.c if HAVE_EEZE @@ -40,22 +44,34 @@ if HAVE_OPENBSD src_modules_sysinfo_module_la_SOURCES += src/modules/sysinfo/batman/batman_sysctl.c \ src/modules/sysinfo/thermal/thermal_sysctl.c \ - src/modules/sysinfo/cpuclock/cpuclock_sysctl.c + src/modules/sysinfo/cpuclock/cpuclock_sysctl.c \ + src/modules/sysinfo/netstatus/netstatus_sysctl.c \ + src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c \ + src/modules/sysinfo/memusage/memusage_sysctl.c else if HAVE_NETBSD src_modules_sysinfo_module_la_SOURCES += src/modules/sysinfo/batman/batman_sysctl.c \ src/modules/sysinfo/thermal/thermal_sysctl.c \ - src/modules/sysinfo/cpuclock/cpuclock_sysctl.c + src/modules/sysinfo/cpuclock/cpuclock_sysctl.c \ + src/modules/sysinfo/netstatus/netstatus_sysctl.c \ + src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c \ + src/modules/sysinfo/memusage/memusage_sysctl.c else if HAVE_DRAGONFLY src_modules_sysinfo_module_la_SOURCES += src/modules/sysinfo/batman/batman_sysctl.c \ src/modules/sysinfo/thermal/thermal_sysctl.c \ - src/modules/sysinfo/cpuclock/cpuclock_sysctl.c + src/modules/sysinfo/cpuclock/cpuclock_sysctl.c \ + src/modules/sysinfo/netstatus/netstatus_sysctl.c \ + src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c \ + src/modules/sysinfo/memusage/memusage_sysctl.c else if HAVE_FREEBSD src_modules_sysinfo_module_la_SOURCES += src/modules/sysinfo/batman/batman_sysctl.c \ src/modules/sysinfo/thermal/thermal_sysctl.c \ - src/modules/sysinfo/cpuclock/cpuclock_sysctl.c + src/modules/sysinfo/cpuclock/cpuclock_sysctl.c \ + src/modules/sysinfo/netstatus/netstatus_sysctl.c \ + src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c \ + src/modules/sysinfo/memusage/memusage_sysctl.c else src_modules_sysinfo_module_la_SOURCES += src/modules/sysinfo/batman/batman_upower.c \ src/modules/sysinfo/thermal/thermal_sysctl.c \ diff -Nru e20-201702271931/src/modules/Makefile_wl_buffer.mk e20-201702281931/src/modules/Makefile_wl_buffer.mk --- e20-201702271931/src/modules/Makefile_wl_buffer.mk 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/Makefile_wl_buffer.mk 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,17 @@ +if USE_MODULE_WL_BUFFER +wl_bufferdir = $(MDIR)/wl_buffer + +wl_bufferpkgdir = $(MDIR)/wl_buffer/$(MODULE_ARCH) +wl_bufferpkg_LTLIBRARIES = src/modules/wl_buffer/module.la + +src_modules_wl_buffer_module_la_DEPENDENCIES = $(MDEPENDENCIES) +src_modules_wl_buffer_module_la_CPPFLAGS = $(MOD_CPPFLAGS) @WAYLAND_CFLAGS@ +src_modules_wl_buffer_module_la_LIBADD = $(MOD_LIBS) @WAYLAND_LIBS@ +src_modules_wl_buffer_module_la_LDFLAGS = $(MOD_LDFLAGS) +src_modules_wl_buffer_module_la_SOURCES = \ +src/modules/wl_buffer/e_mod_main.c + +PHONIES += wl_buffer install-wl_buffer +wl_buffer: $(wl_bufferpkg_LTLIBRARIES) $(wl_buffer_DATA) +install-wl_buffer: install-wl_bufferpkgLTLIBRARIES +endif diff -Nru e20-201702271931/src/modules/mixer/e_mod_main.c e20-201702281931/src/modules/mixer/e_mod_main.c --- e20-201702271931/src/modules/mixer/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/mixer/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -95,6 +95,8 @@ Evas_Object *volume; Evas_Object *mute; E_Client *ec; + Evas_Object *bx; + Eina_List *sinks; }; static Context *mixer_context = NULL; @@ -468,27 +470,14 @@ void *event EINA_UNUSED) { int val; - Emix_Volume v; - unsigned int i; - int pval; EINA_SAFETY_ON_NULL_RETURN(mixer_context->sink_default); Emix_Sink *s = (Emix_Sink *)mixer_context->sink_default; - pval = s->volume.volumes[0]; - val = (int)elm_slider_value_get(obj); - v.volumes = calloc(s->volume.channel_count, sizeof(int)); - v.channel_count = s->volume.channel_count; - if (BARRIER_CHECK(pval, val)) - val = 100; - - for (i = 0; i < s->volume.channel_count; i++) v.volumes[i] = val; - emix_sink_volume_set(s, v); - elm_slider_value_set(obj, val); + VOLSET(val, s->volume, s, emix_sink_volume_set); emix_config_save_state_get(); if (emix_config_save_get()) e_config_save_queue(); - free(v.volumes); } static void @@ -871,6 +860,15 @@ return emix_max_volume_get(); } +static const char * +_sink_input_name_get(void *data) +{ + Emix_Sink_Input *input; + + input = data; + return input->name; +} + static pid_t _get_ppid(pid_t pid) { @@ -926,10 +924,11 @@ DBG("Sink found the client %s", e_client_util_name_get(ec)); sink = e_client_volume_sink_new(_sink_input_get, - _sink_input_set, - _sink_input_min_get, - _sink_input_max_get, - input); + _sink_input_set, + _sink_input_min_get, + _sink_input_max_get, + _sink_input_name_get, + input); e_client_volume_sink_append(ec, sink); _client_sinks = eina_list_append(_client_sinks, sink); return; @@ -954,18 +953,7 @@ { if (sink->data == input) { - Eina_Bool update = EINA_TRUE; - EINA_LIST_FOREACH(sink->clients, l, ec) - { - if (eina_list_count(ec->sinks) > 1) - { - update = EINA_FALSE; - break; - } - } - if (update) - e_client_volume_sink_update(sink); - + e_client_volume_sink_update(sink); } } break; @@ -1051,6 +1039,17 @@ } static void +_bd_hook_volume_drag_stop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Client *ec; + + ec = data; + + elm_slider_value_set(obj, ec->volume); +} + + +static void _bd_hook_mute_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { E_Client *ec; @@ -1060,11 +1059,60 @@ e_client_volume_mute_set(ec, elm_check_state_get(obj)); } +static void +_bd_hook_sink_volume_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + E_Client_Volume_Sink *sink; + Evas_Object *check; + + sink = data; + + check = evas_object_data_get(obj, "e_sink_check"); + + e_client_volume_sink_set(sink, + elm_slider_value_get(obj), + elm_check_state_get(check)); +} + +static void +_bd_hook_sink_volume_drag_stop(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + E_Client_Volume_Sink *sink; + Evas_Object *check; + Eina_Bool mute; + int vol; + + sink = data; + + check = evas_object_data_get(obj, "e_sink_check"); + + e_client_volume_sink_get(sink, &vol, &mute); + elm_slider_value_set(obj, vol); + elm_check_state_set(check, mute); +} + + +static void +_bd_hook_sink_mute_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + E_Client_Volume_Sink *sink; + Evas_Object *slider; + + sink = data; + slider = evas_object_data_get(obj, "e_sink_volume"); + + e_client_volume_sink_set(sink, + elm_slider_value_get(slider), + elm_check_state_get(obj)); +} + static Eina_Bool _e_client_volume_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { E_Event_Client *ev; Client_Mixer *cm; + E_Client_Volume_Sink *sink; + Evas_Object *o; Eina_List *l; ev = event; @@ -1074,6 +1122,13 @@ if (cm->ec == ev->ec) { elm_slider_value_set(cm->volume, cm->ec->volume); + EINA_LIST_FOREACH(cm->sinks, l, o) + { + int volume; + sink = evas_object_data_get(o, "e_sink"); + e_client_volume_sink_get(sink, &volume, NULL); + elm_slider_value_set(o, volume); + } break; } } @@ -1086,7 +1141,10 @@ { E_Event_Client *ev; Client_Mixer *cm; + E_Client_Volume_Sink *sink; + Evas_Object *o, *check; Eina_List *l; + Eina_Bool mute; ev = event; @@ -1095,6 +1153,164 @@ if (cm->ec == ev->ec) { elm_check_state_set(cm->mute, !!cm->ec->mute); + elm_object_disabled_set(cm->volume, !!cm->ec->mute); + EINA_LIST_FOREACH(cm->sinks, l, o) + { + sink = evas_object_data_get(o, "e_sink"); + check = evas_object_data_get(o, "e_sink_check"); + e_client_volume_sink_get(sink, NULL, &mute); + elm_check_state_set(check, mute); + elm_object_disabled_set(o, mute); + } + break; + } + } + + return ECORE_CALLBACK_PASS_ON; +} + +static void +_e_client_mixer_sink_append(E_Client_Volume_Sink *sink, Client_Mixer *cm) +{ + Evas_Object *lbl, *slider, *check, *sep; + int volume; + int min, max; + Eina_Bool mute; + + min = e_client_volume_sink_min_get(sink); + max = e_client_volume_sink_max_get(sink); + e_client_volume_sink_get(sink, &volume, &mute); + + sep = elm_separator_add(cm->bx); + elm_separator_horizontal_set(sep, EINA_TRUE); + evas_object_size_hint_weight_set(sep, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sep, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(cm->bx, sep); + evas_object_show(sep); + + lbl = elm_label_add(cm->bx); + elm_object_text_set(lbl, e_client_volume_sink_name_get(sink)); + evas_object_size_hint_align_set(lbl, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(cm->bx, lbl); + evas_object_show(lbl); + + slider = elm_slider_add(cm->bx); + elm_slider_horizontal_set(slider, EINA_TRUE); + elm_slider_min_max_set(slider, min, max); + elm_slider_span_size_set(slider, max * elm_config_scale_get()); + elm_slider_unit_format_set(slider, "%.0f"); + elm_slider_indicator_format_set(slider, "%.0f"); + evas_object_size_hint_weight_set(slider, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_slider_value_set(slider, volume); + evas_object_smart_callback_add(slider, "changed", + _bd_hook_sink_volume_changed, sink); + evas_object_smart_callback_add(slider, "slider,drag,stop", + _bd_hook_sink_volume_drag_stop, sink); + elm_box_pack_end(cm->bx, slider); + evas_object_show(slider); + + check = elm_check_add(cm->bx); + elm_object_text_set(check, _("Mute")); + evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); + elm_check_state_set(check, !!mute); + elm_object_disabled_set(slider, !!mute); + evas_object_smart_callback_add(check, "changed", + _bd_hook_sink_mute_changed, sink); + + elm_box_pack_end(cm->bx, check); + evas_object_show(check); + + evas_object_data_set(slider, "e_sink", sink); + evas_object_data_set(slider, "e_sink_check", check); + evas_object_data_set(slider, "e_sink_label", lbl); + evas_object_data_set(slider, "e_sink_separator", sep); + evas_object_data_set(check, "e_sink_volume", slider); + cm->sinks = eina_list_append(cm->sinks, slider); +} + +static Eina_Bool +_e_client_volume_sink_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + E_Event_Client_Volume_Sink *ev; + Client_Mixer *cm; + Eina_List *l; + + ev = event; + + EINA_LIST_FOREACH(_client_mixers, l, cm) + { + if (cm->ec == ev->ec) + { + _e_client_mixer_sink_append(ev->sink, cm); + } + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_client_volume_sink_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + E_Event_Client_Volume_Sink *ev; + E_Client_Volume_Sink *sink; + Client_Mixer *cm; + Evas_Object *o, *lbl, *check, *sep; + Eina_List *l; + + ev = event; + + EINA_LIST_FOREACH(_client_mixers, l, cm) + { + if (cm->ec == ev->ec) + { + EINA_LIST_FOREACH(cm->sinks, l, o) + { + sink = evas_object_data_get(o, "e_sink"); + if (sink == ev->sink) + { + lbl = evas_object_data_get(o, "e_sink_label"); + check = evas_object_data_get(o, "e_sink_check"); + sep = evas_object_data_get(o, "e_sink_separator"); + evas_object_del(sep); + evas_object_del(lbl); + evas_object_del(o); + evas_object_del(check); + cm->sinks = eina_list_remove_list(cm->sinks, l); + } + } + break; + } + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_client_volume_sink_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + E_Event_Client_Volume_Sink *ev; + Client_Mixer *cm; + E_Client_Volume_Sink *sink; + Evas_Object *o, *check; + Eina_List *l; + int volume; + Eina_Bool mute; + + ev = event; + + EINA_LIST_FOREACH(_client_mixers, l, cm) + { + if (cm->ec == ev->ec) + { + EINA_LIST_FOREACH(cm->sinks, l, o) + { + sink = evas_object_data_get(o, "e_sink"); + if (sink != ev->sink) continue; + check = evas_object_data_get(o, "e_sink_check"); + e_client_volume_sink_get(sink, &volume, &mute); + elm_slider_value_set(o, volume); + elm_object_disabled_set(o, mute); + elm_check_state_set(check, mute); + } break; } } @@ -1143,6 +1359,7 @@ { E_Client *ec; Client_Mixer *cm; + E_Client_Volume_Sink *sink; Evas_Object *win, *popup, *bx, *o; Eina_List *l; int w, h; @@ -1164,6 +1381,13 @@ elm_box_horizontal_set(bx, EINA_FALSE); elm_object_content_set(win, bx); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + cm->bx = bx; + + o = elm_label_add(bx); + elm_object_text_set(o, _("Main")); + evas_object_size_hint_align_set(o, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(bx, o); + evas_object_show(o); o = elm_slider_add(bx); elm_slider_horizontal_set(o, EINA_TRUE); @@ -1175,6 +1399,8 @@ evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_slider_value_set(o, ec->volume); evas_object_smart_callback_add(o, "changed", _bd_hook_volume_changed, ec); + evas_object_smart_callback_add(o, "slider,drag,stop", + _bd_hook_volume_drag_stop, ec); elm_box_pack_end(bx, o); evas_object_show(o); cm->volume = o; @@ -1183,11 +1409,17 @@ elm_object_text_set(o, _("Mute")); evas_object_size_hint_align_set(o, 0.0, EVAS_HINT_FILL); elm_check_state_set(o, !!ec->mute); + elm_object_disabled_set(o, !!ec->mute); evas_object_smart_callback_add(o, "changed", _bd_hook_mute_changed, ec); elm_box_pack_end(bx, o); evas_object_show(o); cm->mute = o; + EINA_LIST_FOREACH(ec->sinks, l, sink) + { + _e_client_mixer_sink_append(sink, cm); + } + evas_object_show(bx); evas_object_size_hint_min_get(bx, &w, &h); evas_object_resize(win, w, h); @@ -1298,6 +1530,12 @@ _e_client_mute_changed, NULL); E_LIST_HANDLER_APPEND(_client_handlers, E_EVENT_CLIENT_REMOVE, _e_client_remove, NULL); + E_LIST_HANDLER_APPEND(_client_handlers, E_EVENT_CLIENT_VOLUME_SINK_ADD, + _e_client_volume_sink_add, NULL); + E_LIST_HANDLER_APPEND(_client_handlers, E_EVENT_CLIENT_VOLUME_SINK_DEL, + _e_client_volume_sink_del, NULL); + E_LIST_HANDLER_APPEND(_client_handlers, E_EVENT_CLIENT_VOLUME_SINK_CHANGED, + _e_client_volume_sink_changed, NULL); return m; diff -Nru e20-201702271931/src/modules/mixer/lib/backends/pulseaudio/pulse.c e20-201702281931/src/modules/mixer/lib/backends/pulseaudio/pulse.c --- e20-201702271931/src/modules/mixer/lib/backends/pulseaudio/pulse.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/mixer/lib/backends/pulseaudio/pulse.c 2017-02-28 19:31:37.000000000 +0000 @@ -764,7 +764,7 @@ case PA_CONTEXT_FAILED: WRN("PA_CONTEXT_FAILED"); if (!ctx->connect) - ctx->connect = ecore_timer_add(1.0, _pulse_connect, data); + ctx->connect = ecore_timer_loop_add(0.2, _pulse_connect, data); goto err; case PA_CONTEXT_TERMINATED: ERR("PA_CONTEXT_TERMINATE:"); @@ -800,7 +800,7 @@ "org.enlightenment.volumecontrol"); pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "audio-card"); #if !defined(EMIXER_BUILD) && defined(HAVE_WAYLAND) && !defined(HAVE_WAYLAND_ONLY) - char *display; + char *display = NULL; if (e_comp->comp_type != E_PIXMAP_TYPE_X) { @@ -825,8 +825,11 @@ #if !defined(EMIXER_BUILD) && defined(HAVE_WAYLAND) && !defined(HAVE_WAYLAND_ONLY) if (e_comp->comp_type != E_PIXMAP_TYPE_X) { - e_env_set("DISPLAY", display); - free(display); + if (display) + { + e_env_set("DISPLAY", display); + free(display); + } } #endif @@ -838,9 +841,24 @@ return ECORE_CALLBACK_RENEW; } +static Ecore_Exe *_pulse_exe = NULL; +static Ecore_Event_Handler *_pulse_exe_handler = NULL; + static void _shutdown(void) { + if (_pulse_exe) + { + ecore_exe_kill(_pulse_exe); + ecore_exe_free(_pulse_exe); + _pulse_exe = NULL; + } + if (_pulse_exe_handler) + { + ecore_event_handler_del(_pulse_exe_handler); + _pulse_exe_handler = NULL; + } + if (!ctx) return; @@ -858,6 +876,16 @@ } static Eina_Bool +_pulse_exe_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Exe_Event_Del *ev = event; + + if (ev->exe != _pulse_exe) return ECORE_CALLBACK_PASS_ON; + _pulse_exe = NULL; + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool _init(Emix_Event_Cb cb, const void *data) { if (ctx) @@ -873,14 +901,13 @@ ctx->api = functable; ctx->api.userdata = ctx; - /* The reason of compares with EINA_TRUE is because ECORE_CALLBACK_RENEW - is EINA_TRUE. The function _pulse_connect returns ECORE_CALLBACK_RENEW - when could not connect to pulse. - */ - if (_pulse_connect(ctx) == EINA_TRUE) + if (_pulse_connect(ctx) == EINA_TRUE) // true == failed and try again { - _shutdown(); - return EINA_FALSE; + _pulse_exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, + _pulse_exe_del, NULL); + _pulse_exe = ecore_exe_pipe_run + ("pulseaudio", ECORE_EXE_NOT_LEADER | ECORE_EXE_TERM_WITH_PARENT, + NULL); } ctx->cb = cb; diff -Nru e20-201702271931/src/modules/mixer/lib/backends/pulseaudio/pulse_ml.c e20-201702281931/src/modules/mixer/lib/backends/pulseaudio/pulse_ml.c --- e20-201702271931/src/modules/mixer/lib/backends/pulseaudio/pulse_ml.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/mixer/lib/backends/pulseaudio/pulse_ml.c 2017-02-28 19:31:37.000000000 +0000 @@ -159,7 +159,7 @@ } interval = (tv->tv_sec - now.tv_sec) + (tv->tv_usec - now.tv_usec) / 1000; - event->timer = ecore_timer_add(interval, _ecore_time_wrapper, event); + event->timer = ecore_timer_loop_add(interval, _ecore_time_wrapper, event); return event; } @@ -189,12 +189,12 @@ interval = (tv->tv_sec - now.tv_sec) + (tv->tv_usec - now.tv_usec) / 1000; if (event->timer) { - event->timer = ecore_timer_add(interval, _ecore_time_wrapper, event); + event->timer = ecore_timer_loop_add(interval, _ecore_time_wrapper, event); } else { ecore_timer_interval_set(event->timer, interval); - ecore_timer_reset(event->timer); + ecore_timer_loop_reset(event->timer); } } diff -Nru e20-201702271931/src/modules/notification/e_mod_main.c e20-201702281931/src/modules/notification/e_mod_main.c --- e20-201702271931/src/modules/notification/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/notification/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -217,7 +217,7 @@ notification_cfg->handler = ecore_event_handler_add (E_EVENT_CONFIG_MODE_CHANGED, (Ecore_Event_Handler_Cb)_notification_cb_config_mode_changed, notification_cfg); - notification_cfg->initial_mode_timer = ecore_timer_add + notification_cfg->initial_mode_timer = ecore_timer_loop_add (0.1, (Ecore_Task_Cb)_notification_cb_initial_mode_timer, notification_cfg); notification_mod = m; diff -Nru e20-201702271931/src/modules/notification/e_mod_popup.c e20-201702281931/src/modules/notification/e_mod_popup.c --- e20-201702271931/src/modules/notification/e_mod_popup.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/notification/e_mod_popup.c 2017-02-28 19:31:37.000000000 +0000 @@ -165,7 +165,7 @@ if (n->timeout > 0) - popup->timer = ecore_timer_add(n->timeout, (Ecore_Task_Cb)_notification_timer_cb, popup); + popup->timer = ecore_timer_loop_add(n->timeout, (Ecore_Task_Cb)_notification_timer_cb, popup); } void diff -Nru e20-201702271931/src/modules/packagekit/e_mod_main.c e20-201702281931/src/modules/packagekit/e_mod_main.c --- e20-201702271931/src/modules/packagekit/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/packagekit/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -186,7 +186,7 @@ packagekit_mod = m; e_gadcon_provider_register(&_gc_class); packagekit_dbus_connect(ctxt); - ctxt->refresh_timer = ecore_timer_add(60.0, _refresh_timer_cb, ctxt); + ctxt->refresh_timer = ecore_timer_loop_add(60.0, _refresh_timer_cb, ctxt); return ctxt; } diff -Nru e20-201702271931/src/modules/pager/e_mod_main.c e20-201702281931/src/modules/pager/e_mod_main.c --- e20-201702271931/src/modules/pager/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/pager/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -1015,9 +1015,9 @@ else pp = _pager_popup_new(ev->desk->zone, 0); if (pp->timer) - ecore_timer_reset(pp->timer); + ecore_timer_loop_reset(pp->timer); else - pp->timer = ecore_timer_add(pager_config->popup_speed, + pp->timer = ecore_timer_loop_add(pager_config->popup_speed, _pager_popup_cb_timeout, pp); } @@ -1074,7 +1074,7 @@ if (!pp) return ECORE_CALLBACK_RENEW; if (!pager_config->popup_urgent_stick) - pp->timer = ecore_timer_add(pager_config->popup_urgent_speed, + pp->timer = ecore_timer_loop_add(pager_config->popup_urgent_speed, _pager_popup_cb_timeout, pp); pp->urgent = 1; } @@ -1782,7 +1782,7 @@ handlers = eina_list_remove_list(handlers, handlers); } - act_popup->timer = ecore_timer_add(0.1, _pager_popup_cb_timeout, act_popup); + act_popup->timer = ecore_timer_loop_add(0.1, _pager_popup_cb_timeout, act_popup); if ((switch_desk) && (current_desk)) e_desk_show(current_desk); diff -Nru e20-201702271931/src/modules/pager/gadget/config.c e20-201702281931/src/modules/pager/gadget/config.c --- e20-201702271931/src/modules/pager/gadget/config.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/pager/gadget/config.c 2017-02-28 19:31:37.000000000 +0000 @@ -268,7 +268,7 @@ static Evas_Object * _config_create_pages(Evas_Object *parent) { - Evas_Object *m, *tb, *ow; + Evas_Object *m, *tb, *ow, *fr; int row = 5; m = elm_table_add(parent); @@ -276,8 +276,15 @@ evas_object_show(m); /* General Page */ + fr = elm_frame_add(m); + elm_object_text_set(fr, _("General")); + E_EXPAND(fr); + E_FILL(fr); + evas_object_show(fr); + tb = elm_table_add(m); E_EXPAND(tb); + elm_object_content_set(fr, tb); evas_object_show(tb); ow = elm_button_add(tb); @@ -318,7 +325,7 @@ ow = elm_label_add(tb); elm_object_text_set(ow, _("Resistance to dragging")); elm_table_pack(tb, ow, 0, 3, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); @@ -339,7 +346,7 @@ ow = elm_label_add(tb); elm_object_text_set(ow, _("Select and Slide button")); elm_table_pack(tb, ow, 0, row, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); row++; @@ -359,7 +366,7 @@ ow = elm_label_add(tb); elm_object_text_set(ow, _("Drag and Drop button")); elm_table_pack(tb, ow, 0, row, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); row++; @@ -378,7 +385,7 @@ ow = elm_label_add(tb); elm_object_text_set(ow, _("Drag whole desktop")); elm_table_pack(tb, ow, 0, row, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); row++; @@ -395,12 +402,19 @@ _config_update_btns(); - elm_table_pack(m, tb, 0, 0, 1, 1); - pager_gadget_config_objects->general_page = tb; + elm_table_pack(m, fr, 0, 0, 1, 1); + pager_gadget_config_objects->general_page = fr; /* Popup Page */ - tb = elm_table_add(m); + fr = elm_frame_add(m); + elm_object_text_set(fr, _("Popup")); + E_EXPAND(fr); + E_FILL(fr); + evas_object_show(fr); + + tb = elm_table_add(fr); E_EXPAND(tb); + elm_object_content_set(fr, tb); evas_object_show(tb); ow = elm_check_add(tb); @@ -419,7 +433,7 @@ elm_object_text_set(ow, _("Popup pager height")); elm_object_disabled_set(ow, !pager_config->popup); elm_table_pack(tb, ow, 0, 1, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); @@ -441,7 +455,7 @@ elm_object_text_set(ow, _("Popup duration")); elm_object_disabled_set(ow, !pager_config->popup); elm_table_pack(tb, ow, 0, 3, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); @@ -463,7 +477,7 @@ elm_object_text_set(ow, _("Pager action popup height")); elm_object_disabled_set(ow, !pager_config->popup); elm_table_pack(tb, ow, 0, 5, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); @@ -481,12 +495,19 @@ evas_object_show(ow); pager_gadget_config_objects->o_popup_act_height = ow; - elm_table_pack(m, tb, 0, 0, 1, 1); - pager_gadget_config_objects->popup_page = tb; + elm_table_pack(m, fr, 0, 0, 1, 1); + pager_gadget_config_objects->popup_page = fr; /* Urgent Page */ - tb = elm_table_add(m); + fr = elm_frame_add(m); + elm_object_text_set(fr, _("Urgent")); + E_EXPAND(fr); + E_FILL(fr); + evas_object_show(fr); + + tb = elm_table_add(fr); E_EXPAND(tb); + elm_object_content_set(fr, tb); evas_object_show(tb); ow = elm_check_add(tb); @@ -531,7 +552,7 @@ elm_object_text_set(ow, _("Urgent Popup Duration")); elm_object_disabled_set(ow, !pager_config->popup_urgent); elm_table_pack(tb, ow, 0, 3, 1, 1); - E_ALIGN(ow, 0.5, 0.5); + E_ALIGN(ow, 0.0, 0.0); E_WEIGHT(ow, EVAS_HINT_EXPAND, 0); evas_object_show(ow); @@ -549,8 +570,8 @@ evas_object_show(ow); pager_gadget_config_objects->o_popup_urgent_speed = ow; - elm_table_pack(m, tb, 0, 0, 1, 1); - pager_gadget_config_objects->urgent_page = tb; + elm_table_pack(m, fr, 0, 0, 1, 1); + pager_gadget_config_objects->urgent_page = fr; return m; } @@ -558,7 +579,7 @@ EINTERN Evas_Object * config_pager(E_Zone *zone) { - Evas_Object *popup, *tb, *lbl, *list, *fr; + Evas_Object *popup, *tb, *lbl, *list; Elm_Object_Item *it; pager_gadget_config_objects = E_NEW(Config_Objects, 1); @@ -597,13 +618,8 @@ elm_list_go(list); evas_object_show(list); - fr = elm_frame_add(tb); - E_EXPAND(fr); - elm_table_pack(tb, fr, 1, 1, 1, 1); - evas_object_show(fr); - - elm_object_content_set(fr, - _config_create_pages(fr)); + elm_table_pack(tb, + _config_create_pages(tb), 1, 1, 1, 1); _config_show_general(NULL, NULL, NULL); popup = e_comp_object_util_add(popup, E_COMP_OBJECT_TYPE_NONE); diff -Nru e20-201702271931/src/modules/pager/gadget/pager.c e20-201702281931/src/modules/pager/gadget/pager.c --- e20-201702271931/src/modules/pager/gadget/pager.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/pager/gadget/pager.c 2017-02-28 19:31:37.000000000 +0000 @@ -12,7 +12,6 @@ Evas_Object *o_pager; /* table */ Pager *pager; Pager_Popup *popup; - Eina_Bool destroyed; }; struct _Pager @@ -234,15 +233,6 @@ } static void -_pager_gadget_destroyed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Instance *inst = data; - - if (inst) - inst->destroyed = EINA_TRUE; -} - -static void _pager_orient(Instance *inst, E_Gadget_Site_Orient orient) { int aspect_w, aspect_h; @@ -930,9 +920,9 @@ else pp = pager_popup_new(0); if (pp->timer) - ecore_timer_reset(pp->timer); + ecore_timer_loop_reset(pp->timer); else - pp->timer = ecore_timer_add(pager_config->popup_speed, + pp->timer = ecore_timer_loop_add(pager_config->popup_speed, _pager_popup_cb_timeout, pp); } @@ -988,7 +978,7 @@ if (!pp) return ECORE_CALLBACK_RENEW; if (!pager_config->popup_urgent_stick) - pp->timer = ecore_timer_add(pager_config->popup_urgent_speed, + pp->timer = ecore_timer_loop_add(pager_config->popup_urgent_speed, _pager_popup_cb_timeout, pp); pp->urgent = 1; } @@ -1659,7 +1649,7 @@ handlers = eina_list_remove_list(handlers, handlers); } - act_popup->timer = ecore_timer_add(0.1, _pager_popup_cb_timeout, act_popup); + act_popup->timer = ecore_timer_loop_add(0.1, _pager_popup_cb_timeout, act_popup); if ((switch_desk) && (current_desk)) e_desk_show(current_desk); @@ -1933,13 +1923,11 @@ inst->pager = p; o = p->o_table; inst->o_pager = o; - inst->destroyed = EINA_FALSE; _pager_orient(inst, e_gadget_site_orient_get(parent)); evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, pager_del, inst); evas_object_smart_callback_add(parent, "gadget_created", _pager_gadget_created_cb, inst); evas_object_smart_callback_add(parent, "gadget_site_anchor", _pager_gadget_anchor_change_cb, inst); - evas_object_smart_callback_add(parent, "gadget_destroyed", _pager_gadget_destroyed_cb, inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _pager_cb_move, inst); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _button_cb_mouse_down, inst); diff -Nru e20-201702271931/src/modules/pager_plain/e_mod_main.c e20-201702281931/src/modules/pager_plain/e_mod_main.c --- e20-201702271931/src/modules/pager_plain/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/pager_plain/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -1423,7 +1423,7 @@ pp = _pager_popup_new(zone, 0); if ((pp) && (!pager_config->popup_urgent_stick)) - pp->timer = ecore_timer_add(pager_config->popup_urgent_speed, + pp->timer = ecore_timer_loop_add(pager_config->popup_urgent_speed, _pager_popup_cb_timeout, pp); if (pp) pp->urgent = 1; } @@ -1691,9 +1691,9 @@ else pp = _pager_popup_new(ev->desk->zone, 0); if (pp->timer) - ecore_timer_reset(pp->timer); + ecore_timer_loop_reset(pp->timer); else - pp->timer = ecore_timer_add(pager_config->popup_speed, + pp->timer = ecore_timer_loop_add(pager_config->popup_speed, _pager_popup_cb_timeout, pp); } @@ -2521,7 +2521,7 @@ handlers = eina_list_remove_list(handlers, handlers); } - act_popup->timer = ecore_timer_add(0.1, _pager_popup_cb_timeout, act_popup); + act_popup->timer = ecore_timer_loop_add(0.1, _pager_popup_cb_timeout, act_popup); if ((switch_desk) && (current_desk)) e_desk_show(current_desk); diff -Nru e20-201702271931/src/modules/quickaccess/e_mod_quickaccess.c e20-201702281931/src/modules/quickaccess/e_mod_quickaccess.c --- e20-201702271931/src/modules/quickaccess/e_mod_quickaccess.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/quickaccess/e_mod_quickaccess.c 2017-02-28 19:31:37.000000000 +0000 @@ -947,9 +947,9 @@ { qa_mod->help_dia = NULL; if (qa_mod->help_timeout) - ecore_timer_reset(qa_mod->help_timeout); + ecore_timer_loop_reset(qa_mod->help_timeout); else - qa_mod->help_timeout = ecore_timer_add(20.0, _e_qa_help_timeout, NULL); + qa_mod->help_timeout = ecore_timer_loop_add(20.0, _e_qa_help_timeout, NULL); } static void @@ -1002,7 +1002,7 @@ if (_e_qa_entry_find_border(e_win_client_get(qa_mod->demo_dia->win))) { - qa_mod->help_timer = ecore_timer_add(1, _e_qa_help_timer_cb, NULL); + qa_mod->help_timer = ecore_timer_loop_add(1, _e_qa_help_timer_cb, NULL); return; } @@ -1140,7 +1140,7 @@ qa_mod->demo_state = 0; qa_mod->help_timer = NULL; if (mi->menu != qa_mod->menu) - qa_mod->help_timer = ecore_timer_add(0.2, _e_qa_help_timer2_cb, NULL); + qa_mod->help_timer = ecore_timer_loop_add(0.2, _e_qa_help_timer2_cb, NULL); return EINA_FALSE; } items = qa_mod->menu->items; @@ -1246,8 +1246,8 @@ e_dialog_text_set(dia, _("This is a demo dialog used in the Quickaccess tutorial")); e_dialog_show(dia); - qa_mod->help_timer = ecore_timer_add(1, _e_qa_help_timer_cb, NULL); - ecore_timer_reset(qa_mod->help_timeout); + qa_mod->help_timer = ecore_timer_loop_add(1, _e_qa_help_timer_cb, NULL); + ecore_timer_loop_reset(qa_mod->help_timeout); ecore_timer_freeze(qa_mod->help_timeout); e_object_free_attach_func_set(E_OBJECT(qa_mod->demo_dia), _e_qa_demo_dia_del); diff -Nru e20-201702271931/src/modules/shot/e_mod_main.c e20-201702281931/src/modules/shot/e_mod_main.c --- e20-201702271931/src/modules/shot/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/shot/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -1157,14 +1157,14 @@ _shot_border(E_Client *ec) { if (border_timer) ecore_timer_del(border_timer); - border_timer = ecore_timer_add(1.0, _shot_delay_border, ec); + border_timer = ecore_timer_loop_add(1.0, _shot_delay_border, ec); } static void _shot(E_Zone *zone) { if (timer) ecore_timer_del(timer); - timer = ecore_timer_add(1.0, _shot_delay, zone); + timer = ecore_timer_loop_add(1.0, _shot_delay, zone); } static void @@ -1228,7 +1228,7 @@ if (obj->type == E_COMP_TYPE) zone = e_zone_current_get(); else if (obj->type == E_ZONE_TYPE) - zone = ((E_Zone *)obj); + zone = ((void *)obj); else zone = e_zone_current_get(); } diff -Nru e20-201702271931/src/modules/start/e_mod_main.c e20-201702281931/src/modules/start/e_mod_main.c --- e20-201702271931/src/modules/start/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/start/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -324,8 +324,7 @@ start_module = m; e_gadcon_provider_register(&_gadcon_class); - if (E_EFL_VERSION_MINIMUM(1, 17, 99)) - e_gadget_type_add("Start", start_create, NULL); + e_gadget_type_add("Start", start_create, NULL); return m; } @@ -334,8 +333,7 @@ { start_module = NULL; e_gadcon_provider_unregister(&_gadcon_class); - if (E_EFL_VERSION_MINIMUM(1, 17, 99)) - e_gadget_type_del("Start"); + e_gadget_type_del("Start"); return 1; } diff -Nru e20-201702271931/src/modules/syscon/e_syscon.c e20-201702281931/src/modules/syscon/e_syscon.c --- e20-201702271931/src/modules/syscon/e_syscon.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/syscon/e_syscon.c 2017-02-28 19:31:37.000000000 +0000 @@ -273,7 +273,7 @@ if (e_config->syscon.do_input) { - deftimer = ecore_timer_add(e_config->syscon.timeout, + deftimer = ecore_timer_loop_add(e_config->syscon.timeout, _cb_timeout_defaction, NULL); if (defact) do_defact = eina_stringshare_add(defact); } diff -Nru e20-201702271931/src/modules/sysinfo/batman/batman.c e20-201702281931/src/modules/sysinfo/batman/batman.c --- e20-201702271931/src/modules/sysinfo/batman/batman.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/batman/batman.c 2017-02-28 19:31:37.000000000 +0000 @@ -10,6 +10,8 @@ static void _batman_warning_popup_destroy(Instance *inst); static void _batman_warning_popup(Instance *inst, int time, double percent); +static Ecore_Event_Handler *_handler = NULL; + Eina_List * _batman_battery_find(const char *udi) { @@ -42,10 +44,7 @@ _batman_face_level_set(Evas_Object *battery, double level) { Edje_Message_Float msg; - char buf[256]; - snprintf(buf, sizeof(buf), "%i", (int)(level * 100.0)); - elm_layout_text_set(battery, "e.text.reading", buf); if (level < 0.0) level = 0.0; else if (level > 1.0) level = 1.0; @@ -54,22 +53,144 @@ } static void -_batman_face_time_set(Evas_Object *battery, int t) +_batman_popup_dismissed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { - char buf[256]; - int hrs, mins; + Instance *inst = data; + E_FREE_FUNC(obj, evas_object_del); + inst->cfg->batman.popup = NULL; +} - if (t < 0) return; +static void +_batman_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + inst->cfg->batman.popup = NULL; +} - hrs = (t / 3600); - mins = ((t) / 60 - (hrs * 60)); +static Evas_Object * +_batman_popup_create(Instance *inst) +{ + Evas_Object *popup, *box, *pbar, *label; + Battery *bat; + Eina_List *l; + char buf[128], buf2[128]; + int hrs = 0, mins = 0; + Eina_List *udis = NULL; + + hrs = (inst->cfg->batman.time_left / 3600); + mins = ((inst->cfg->batman.time_left) / 60 - (hrs * 60)); if (mins < 0) mins = 0; - snprintf(buf, sizeof(buf), "%i:%02i", hrs, mins); - elm_layout_text_set(battery, "e.text.time", buf); + + popup = elm_ctxpopup_add(e_comp->elm); + elm_object_style_set(popup, "noblock"); + evas_object_smart_callback_add(popup, "dismissed", + _batman_popup_dismissed, inst); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _batman_popup_deleted, inst); + + box = elm_box_add(popup); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); E_FILL(box); + elm_object_content_set(popup, box); + evas_object_show(box); + + label = elm_label_add(box); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, buf); + elm_box_pack_end(box, label); + evas_object_show(label); + + if (inst->cfg->batman.have_power && (inst->cfg->batman.full < 99)) + snprintf(buf, sizeof(buf), _("Battery Charging")); + else if (inst->cfg->batman.full >= 99) + snprintf(buf, sizeof(buf), _("Battery Fully Charged")); + else + snprintf(buf, sizeof(buf), _("Time Remaining: %i:%02i"), hrs, mins); + snprintf(buf2, sizeof(buf2), "%s", buf); + elm_object_text_set(label, buf2); + + EINA_LIST_FOREACH(batman_device_batteries, l, bat) + { + if (!eina_list_count(udis) || !eina_list_data_find(udis, bat->udi)) + { + udis = eina_list_append(udis, bat->udi); + pbar = elm_progressbar_add(box); + E_EXPAND(pbar); E_FILL(pbar); + elm_progressbar_span_size_set(pbar, 200 * e_scale); + elm_progressbar_value_set(pbar, bat->percent / 100); + elm_box_pack_end(box, pbar); + evas_object_show(pbar); + } + } + if (eina_list_count(udis)) + eina_list_free(udis); + e_gadget_util_ctxpopup_place(inst->o_main, popup, + inst->cfg->batman.o_gadget); + evas_object_show(popup); + + return popup; +} + +static Evas_Object * +_batman_configure_cb(Evas_Object *g) +{ + Instance *inst = evas_object_data_get(g, "Instance"); + + if (!sysinfo_config) return NULL; + if (inst->cfg->batman.popup) return NULL; + return batman_configure(inst); +} + +static void +_batman_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data) +{ + Evas_Event_Mouse_Down *ev = event_data; + Instance *inst = data; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (ev->button != 3) + { + if (inst->cfg->batman.popup) + elm_ctxpopup_dismiss(inst->cfg->batman.popup); + else + inst->cfg->batman.popup = _batman_popup_create(inst); + } + else + { + if (inst->cfg->batman.popup) + elm_ctxpopup_dismiss(inst->cfg->batman.popup); + if (!sysinfo_config) return; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (inst->cfg->esm != E_SYSINFO_MODULE_BATMAN) + batman_configure(inst); + else + e_gadget_configure(inst->o_main); + } +} + +static Eina_Bool +_powersave_cb_config_update(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + Instance *inst = data; + + if (!inst->cfg->batman.have_battery) + e_powersave_mode_set(E_POWERSAVE_MODE_LOW); + else + { + if (inst->cfg->batman.have_power) + e_powersave_mode_set(E_POWERSAVE_MODE_LOW); + else if (inst->cfg->batman.full > 95) + e_powersave_mode_set(E_POWERSAVE_MODE_MEDIUM); + else if (inst->cfg->batman.full > 30) + e_powersave_mode_set(E_POWERSAVE_MODE_HIGH); + else + e_powersave_mode_set(E_POWERSAVE_MODE_EXTREME); + } + return ECORE_CALLBACK_RENEW; } void -_batman_update(Instance *inst, int full, int time_left, int time_full, Eina_Bool have_battery, Eina_Bool have_power) +_batman_update(Instance *inst, int full, int time_left, Eina_Bool have_battery, Eina_Bool have_power) { static double debounce_time = 0.0; @@ -109,24 +230,6 @@ else { _batman_face_level_set(inst->cfg->batman.o_gadget, 0.0); - elm_layout_text_set(inst->cfg->batman.o_gadget, - "e.text.reading", - _("N/A")); - } - - if ((time_full < 0) && (time_left != inst->cfg->batman.time_left)) - { - _batman_face_time_set(inst->cfg->batman.o_gadget, time_left); - if (inst->popup_battery) - _batman_face_time_set(inst->popup_battery, - time_left); - } - else if ((time_left < 0) && (time_full != inst->cfg->batman.time_full)) - { - _batman_face_time_set(inst->cfg->batman.o_gadget, time_full); - if (inst->popup_battery) - _batman_face_time_set(inst->popup_battery, - time_full); } if (have_battery && (!have_power) && @@ -203,7 +306,6 @@ Ac_Adapter *ac; int full = -1; int time_left = -1; - int time_full = -1; int have_battery = 0; int have_power = 0; int charging = 0; @@ -233,11 +335,6 @@ if (time_left < 0) time_left = bat->time_left; else time_left += bat->time_left; } - if (bat->time_full > 0) - { - if (time_full < 0) time_full = bat->time_full; - else time_full += bat->time_full; - } charging += bat->charging; } @@ -248,12 +345,10 @@ if ((full == 100) && have_power) { time_left = -1; - time_full = -1; } if (time_left < 1) time_left = -1; - if (time_full < 1) time_full = -1; - _batman_update(inst, full, time_left, time_full, have_battery, have_power); + _batman_update(inst, full, time_left, have_battery, have_power); } void @@ -266,9 +361,9 @@ if ((inst->cfg->batman.force_mode == UNKNOWN) || (inst->cfg->batman.force_mode == SUBSYSTEM)) { -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) ok = _batman_udev_start(inst); -#elif defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__ +#elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) ok = _batman_sysctl_start(inst); #else ok = _batman_upower_start(); @@ -312,7 +407,7 @@ inst = (Instance *)data; if ((!inst) || (!inst->warning)) return; - elm_ctxpopup_dismiss(inst->warning); + evas_object_hide(inst->warning); } static void @@ -340,9 +435,16 @@ { Evas_Object *popup_bg = NULL; int x, y, w, h; + char buf[4096]; + int hrs = 0, mins = 0; if ((!inst) || (inst->warning)) return; + hrs = (t / 3600); + mins = ((t) / 60 - (hrs * 60)); + if (mins < 0) mins = 0; + snprintf(buf, 4096, _("AC power is recommended. %i:%02i Remaining"), hrs, mins); + if (inst->cfg->batman.desktop_notifications) { E_Notification_Notify n; @@ -351,7 +453,7 @@ n.replaces_id = 0; n.icon.icon = "battery-low"; n.summary = _("Your battery is low!"); - n.body = _("AC power is recommended."); + n.body = buf; n.timeout = inst->cfg->batman.alert_timeout * 1000; e_notification_client_send(&n, _batman_warning_popup_cb, inst); return; @@ -372,19 +474,18 @@ return; } - e_theme_edje_object_set(popup_bg, "base/theme/modules/battery/popup", - "e/modules/battery/popup"); - e_theme_edje_object_set(inst->popup_battery, "base/theme/modules/battery", - "e/modules/battery/main"); - if (edje_object_part_exists(elm_layout_edje_get(popup_bg), "e.swallow.battery")) - elm_layout_content_set(popup_bg, "e.swallow.battery", inst->popup_battery); + e_theme_edje_object_set(popup_bg, "base/theme/modules/batman/popup", + "e/modules/batman/popup"); + e_theme_edje_object_set(inst->popup_battery, "base/theme/modules/batman", + "e/modules/batman/main"); + if (edje_object_part_exists(elm_layout_edje_get(popup_bg), "e.swallow.batman")) + elm_layout_content_set(popup_bg, "e.swallow.batman", inst->popup_battery); else elm_layout_content_set(popup_bg, "battery", inst->popup_battery); elm_layout_text_set(popup_bg, "e.text.title", _("Your battery is low!")); - elm_layout_text_set(popup_bg, "e.text.label", - _("AC power is recommended.")); + elm_layout_text_set(popup_bg, "e.text.label", buf); evas_object_show(inst->popup_battery); evas_object_show(popup_bg); @@ -397,7 +498,6 @@ evas_object_event_callback_add(inst->warning, EVAS_CALLBACK_MOUSE_DOWN, _batman_cb_warning_popup_hide, inst); - _batman_face_time_set(inst->popup_battery, t); _batman_face_level_set(inst->popup_battery, percent); edje_object_signal_emit(inst->popup_battery, "e,state,discharging", "e"); @@ -405,21 +505,39 @@ (!inst->cfg->batman.alert_timer)) { inst->cfg->batman.alert_timer = - ecore_timer_add(inst->cfg->batman.alert_timeout, + ecore_timer_loop_add(inst->cfg->batman.alert_timeout, _batman_cb_warning_popup_timeout, inst); } } static void +_batman_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Evas_Coord w, h; + Instance *inst = data; + + edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->batman.o_gadget), 0, 0, &w, &h); + if (inst->cfg->esm == E_SYSINFO_MODULE_BATMAN) + evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); + else + evas_object_size_hint_aspect_set(inst->cfg->batman.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); +} + +static void _batman_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data) { Instance *inst = data; if (inst->o_main != event_data) return; - -#ifdef HAVE_EEZE + if (_handler) + ecore_event_handler_del(_handler); + if (inst->cfg->batman.popup) + E_FREE_FUNC(inst->cfg->batman.popup, evas_object_del); + if (inst->cfg->batman.configure) + E_FREE_FUNC(inst->cfg->batman.configure, evas_object_del); +#if defined(HAVE_EEZE) _batman_udev_stop(inst); -#elif defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__ +#elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) _batman_sysctl_stop(); #elif defined(upower) _batman_upower_stop(); @@ -427,7 +545,7 @@ _batman_fallback_stop(); #endif -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) eeze_shutdown(); #endif @@ -442,13 +560,20 @@ { Instance *inst = data; + if (inst->cfg->batman.popup) + E_FREE_FUNC(inst->cfg->batman.popup, evas_object_del); + if (inst->cfg->batman.configure) + E_FREE_FUNC(inst->cfg->batman.configure, evas_object_del); #ifdef HAVE_EEZE _batman_udev_stop(inst); -#elif defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__ +#elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) + (void) inst; _batman_sysctl_stop(); #elif defined(upower) + (void) inst; _batman_upower_stop(); #else + (void) inst; _batman_fallback_stop(); #endif @@ -461,19 +586,32 @@ _batman_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) { Instance *inst = data; + E_Gadget_Site_Orient orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); + + e_gadget_configure_cb_set(inst->o_main, _batman_configure_cb); inst->cfg->batman.full = -2; inst->cfg->batman.time_left = -2; - inst->cfg->batman.time_full = -2; inst->cfg->batman.have_battery = -2; inst->cfg->batman.have_power = -2; inst->cfg->batman.o_gadget = elm_layout_add(inst->o_main); - e_theme_edje_object_set(inst->cfg->batman.o_gadget, "base/theme/modules/battery", - "e/modules/battery/main"); + if (orient == E_GADGET_SITE_ORIENT_VERTICAL) + e_theme_edje_object_set(inst->cfg->batman.o_gadget, + "base/theme/modules/batman", + "e/modules/batman/main_vert"); + else + e_theme_edje_object_set(inst->cfg->batman.o_gadget, "base/theme/modules/batman", + "e/modules/batman/main"); E_EXPAND(inst->cfg->batman.o_gadget); E_FILL(inst->cfg->batman.o_gadget); elm_box_pack_end(inst->o_main, inst->cfg->batman.o_gadget); + evas_object_event_callback_add(inst->cfg->batman.o_gadget, + EVAS_CALLBACK_MOUSE_DOWN, + _batman_mouse_down_cb, inst); + evas_object_event_callback_add(inst->cfg->batman.o_gadget, EVAS_CALLBACK_RESIZE, _batman_resize_cb, inst); + _handler = ecore_event_handler_add(E_EVENT_POWERSAVE_CONFIG_UPDATE, + _powersave_cb_config_update, inst); evas_object_show(inst->cfg->batman.o_gadget); evas_object_smart_callback_del_full(obj, "gadget_created", _batman_created_cb, data); _batman_config_updated(inst); @@ -484,15 +622,20 @@ { inst->cfg->batman.full = -2; inst->cfg->batman.time_left = -2; - inst->cfg->batman.time_full = -2; inst->cfg->batman.have_battery = -2; inst->cfg->batman.have_power = -2; inst->cfg->batman.o_gadget = elm_layout_add(parent); - e_theme_edje_object_set(inst->cfg->batman.o_gadget, "base/theme/modules/battery", - "e/modules/battery/main"); + e_theme_edje_object_set(inst->cfg->batman.o_gadget, "base/theme/modules/batman", + "e/modules/batman/main"); E_EXPAND(inst->cfg->batman.o_gadget); E_FILL(inst->cfg->batman.o_gadget); + evas_object_event_callback_add(inst->cfg->batman.o_gadget, + EVAS_CALLBACK_MOUSE_DOWN, + _batman_mouse_down_cb, inst); + evas_object_event_callback_add(inst->cfg->batman.o_gadget, EVAS_CALLBACK_RESIZE, _batman_resize_cb, inst); + _handler = ecore_event_handler_add(E_EVENT_POWERSAVE_CONFIG_UPDATE, + _powersave_cb_config_update, inst); evas_object_show(inst->cfg->batman.o_gadget); _batman_config_updated(inst); @@ -527,13 +670,13 @@ ci->batman.force_mode = 0; ci->batman.full = -2; ci->batman.time_left = -2; - ci->batman.time_full = -2; ci->batman.have_battery = -2; ci->batman.have_power = -2; #if defined HAVE_EEZE || defined __OpenBSD__ || defined __NetBSD__ ci->batman.fuzzy = 0; #endif ci->batman.desktop_notifications = 0; + ci->batman.configure = NULL; sysinfo_config->items = eina_list_append(sysinfo_config->items, ci); @@ -550,7 +693,7 @@ *id = inst->cfg->id; inst->o_main = elm_box_add(parent); E_EXPAND(inst->o_main); - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + evas_object_data_set(inst->o_main, "Instance", inst); evas_object_smart_callback_add(parent, "gadget_created", _batman_created_cb, inst); evas_object_smart_callback_add(parent, "gadget_removed", _batman_removed_cb, inst); evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_batman_remove, inst); diff -Nru e20-201702271931/src/modules/sysinfo/batman/batman_config.c e20-201702281931/src/modules/sysinfo/batman/batman_config.c --- e20-201702271931/src/modules/sysinfo/batman/batman_config.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/batman/batman_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,595 @@ +#include "batman.h" + +static void +_config_close(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + + E_FREE_FUNC(inst->cfg->batman.configure, evas_object_del); + E_FREE_FUNC(bc, free); + e_config_save_queue(); +} + +static void +_config_show_general(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + + evas_object_hide(bc->power_page); + evas_object_hide(bc->alert_page); + evas_object_show(bc->general_page); +} + +static void +_config_show_alert(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + + evas_object_hide(bc->general_page); + evas_object_hide(bc->power_page); + evas_object_show(bc->alert_page); +} + +static void +_config_show_power(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + + evas_object_hide(bc->general_page); + evas_object_hide(bc->alert_page); + evas_object_show(bc->power_page); +} + +static void +_update_suspend_percent(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + int value = elm_slider_value_get(obj); + + inst->cfg->batman.suspend_below = value; + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_update_alert_time(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + int value = elm_slider_value_get(bc->alert_time); + + inst->cfg->batman.alert = value; + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_update_alert_percent(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + int value = elm_slider_value_get(bc->alert_percent); + + inst->cfg->batman.alert_p = value; + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_update_alert_timeout(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + int value = elm_slider_value_get(bc->alert_timeout); + + inst->cfg->batman.alert_timeout = value; + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_check_desktop_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + + inst->cfg->batman.desktop_notifications = elm_check_state_get(bc->alert_desktop); + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_check_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + + if (!elm_check_state_get(bc->alert_check)) + { + elm_object_disabled_set(bc->alert_time, EINA_TRUE); + elm_object_disabled_set(bc->alert_percent, EINA_TRUE); + elm_object_disabled_set(bc->alert_desktop, EINA_TRUE); + elm_object_disabled_set(bc->alert_timeout, EINA_TRUE); + elm_slider_value_set(bc->alert_time, 0); + elm_slider_value_set(bc->alert_percent, 0); + _update_alert_time(bc, NULL, NULL); + _update_alert_percent(bc, NULL, NULL); + } + else + { + elm_object_disabled_set(bc->alert_time, EINA_FALSE); + elm_object_disabled_set(bc->alert_percent, EINA_FALSE); + elm_object_disabled_set(bc->alert_desktop, EINA_FALSE); + elm_object_disabled_set(bc->alert_timeout, EINA_FALSE); + } + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_suspend_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + int value = elm_radio_value_get(obj); + + switch (value) + { + case 0: + inst->cfg->batman.suspend_method = SUSPEND; + break; + case 1: + inst->cfg->batman.suspend_method = HIBERNATE; + break; + case 2: + inst->cfg->batman.suspend_method = SHUTDOWN; + break; + default: + inst->cfg->batman.suspend_method = SUSPEND; + } + + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_poll_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Batman_Config *bc = data; + Instance *inst = bc->inst; + int value = elm_radio_value_get(obj); + + switch (value) + { + case 0: + inst->cfg->batman.poll_interval = 4; + break; + case 1: + inst->cfg->batman.poll_interval = 8; + break; + case 2: + inst->cfg->batman.poll_interval = 32; + break; + case 3: + inst->cfg->batman.poll_interval = 64; + break; + case 4: + inst->cfg->batman.poll_interval = 256; + break; + default: + inst->cfg->batman.poll_interval = 32; + } + + e_config_save_queue(); + _batman_config_updated(inst); +} + +static void +_power_management_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Evas_Object *popup = data; + + evas_object_del(popup); + e_configure_registry_call("advanced/powermanagement", NULL, NULL); +} + +static void +_icon_theme_file_set(Evas_Object *img, const char *icon) +{ + const char *path = NULL, *k = NULL; + char buf[4096]; + int len = 0; + + if (!icon) + path = NULL; + else if (strncmp(icon, "/", 1) && !ecore_file_exists(icon)) + { + path = efreet_icon_path_find(e_config->icon_theme, icon, 48); + if (!path) + { + if (e_util_strcmp(e_config->icon_theme, "hicolor")) + path = efreet_icon_path_find("hicolor", icon, 48); + } + } + else if (ecore_file_exists(icon)) + { + path = icon; + } + if (!path && icon) + { + snprintf(buf, sizeof(buf), "e/icons/%s", icon); + if (eina_list_count(e_theme_collection_items_find("base/theme/icons", buf))) + { + path = e_theme_edje_file_get("base/theme/icons", buf); + k = buf; + } + else + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + } + else if (!path && !icon) + { + path = e_theme_edje_file_get("base/theme/icons", "e/icons/unknown"); + k = "e/icons/unknown"; + } + + if (path && icon) + { + len = strlen(icon); + if ((len > 4) && (!strcasecmp(icon + len - 4, ".edj"))) + k = "icon"; + } + elm_image_file_set(img, path, k); +} + +Evas_Object * +batman_configure(Instance *inst) +{ + Evas_Object *popup, *tb, *list, *frame, *box, *o, *group, *groupy, *lbl; + Evas_Object *slider, *check, *but, *img; + Elm_Object_Item *it; + Eina_Bool show_alert; + E_Zone *zone = e_zone_current_get(); + Batman_Config *bc = E_NEW(Batman_Config, 1); + + bc->inst = inst; + + if (inst->cfg->batman.alert > 0 || inst->cfg->batman.alert_p > 0) + show_alert = EINA_TRUE; + else + show_alert = EINA_FALSE; + + popup = elm_popup_add(e_comp->elm); + E_EXPAND(popup); + elm_popup_allow_events_set(popup, 1); + elm_popup_scrollable_set(popup, 1); + + tb = elm_table_add(popup); + E_EXPAND(tb); + evas_object_show(tb); + elm_object_content_set(popup, tb); + + lbl = elm_label_add(tb); + evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_style_set(lbl, "marker"); + elm_object_text_set(lbl, _("Batman Configuration")); + elm_table_pack(tb, lbl, 0, 0, 2, 1); + evas_object_show(lbl); + + list = elm_list_add(tb); + E_ALIGN(list, 0, EVAS_HINT_FILL); + E_WEIGHT(list, 0, EVAS_HINT_EXPAND); + elm_table_pack(tb, list, 0, 1, 1, 1); + elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_scroller_content_min_limit(list, 1, 1); + it = elm_list_item_append(list, _("General"), NULL, NULL, + _config_show_general, bc); + elm_list_item_selected_set(it, 1); + it = elm_list_item_append(list, _("Alert"), NULL, NULL, + _config_show_alert, bc); + it = elm_list_item_append(list, _("Power"), NULL, NULL, + _config_show_power, bc); + elm_list_go(list); + evas_object_show(list); + + frame = elm_frame_add(tb); + elm_object_text_set(frame, _("General")); + E_EXPAND(frame); + E_FILL(frame); + elm_table_pack(tb, frame, 1, 1, 1, 1); + evas_object_show(frame); + bc->general_page = frame; + + box = elm_box_add(frame); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + lbl = elm_label_add(box); + elm_object_text_set(lbl, _("Update Poll Interval:")); + E_ALIGN(lbl, 0.0, 0.0); + E_WEIGHT(lbl, EVAS_HINT_EXPAND, 0); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 0); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Fast (4 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, bc); + evas_object_show(o); + group = o; + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 1); + elm_radio_group_add(o, group); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Medium (8 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, bc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 2); + elm_radio_group_add(o, group); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Normal (32 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, bc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 3); + elm_radio_group_add(o, group); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Slow (64 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, bc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 4); + elm_radio_group_add(o, group); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Very Slow (256 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, bc); + evas_object_show(o); + + switch(inst->cfg->batman.poll_interval) + { + case 4: + elm_radio_value_set(group, 0); + break; + case 8: + elm_radio_value_set(group, 1); + break; + case 32: + elm_radio_value_set(group, 2); + break; + case 64: + elm_radio_value_set(group, 3); + break; + case 256: + elm_radio_value_set(group, 4); + break; + default: + elm_radio_value_set(group, 2); + } + + elm_object_content_set(frame, box); + + frame = elm_frame_add(tb); + elm_object_text_set(frame, _("Alert")); + E_EXPAND(frame); + E_FILL(frame); + elm_table_pack(tb, frame, 1, 1, 1, 1); + evas_object_show(frame); + bc->alert_page = frame; + + box = elm_box_add(frame); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + check = elm_check_add(box); + elm_object_text_set(check, _("Show low battery alert")); + elm_check_state_set(check, show_alert); + E_ALIGN(check, 0.0, 0.0); + E_WEIGHT(check, EVAS_HINT_EXPAND, 0); + evas_object_smart_callback_add(check, "changed", _check_changed, bc); + elm_box_pack_end(box, check); + evas_object_show(check); + bc->alert_check = check; + + check = elm_check_add(box); + elm_object_text_set(check, _("Show alert as a desktop notification")); + elm_check_state_set(check, inst->cfg->batman.desktop_notifications); + E_ALIGN(check, 0.0, 0.0); + E_WEIGHT(check, EVAS_HINT_EXPAND, 0); + evas_object_smart_callback_add(check, "changed", _check_desktop_changed, bc); + elm_object_disabled_set(check, !show_alert); + elm_box_pack_end(box, check); + evas_object_show(check); + bc->alert_desktop = check; + + lbl = elm_label_add(box); + elm_object_text_set(lbl, _("Alert when time left is at:")); + E_ALIGN(lbl, 0.0, 0.0); + E_WEIGHT(lbl, EVAS_HINT_EXPAND, 0); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + slider = elm_slider_add(box); + elm_slider_unit_format_set(slider, "%1.0f min"); + elm_slider_indicator_format_set(slider, "%1.0f min"); + elm_slider_min_max_set(slider, 0, 60); + elm_slider_value_set(slider, inst->cfg->batman.alert); + elm_slider_step_set(slider, 1); + elm_slider_span_size_set(slider, 100); + E_ALIGN(slider, 0.0, 0.0); + E_WEIGHT(slider, EVAS_HINT_EXPAND, 0); + evas_object_smart_callback_add(slider, "delay,changed", _update_alert_time, bc); + elm_object_disabled_set(slider, !show_alert); + elm_box_pack_end(box, slider); + evas_object_show(slider); + bc->alert_time = slider; + + lbl = elm_label_add(box); + elm_object_text_set(lbl, _("Alert when percent left is at:")); + E_ALIGN(lbl, 0.0, 0.0); + E_WEIGHT(lbl, EVAS_HINT_EXPAND, 0); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + slider = elm_slider_add(box); + elm_slider_unit_format_set(slider, "%1.0f %%"); + elm_slider_indicator_format_set(slider, "%1.0f %%"); + elm_slider_min_max_set(slider, 0, 100); + elm_slider_value_set(slider, inst->cfg->batman.alert_p); + elm_slider_step_set(slider, 1); + elm_slider_span_size_set(slider, 100); + E_ALIGN(slider, 0.0, 0.0); + E_WEIGHT(slider, EVAS_HINT_EXPAND, 0); + evas_object_smart_callback_add(slider, "delay,changed", _update_alert_percent, bc); + elm_object_disabled_set(slider, !show_alert); + elm_box_pack_end(box, slider); + evas_object_show(slider); + bc->alert_percent = slider; + + lbl = elm_label_add(box); + elm_object_text_set(lbl, _("Alert timeout:")); + E_ALIGN(lbl, 0.0, 0.0); + E_WEIGHT(lbl, EVAS_HINT_EXPAND, 0); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + slider = elm_slider_add(box); + elm_slider_unit_format_set(slider, "%1.0f s"); + elm_slider_indicator_format_set(slider, "%1.0f s"); + elm_slider_min_max_set(slider, 1, 300); + elm_slider_value_set(slider, inst->cfg->batman.alert_timeout); + elm_slider_step_set(slider, 1); + elm_slider_span_size_set(slider, 100); + E_ALIGN(slider, 0.0, 0.0); + E_WEIGHT(slider, EVAS_HINT_EXPAND, 0); + evas_object_smart_callback_add(slider, "delay,changed", _update_alert_timeout, bc); + elm_box_pack_end(box, slider); + evas_object_show(slider); + bc->alert_timeout = slider; + + elm_object_content_set(frame, box); + + frame = elm_frame_add(tb); + elm_object_text_set(frame, _("Power Management")); + E_EXPAND(frame); + E_FILL(frame); + elm_table_pack(tb, frame, 1, 1, 1, 1); + evas_object_show(frame); + bc->power_page = frame; + + box = elm_box_add(frame); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 0); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Suspend when below:")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _suspend_changed, bc); + evas_object_show(o); + groupy = o; + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 1); + elm_radio_group_add(o, groupy); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Hibernate when below:")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _suspend_changed, bc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 2); + elm_radio_group_add(o, groupy); + E_ALIGN(o, 0.0, 0.0); + E_WEIGHT(o, EVAS_HINT_EXPAND, 0); + elm_object_text_set(o, _("Shutdown when below:")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _suspend_changed, bc); + evas_object_show(o); + + switch(inst->cfg->batman.suspend_method) + { + case SUSPEND: + elm_radio_value_set(groupy, 0); + break; + case HIBERNATE: + elm_radio_value_set(groupy, 1); + break; + case SHUTDOWN: + elm_radio_value_set(groupy, 2); + break; + default: + elm_radio_value_set(groupy, 0); + } + + slider = elm_slider_add(box); + elm_slider_unit_format_set(slider, "%1.0f %%"); + elm_slider_indicator_format_set(slider, "%1.0f %%"); + elm_slider_min_max_set(slider, 0, 100); + elm_slider_value_set(slider, inst->cfg->batman.suspend_below); + elm_slider_step_set(slider, 1); + elm_slider_span_size_set(slider, 100); + E_ALIGN(slider, 0.0, 0.0); + E_WEIGHT(slider, EVAS_HINT_EXPAND, 0); + evas_object_smart_callback_add(slider, "delay,changed", _update_suspend_percent, bc); + elm_box_pack_end(box, slider); + evas_object_show(slider); + + img = elm_icon_add(box); + evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + _icon_theme_file_set(img, "preferences-system-power-management"); + evas_object_show(img); + + but = elm_button_add(box); + elm_object_part_content_set(but, "icon", img); + elm_object_text_set(but, _("Power Management Timing")); + E_ALIGN(but, 0.0, 0.0); + E_WEIGHT(but, EVAS_HINT_EXPAND, 0); + E_FILL(but); + evas_object_data_set(but, "popup", popup); + evas_object_smart_callback_add(but, "clicked", _power_management_cb, popup); + elm_box_pack_end(box, but); + evas_object_show(but); + + elm_object_content_set(frame, box); + + _config_show_general(bc, NULL, NULL); + + popup = e_comp_object_util_add(popup, E_COMP_OBJECT_TYPE_NONE); + evas_object_layer_set(popup, E_LAYER_POPUP); + evas_object_resize(popup, zone->w / 4, zone->h / 3); + e_comp_object_util_center_on_zone(popup, zone); + evas_object_show(popup); + e_comp_object_util_autoclose(popup, NULL, e_comp_object_util_autoclose_on_escape, NULL); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _config_close, bc); + + return inst->cfg->batman.configure = popup; +} + diff -Nru e20-201702271931/src/modules/sysinfo/batman/batman_fallback.c e20-201702281931/src/modules/sysinfo/batman/batman_fallback.c --- e20-201702271931/src/modules/sysinfo/batman/batman_fallback.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/batman/batman_fallback.c 2017-02-28 19:31:37.000000000 +0000 @@ -323,12 +323,12 @@ free(sysev); if (re_init_timer) ecore_timer_del(re_init_timer); - re_init_timer = ecore_timer_add(1.0, linux_sys_class_power_supply_cb_re_init, NULL); + re_init_timer = ecore_timer_loop_add(1.0, linux_sys_class_power_supply_cb_re_init, NULL); } else { if (sys_class_delay_check) ecore_timer_del(sys_class_delay_check); - sys_class_delay_check = ecore_timer_add(0.2, linux_sys_class_power_supply_cb_delay_check, NULL); + sys_class_delay_check = ecore_timer_loop_add(0.2, linux_sys_class_power_supply_cb_delay_check, NULL); } } return ECORE_CALLBACK_CANCEL; @@ -750,7 +750,7 @@ void *event EINA_UNUSED) { if (delay_check) ecore_timer_del(delay_check); - delay_check = ecore_timer_add(0.2, linux_acpi_cb_delay_check, NULL); + delay_check = ecore_timer_loop_add(0.2, linux_acpi_cb_delay_check, NULL); return ECORE_CALLBACK_PASS_ON; } @@ -786,7 +786,7 @@ else { if (delay_check) ecore_timer_del(delay_check); - delay_check = ecore_timer_add(0.2, linux_acpi_cb_delay_check, NULL); + delay_check = ecore_timer_loop_add(0.2, linux_acpi_cb_delay_check, NULL); } } return ECORE_CALLBACK_RENEW; @@ -1235,7 +1235,7 @@ } #endif - _batman_update(inst, battery_full, time_left, time_left, have_battery, have_power); + _batman_update(inst, battery_full, time_left, have_battery, have_power); return EINA_TRUE; } diff -Nru e20-201702271931/src/modules/sysinfo/batman/batman.h e20-201702281931/src/modules/sysinfo/batman/batman.h --- e20-201702271931/src/modules/sysinfo/batman/batman.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/batman/batman.h 2017-02-28 19:31:37.000000000 +0000 @@ -21,7 +21,7 @@ typedef struct _Battery Battery; typedef struct _Ac_Adapter Ac_Adapter; -typedef struct _Battery_Config Battery_Config; +typedef struct _Batman_Config Batman_Config; struct _Battery { @@ -77,9 +77,22 @@ int * mib; }; +struct _Batman_Config +{ + Instance *inst; + Evas_Object *alert_check; + Evas_Object *alert_desktop; + Evas_Object *alert_time; + Evas_Object *alert_percent; + Evas_Object *alert_timeout; + Evas_Object *general_page; + Evas_Object *alert_page; + Evas_Object *power_page; +}; + Eina_List *_batman_battery_find(const char *udi); Eina_List *_batman_ac_adapter_find(const char *udi); -void _batman_update(Instance *inst, int full, int time_left, int time_full, Eina_Bool have_battery, Eina_Bool have_power); +void _batman_update(Instance *inst, int full, int time_left, Eina_Bool have_battery, Eina_Bool have_power); void _batman_device_update(Instance *inst); /* in batman_fallback.c */ int _batman_fallback_start(Instance *inst); @@ -102,6 +115,7 @@ /* end batman_sysctl.c */ #endif +Evas_Object *batman_configure(Instance *inst); void _batman_config_updated(Instance *inst); #endif diff -Nru e20-201702271931/src/modules/sysinfo/batman/batman_sysctl.c e20-201702281931/src/modules/sysinfo/batman/batman_sysctl.c --- e20-201702271931/src/modules/sysinfo/batman/batman_sysctl.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/batman/batman_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -10,7 +10,7 @@ #include "batman.h" #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -static Eina_Bool _batman_sysctl_battery_update_poll(void *data); +static Eina_Bool _batman_sysctl_battery_update_poll(void *data EINA_UNUSED); #endif static int _batman_sysctl_battery_update(Instance *inst); @@ -18,8 +18,8 @@ extern Eina_List *batman_device_ac_adapters; extern double batman_init_time; -Ac_Adapter *ac = NULL; -Battery *bat = NULL; +static Ac_Adapter *ac = NULL; +static Battery *bat = NULL; int _batman_sysctl_start(Instance *inst) @@ -163,7 +163,7 @@ #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) static Eina_Bool -_batman_sysctl_battery_update_poll(void *data) +_batman_sysctl_battery_update_poll(void *data EINA_UNUSED) { Instance *inst = data; _batman_sysctl_battery_update(inst); @@ -207,7 +207,7 @@ } /* This is a workaround because there's an ACPI bug */ - if (charge == 0 || bat->last_full_charge == 0) + if ((EINA_FLT_EQ(charge, 0.0)) || (EINA_FLT_EQ(bat->last_full_charge, 0.0))) { /* last full capacity */ bat->mib[3] = 8; @@ -225,9 +225,11 @@ charge = (double)s.value; } } + + bat->got_prop = 1; _time = ecore_time_get(); - if ((bat->got_prop) && (charge != bat->current_charge)) + if ((bat->got_prop) && (!EINA_FLT_EQ(charge, bat->current_charge))) bat->charge_rate = ((charge - bat->current_charge) / (_time - bat->last_update)); bat->last_update = _time; bat->current_charge = charge; @@ -340,7 +342,7 @@ _batman_device_update(bat->inst); bat->got_prop = 1; } - return 0; + return 1; } diff -Nru e20-201702271931/src/modules/sysinfo/cpuclock/cpuclock.c e20-201702281931/src/modules/sysinfo/cpuclock/cpuclock.c --- e20-201702271931/src/modules/sysinfo/cpuclock/cpuclock.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpuclock/cpuclock.c 2017-02-28 19:31:37.000000000 +0000 @@ -78,11 +78,12 @@ { const char *freq = data; -#if defined __FreeBSD__ || defined __OpenBSD__ - _cpuclock_sysctl_frequency(freq); - return; -#endif +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined (__OpenBSD__) + int frequency = atoi(freq); + _cpuclock_sysctl_frequency(frequency); +#else _cpuclock_sysfs_setall("scaling_setspeed", freq); +#endif } static void @@ -322,8 +323,10 @@ static void _cpuclock_status_check_available(Cpu_Status *s) { +#if !defined(__OpenBSD__) char buf[4096]; Eina_List *l; +#endif // FIXME: this assumes all cores accept the same freqs/ might be wrong #if defined (__OpenBSD__) @@ -337,13 +340,13 @@ /* storing percents */ p = 100; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); p = 75; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); p = 50; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); p = 25; - s->frequencies = eina_list_append(s->frequencies, (void *)p); + s->frequencies = eina_list_append(s->frequencies, (void *)(long int)p); #elif defined (__FreeBSD__) int freq; size_t len = sizeof(buf); @@ -680,6 +683,19 @@ } static void +_cpuclock_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Evas_Coord w, h; + Instance *inst = data; + + edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->cpuclock.o_gadget), 0, 0, &w, &h); + if (inst->cfg->esm == E_SYSINFO_MODULE_CPUCLOCK) + evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); + else + evas_object_size_hint_aspect_set(inst->cfg->cpuclock.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); +} + +static void _cpuclock_cb_frequency_check_main(void *data, Ecore_Thread *th) { Thread_Config *thc = data; @@ -696,7 +712,6 @@ if (ecore_thread_check(th)) break; usleep((1000000.0 / 8.0) * (double)thc->interval); } - E_FREE_FUNC(thc, free); } static void @@ -722,7 +737,7 @@ (status->cur_max_frequency != inst->cfg->cpuclock.status->cur_max_frequency) || (status->can_set_frequency != inst->cfg->cpuclock.status->can_set_frequency))) freq_changed = EINA_TRUE; - _cpuclock_status_free(inst->cfg->cpuclock.status); + E_FREE_FUNC(inst->cfg->cpuclock.status, _cpuclock_status_free); inst->cfg->cpuclock.status = status; if (freq_changed) { @@ -737,6 +752,13 @@ inst->cfg->cpuclock.pstate_max - 1, inst->cfg->cpuclock.status->pstate_turbo); } +static void +_cpuclock_cb_frequency_check_end(void *data, Ecore_Thread *th EINA_UNUSED) +{ + Thread_Config *thc = data; + E_FREE_FUNC(thc, free); +} + void _cpuclock_poll_interval_update(Instance *inst) { @@ -755,7 +777,8 @@ inst->cfg->cpuclock.frequency_check_thread = ecore_thread_feedback_run(_cpuclock_cb_frequency_check_main, _cpuclock_cb_frequency_check_notify, - NULL, NULL, thc, EINA_TRUE); + _cpuclock_cb_frequency_check_end, + _cpuclock_cb_frequency_check_end, thc, EINA_TRUE); } e_config_save_queue(); } @@ -778,7 +801,7 @@ if (inst->cfg->cpuclock.governor) eina_stringshare_del(inst->cfg->cpuclock.governor); - if (inst->cfg->cpuclock.status) _cpuclock_status_free(inst->cfg->cpuclock.status); + E_FREE_FUNC(inst->cfg->cpuclock.status, _cpuclock_status_free); evas_object_event_callback_del_full(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_cpuclock_remove, data); @@ -802,20 +825,26 @@ if (inst->cfg->cpuclock.governor) eina_stringshare_del(inst->cfg->cpuclock.governor); - if (inst->cfg->cpuclock.status) _cpuclock_status_free(inst->cfg->cpuclock.status); + E_FREE_FUNC(inst->cfg->cpuclock.status, _cpuclock_status_free); } static void _cpuclock_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) { Instance *inst = data; + E_Gadget_Site_Orient orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); if (inst->cfg->cpuclock.pstate_min == 0) inst->cfg->cpuclock.pstate_min = 1; if (inst->cfg->cpuclock.pstate_max == 0) inst->cfg->cpuclock.pstate_max = 101; inst->cfg->cpuclock.o_gadget = elm_layout_add(inst->o_main); - e_theme_edje_object_set(inst->cfg->cpuclock.o_gadget, "base/theme/modules/cpufreq", - "e/modules/cpufreq/main"); + if (orient == E_GADGET_SITE_ORIENT_VERTICAL) + e_theme_edje_object_set(inst->cfg->cpuclock.o_gadget, + "base/theme/modules/cpuclock", + "e/modules/cpuclock/main_vert"); + else + e_theme_edje_object_set(inst->cfg->cpuclock.o_gadget, "base/theme/modules/cpuclock", + "e/modules/cpuclock/main"); E_EXPAND(inst->cfg->cpuclock.o_gadget); E_FILL(inst->cfg->cpuclock.o_gadget); edje_object_signal_callback_add(elm_layout_edje_get(inst->cfg->cpuclock.o_gadget), "e,action,governor,next", "*", @@ -824,13 +853,14 @@ _cpuclock_face_cb_set_frequency, inst); edje_object_signal_callback_add(elm_layout_edje_get(inst->cfg->cpuclock.o_gadget), "e,action,frequency,decrease", "*", _cpuclock_face_cb_set_frequency, inst); + evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget, EVAS_CALLBACK_RESIZE, _cpuclock_resize_cb, inst); elm_box_pack_end(inst->o_main, inst->cfg->cpuclock.o_gadget); evas_object_show(inst->cfg->cpuclock.o_gadget); evas_object_smart_callback_del_full(obj, "gadget_created", _cpuclock_created_cb, data); inst->cfg->cpuclock.status = _cpuclock_status_new(); _cpuclock_status_check_available(inst->cfg->cpuclock.status); _cpuclock_poll_interval_update(inst); - inst->cfg->cpuclock.handler = ecore_event_handler_add(E_EVENT_POWERSAVE_UPDATE, + inst->cfg->cpuclock.handler = ecore_event_handler_add(E_EVENT_POWERSAVE_UPDATE, _cpuclock_event_cb_powersave, inst); _cpuclock_config_updated(inst); } @@ -852,6 +882,7 @@ _cpuclock_face_cb_set_frequency, inst); edje_object_signal_callback_add(elm_layout_edje_get(inst->cfg->cpuclock.o_gadget), "e,action,frequency,decrease", "*", _cpuclock_face_cb_set_frequency, inst); + evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget, EVAS_CALLBACK_RESIZE, _cpuclock_resize_cb, inst); evas_object_show(inst->cfg->cpuclock.o_gadget); inst->cfg->cpuclock.status = _cpuclock_status_new(); _cpuclock_status_check_available(inst->cfg->cpuclock.status); @@ -906,7 +937,6 @@ *id = inst->cfg->id; inst->o_main = elm_box_add(parent); E_EXPAND(inst->o_main); - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_smart_callback_add(parent, "gadget_created", _cpuclock_created_cb, inst); evas_object_smart_callback_add(parent, "gadget_removed", _cpuclock_removed_cb, inst); evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_cpuclock_remove, inst); diff -Nru e20-201702271931/src/modules/sysinfo/cpuclock/cpuclock_sysctl.c e20-201702281931/src/modules/sysinfo/cpuclock/cpuclock_sysctl.c --- e20-201702271931/src/modules/sysinfo/cpuclock/cpuclock_sysctl.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpuclock/cpuclock_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,16 +1,16 @@ #include "cpuclock.h" -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) # include #endif -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) # include # include # include #endif -#if defined __OpenBSD__ +#if defined(__OpenBSD__) int _cpuclock_sysctl_frequency(int new_perf) { @@ -19,16 +19,16 @@ if (sysctl(mib, 2, NULL, 0, &new_perf, len) == -1) return 1; - else - return 0; + + return 0; } -#elif defined __FreeBSD__ +#elif defined(__FreeBSD__) || defined(__DragonFly__) int _cpuclock_sysctl_frequency(int new_perf) { if (sysctlbyname("dev.cpu.0.freq", NULL, NULL, &new_perf, sizeof(new_perf)) == -1) return 1; - else - return 0; + + return 0; } #endif diff -Nru e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor.c e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor.c --- e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor.c 2017-02-28 19:31:37.000000000 +0000 @@ -26,6 +26,131 @@ usage_msg); free(usage_msg); } + if (inst->cfg->cpumonitor.popup) + { + elm_progressbar_value_set(inst->cfg->cpumonitor.popup_pbar, + (float)inst->cfg->cpumonitor.percent / 100); + } +} + +static Evas_Object * +_cpumonitor_configure_cb(Evas_Object *g) +{ + Instance *inst = evas_object_data_get(g, "Instance"); + + if (!sysinfo_config) return NULL; + if (inst->cfg->cpumonitor.popup) return NULL; + return cpumonitor_configure(inst); +} + +static void +_cpumonitor_popup_dismissed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + E_FREE_FUNC(obj, evas_object_del); + inst->cfg->cpumonitor.popup = NULL; +} + +static void +_cpumonitor_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + inst->cfg->cpumonitor.popup = NULL; +} + +static void +_cpumonitor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data) +{ + Evas_Object *popup, *box, *pbar, *label; + Evas_Event_Mouse_Down *ev = event_data; + Instance *inst = data; + char text[256]; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (ev->button != 3) + { + if (inst->cfg->cpumonitor.popup) + { + elm_ctxpopup_dismiss(inst->cfg->cpumonitor.popup); + return; + } + popup = elm_ctxpopup_add(e_comp->elm); + elm_object_style_set(popup, "noblock"); + evas_object_smart_callback_add(popup, "dismissed", _cpumonitor_popup_dismissed, inst); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _cpumonitor_popup_deleted, inst); + + box = elm_box_add(popup); + E_EXPAND(box); E_FILL(box); + elm_object_content_set(popup, box); + evas_object_show(box); + + snprintf(text, sizeof(text), "%s", _("Total CPU Usage")); + label = elm_label_add(box); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, text); + elm_box_pack_end(box, label); + evas_object_show(label); + + pbar = elm_progressbar_add(box); + E_EXPAND(pbar); E_FILL(pbar); + elm_progressbar_span_size_set(pbar, 200 * e_scale); + elm_progressbar_value_set(pbar, (float)inst->cfg->cpumonitor.percent / 100); + elm_box_pack_end(box, pbar); + evas_object_show(pbar); + inst->cfg->cpumonitor.popup_pbar = pbar; + + e_gadget_util_ctxpopup_place(inst->o_main, popup, + inst->cfg->cpumonitor.o_gadget); + evas_object_show(popup); + inst->cfg->cpumonitor.popup = popup; + } + else + { + if (inst->cfg->cpumonitor.popup) + elm_ctxpopup_dismiss(inst->cfg->cpumonitor.popup); + if (!sysinfo_config) return; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (inst->cfg->esm != E_SYSINFO_MODULE_CPUMONITOR) + cpumonitor_configure(inst); + else + e_gadget_configure(inst->o_main); + } +} + +static void +_cpumonitor_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_data EINA_UNUSED) +{ + Evas_Coord w = 1, h = 1, sw, sh; + Instance *inst = data; + int num_cores = eina_list_count(inst->cfg->cpumonitor.cores); + + if (!num_cores || !inst->o_main) return; + + edje_object_parts_extends_calc(elm_layout_edje_get(obj), 0, 0, &w, &h); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst); + if (inst->cfg->esm == E_SYSINFO_MODULE_CPUMONITOR) + { + evas_object_geometry_get(inst->o_main, 0, 0, &sw, &sh); + } + else + { + sw = w; + sh = h; + } + if (e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)) == E_GADGET_SITE_ORIENT_VERTICAL) + { + w = sw; + h *= num_cores; + } + else + { + w *= num_cores; + h = sh; + } + if (inst->cfg->esm == E_SYSINFO_MODULE_CPUMONITOR) + evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); + else + evas_object_size_hint_aspect_set(inst->cfg->cpumonitor.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); } static void @@ -35,7 +160,11 @@ for (;;) { if (ecore_thread_check(th)) break; +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) + _cpumonitor_sysctl_getusage(thc->inst); +#else _cpumonitor_proc_getusage(thc->inst); +#endif ecore_thread_feedback(th, NULL); if (ecore_thread_check(th)) break; usleep((1000000.0 / 8.0) * (double)thc->interval); @@ -63,7 +192,8 @@ Evas_Object *layout; int orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); - layout = elm_layout_add(inst->cfg->cpumonitor.o_gadget); + layout = elm_layout_add(inst->cfg->cpumonitor.o_gadget_box); + edje_object_update_hints_set(elm_layout_edje_get(layout), EINA_TRUE); if (orient == E_GADGET_SITE_ORIENT_VERTICAL) e_theme_edje_object_set(layout, "base/theme/modules/cpumonitor", "e/modules/cpumonitor/main_vert"); @@ -72,7 +202,7 @@ "e/modules/cpumonitor/main"); E_EXPAND(layout); E_FILL(layout); - elm_box_pack_end(inst->cfg->cpumonitor.o_gadget, layout); + elm_box_pack_end(inst->cfg->cpumonitor.o_gadget_box, layout); evas_object_show(layout); return layout; @@ -100,11 +230,17 @@ { thc->inst = inst; thc->interval = inst->cfg->cpumonitor.poll_interval; +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) + thc->cores = _cpumonitor_sysctl_getcores(); +#else thc->cores = _cpumonitor_proc_getcores(); +#endif for (i = 0; i < thc->cores; i++) { core = E_NEW(CPU_Core, 1); core->layout = _cpumonitor_add_layout(inst); + if (i == 0) + evas_object_event_callback_add(core->layout, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst); core->percent = 0; core->total = 0; core->idle = 0; @@ -126,6 +262,10 @@ if (inst->o_main != event_data) return; + if (inst->cfg->cpumonitor.popup) + E_FREE_FUNC(inst->cfg->cpumonitor.popup, evas_object_del); + if (inst->cfg->cpumonitor.configure) + E_FREE_FUNC(inst->cfg->cpumonitor.configure, evas_object_del); if (inst->cfg->cpumonitor.usage_check_thread) { ecore_thread_cancel(inst->cfg->cpumonitor.usage_check_thread); @@ -148,6 +288,10 @@ Instance *inst = data; CPU_Core *core; + if (inst->cfg->cpumonitor.popup) + E_FREE_FUNC(inst->cfg->cpumonitor.popup, evas_object_del); + if (inst->cfg->cpumonitor.configure) + E_FREE_FUNC(inst->cfg->cpumonitor.configure, evas_object_del); if (inst->cfg->cpumonitor.usage_check_thread) { ecore_thread_cancel(inst->cfg->cpumonitor.usage_check_thread); @@ -161,81 +305,68 @@ } static void -_cpumonitor_eval_instance_aspect(Instance *inst) -{ - Evas_Coord w, h; - Evas_Coord sw = 1, sh = 1; - Evas_Object *owner, *ed; - CPU_Core *first_core; - int num_cores = eina_list_count(inst->cfg->cpumonitor.cores); - - if (num_cores < 1) - return; - - if (!inst->o_main) - return; - - owner = e_gadget_site_get(inst->o_main); - if (!owner) - return; - - switch (e_gadget_site_orient_get(owner)) - { - case E_GADGET_SITE_ORIENT_HORIZONTAL: - case E_GADGET_SITE_ORIENT_NONE: - evas_object_geometry_get(owner, NULL, NULL, NULL, &sh); - break; - - case E_GADGET_SITE_ORIENT_VERTICAL: - evas_object_geometry_get(owner, NULL, NULL, &sw, NULL); - break; - - default: - sw = sh = 48; - break; - } - - first_core = eina_list_nth(inst->cfg->cpumonitor.cores, 0); - evas_object_resize(first_core->layout, sw, sh); - ed = elm_layout_edje_get(first_core->layout); - edje_object_parts_extends_calc(ed, NULL, NULL, &w, &h); - if (e_gadget_site_orient_get(owner) == E_GADGET_SITE_ORIENT_VERTICAL) - h *= num_cores; - else - w *= num_cores; - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); -} - -static void _cpumonitor_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) { Instance *inst = data; int orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); - inst->cfg->cpumonitor.o_gadget = elm_box_add(inst->o_main); - if (orient == E_GADGET_SITE_ORIENT_VERTICAL) - elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget, EINA_FALSE); - else - elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget, EINA_TRUE); + e_gadget_configure_cb_set(inst->o_main, _cpumonitor_configure_cb); + + inst->cfg->cpumonitor.o_gadget = elm_table_add(inst->o_main); E_EXPAND(inst->cfg->cpumonitor.o_gadget); E_FILL(inst->cfg->cpumonitor.o_gadget); elm_box_pack_end(inst->o_main, inst->cfg->cpumonitor.o_gadget); evas_object_show(inst->cfg->cpumonitor.o_gadget); + + inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget); + elm_box_homogeneous_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE); + if (orient == E_GADGET_SITE_ORIENT_VERTICAL) + elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_FALSE); + else + elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE); + E_EXPAND(inst->cfg->cpumonitor.o_gadget_box); + E_FILL(inst->cfg->cpumonitor.o_gadget_box); + elm_table_pack(inst->cfg->cpumonitor.o_gadget, inst->cfg->cpumonitor.o_gadget_box, 0, 0, 1, 1); + evas_object_show(inst->cfg->cpumonitor.o_gadget_box); + + inst->cfg->cpumonitor.event = evas_object_rectangle_add(inst->cfg->cpumonitor.o_gadget); + evas_object_color_set(inst->cfg->cpumonitor.event, 0, 0, 0, 0); + E_EXPAND(inst->cfg->cpumonitor.event); + E_FILL(inst->cfg->cpumonitor.event); + evas_object_event_callback_add(inst->cfg->cpumonitor.event, EVAS_CALLBACK_MOUSE_DOWN, _cpumonitor_mouse_down_cb, inst); + elm_table_pack(inst->cfg->cpumonitor.o_gadget, inst->cfg->cpumonitor.event, 0, 0, 1, 1); + evas_object_show(inst->cfg->cpumonitor.event); + evas_object_smart_callback_del_full(obj, "gadget_created", _cpumonitor_created_cb, data); _cpumonitor_config_updated(inst); - _cpumonitor_eval_instance_aspect(inst); } Evas_Object * sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst) { - inst->cfg->cpumonitor.o_gadget = elm_box_add(parent); - elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget, EINA_TRUE); + inst->cfg->cpumonitor.o_gadget = elm_table_add(parent); E_EXPAND(inst->cfg->cpumonitor.o_gadget); E_FILL(inst->cfg->cpumonitor.o_gadget); + elm_box_pack_end(inst->o_main, inst->cfg->cpumonitor.o_gadget); evas_object_show(inst->cfg->cpumonitor.o_gadget); + + inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget); + elm_box_homogeneous_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE); + elm_box_horizontal_set(inst->cfg->cpumonitor.o_gadget_box, EINA_TRUE); + E_EXPAND(inst->cfg->cpumonitor.o_gadget_box); + E_FILL(inst->cfg->cpumonitor.o_gadget_box); + elm_table_pack(inst->cfg->cpumonitor.o_gadget, inst->cfg->cpumonitor.o_gadget_box, 0, 0, 1, 1); + evas_object_show(inst->cfg->cpumonitor.o_gadget_box); + + inst->cfg->cpumonitor.event = evas_object_rectangle_add(inst->cfg->cpumonitor.o_gadget); + evas_object_color_set(inst->cfg->cpumonitor.event, 0, 0, 0, 0); + E_EXPAND(inst->cfg->cpumonitor.event); + E_FILL(inst->cfg->cpumonitor.event); + evas_object_event_callback_add(inst->cfg->cpumonitor.event, EVAS_CALLBACK_MOUSE_DOWN, _cpumonitor_mouse_down_cb, inst); + elm_table_pack(inst->cfg->cpumonitor.o_gadget, inst->cfg->cpumonitor.event, 0, 0, 1, 1); + evas_object_show(inst->cfg->cpumonitor.event); + _cpumonitor_config_updated(inst); - _cpumonitor_eval_instance_aspect(inst); return inst->cfg->cpumonitor.o_gadget; } @@ -262,8 +393,10 @@ ci->esm = E_SYSINFO_MODULE_CPUMONITOR; ci->cpumonitor.poll_interval = 32; ci->cpumonitor.total = 0; + ci->cpumonitor.percent = 0; ci->cpumonitor.idle = 0; - + ci->cpumonitor.popup = NULL; + ci->cpumonitor.configure = NULL; sysinfo_config->items = eina_list_append(sysinfo_config->items, ci); return ci; @@ -279,8 +412,12 @@ *id = inst->cfg->id; inst->cfg->cpumonitor.total = 0; inst->cfg->cpumonitor.idle = 0; + inst->cfg->cpumonitor.percent = 0; + inst->cfg->cpumonitor.popup = NULL; + inst->cfg->cpumonitor.configure = NULL; inst->o_main = elm_box_add(parent); E_EXPAND(inst->o_main); + evas_object_data_set(inst->o_main, "Instance", inst); evas_object_smart_callback_add(parent, "gadget_created", _cpumonitor_created_cb, inst); evas_object_smart_callback_add(parent, "gadget_removed", _cpumonitor_removed_cb, inst); evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_cpumonitor_remove, inst); diff -Nru e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor_config.c e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor_config.c --- e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor_config.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,161 @@ +#include "cpumonitor.h" + +static void +_config_close(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + + E_FREE_FUNC(inst->cfg->cpumonitor.configure, evas_object_del); + e_config_save_queue(); +} + +static void +_config_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + int value = elm_radio_value_get(obj); + + switch(value) + { + case 0: + inst->cfg->cpumonitor.poll_interval = 4; + break; + case 1: + inst->cfg->cpumonitor.poll_interval = 8; + break; + case 2: + inst->cfg->cpumonitor.poll_interval = 32; + break; + case 3: + inst->cfg->cpumonitor.poll_interval = 64; + break; + case 4: + inst->cfg->cpumonitor.poll_interval = 256; + break; + default: + inst->cfg->cpumonitor.poll_interval = 32; + } + e_config_save_queue(); + _cpumonitor_config_updated(inst); +} + +Evas_Object * +cpumonitor_configure(Instance *inst) +{ + Evas_Object *popup, *frame, *box, *o, *group, *lbl; + E_Zone *zone = e_zone_current_get(); + + popup = elm_popup_add(e_comp->elm); + E_EXPAND(popup); + elm_popup_allow_events_set(popup, 1); + elm_popup_scrollable_set(popup, 1); + + box = elm_box_add(popup); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + E_FILL(box); + evas_object_show(box); + elm_object_content_set(popup, box); + + lbl = elm_label_add(box); + evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_style_set(lbl, "marker"); + elm_object_text_set(lbl, _("CpuMonitor Configuration")); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + frame = elm_frame_add(box); + elm_object_text_set(frame, _("Update Poll Interval")); + E_EXPAND(frame); + E_FILL(frame); + elm_box_pack_end(box, frame); + evas_object_show(frame); + + box = elm_box_add(popup); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 0); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Fast (4 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + group = o; + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 1); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Medium (8 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 2); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Normal (32 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 3); + elm_radio_group_add(o, group); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Slow (64 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 4); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Very Slow (256 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + switch(inst->cfg->cpumonitor.poll_interval) + { + case 4: + elm_radio_value_set(group, 0); + break; + case 8: + elm_radio_value_set(group, 1); + break; + case 32: + elm_radio_value_set(group, 2); + break; + case 64: + elm_radio_value_set(group, 3); + break; + case 256: + elm_radio_value_set(group, 4); + break; + default: + elm_radio_value_set(group, 2); + } + + elm_object_content_set(frame, box); + popup = e_comp_object_util_add(popup, E_COMP_OBJECT_TYPE_NONE); + evas_object_layer_set(popup, E_LAYER_POPUP); + evas_object_resize(popup, zone->w / 4, zone->h / 3); + e_comp_object_util_center_on_zone(popup, zone); + evas_object_show(popup); + e_comp_object_util_autoclose(popup, NULL, e_comp_object_util_autoclose_on_escape, NULL); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _config_close, inst); + + return inst->cfg->cpumonitor.configure = popup; +} + diff -Nru e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor.h e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor.h --- e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor.h 2017-02-28 19:31:37.000000000 +0000 @@ -3,8 +3,10 @@ #include "../sysinfo.h" -void _cpuclock_config_updated(Instance *inst); +void _cpumonitor_config_updated(Instance *inst); int _cpumonitor_proc_getcores(void); void _cpumonitor_proc_getusage(Instance *inst); - +int _cpumonitor_sysctl_getcores(void); +void _cpumonitor_sysctl_getusage(Instance *inst); +Evas_Object *cpumonitor_configure(Instance *inst); #endif diff -Nru e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor_proc.c e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor_proc.c --- e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor_proc.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor_proc.c 2017-02-28 19:31:37.000000000 +0000 @@ -40,6 +40,34 @@ { while (fgets(buf, sizeof(buf), f)) { + if (k == 0) + { + long total = 0, idle = 0, use = 0, total_change = 0, idle_change = 0; + int percent = 0; + char *line, *tok; + int i = 0; + + line = strchr(buf, ' ')+1; + tok = strtok(line, " "); + while (tok) + { + use = atol(tok); + total += use; + i++; + if (i == 4) + idle = use; + tok = strtok(NULL, " "); + } + total_change = total - inst->cfg->cpumonitor.total; + idle_change = idle - inst->cfg->cpumonitor.idle; + if (total_change != 0) + percent = 100 * (1 - ((float)idle_change / (float)total_change)); + if (percent > 100) percent = 100; + else if (percent < 0) percent = 0; + inst->cfg->cpumonitor.total = total; + inst->cfg->cpumonitor.idle = idle; + inst->cfg->cpumonitor.percent = percent; + } if (k > 0) { long total = 0, idle = 0, use = 0, total_change = 0, idle_change = 0; diff -Nru e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c --- e20-201702271931/src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/cpumonitor/cpumonitor_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,140 @@ +#include "cpumonitor.h" + +#if defined(__FreeBSD__) || defined (__DragonFly__) +# include +# include +# define CPU_STATES 5 +#endif + +#if defined(__OpenBSD__) +# include +# define CPU_STATES 6 +#endif + + int +_cpumonitor_sysctl_getcores(void) +{ + int cores = 0; +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) + size_t len; + int mib[2] = { CTL_HW, HW_NCPU }; + + len = sizeof(cores); + if (sysctl(mib, 2, &cores, &len, NULL, 0) < 0) return 0; +#endif + return cores; +} + + +void +_cpumonitor_sysctl_getusage(Instance *inst) +{ + CPU_Core *core; + size_t size; + unsigned long percent_all = 0, total_all = 0, idle_all = 0; + int i, j; +#if defined(__FreeBSD__) || defined(__DragonFly__) + int ncpu = _cpumonitor_sysctl_getcores(); + if (!ncpu) return; + size = sizeof(long) * (CPU_STATES * ncpu); + long cpu_times[ncpu][CPU_STATES]; + + if (sysctlbyname("kern.cp_times", cpu_times, &size, NULL, 0) < 0) + return; + + for (i = 0; i < ncpu; i++) + { + long *cpu = cpu_times[i]; + double total = 0; + + for (j = 0; j < CPU_STATES; j++) + total += cpu[j]; + + double used = total - (cpu[4]); // + cpu[2] + cpu[1] + cpu[0]); + double ratio = (float) total / 100.0; + + double percent = ((double)used / (double)ratio); + if (percent > 100) + percent = 100; + else if (percent < 0) + percent = 0; + + core = eina_list_nth(inst->cfg->cpumonitor.cores, i); + core->percent = (int) percent; + core->total = total; + core->idle = cpu[4]; + + percent_all += (int) percent; + total_all += total; + idle_all += core->idle; + } + inst->cfg->cpumonitor.total = total_all / ncpu; + inst->cfg->cpumonitor.idle = idle_all / ncpu; + inst->cfg->cpumonitor.percent = (int) (percent_all / ncpu); +#elif defined(__OpenBSD__) + int ncpu = _cpumonitor_sysctl_getcores(); + if (!ncpu) return; + if (ncpu == 1) + { + long cpu_times[CPU_STATES]; + int cpu_time_mib[] = { CTL_KERN, KERN_CPTIME }; + size = CPU_STATES * sizeof(long); + if (sysctl(cpu_time_mib, 2, &cpu_times, &size, NULL, 0) < 0) + return; + + long total = 0; + for (j = 0; j < CPU_STATES; j++) + total += cpu_times[j]; + + //user", "nice", "system", "interrupt", "idle", NULL + long used = total - cpu_times[0] + cpu_times[1] + cpu_times[2] + cpu_times[3]; + double ratio = (double) total / 100.0; + double percent = 100.0 - ((double) used / (double) ratio); + if (percent > 100) + percent = 100; + else if (percent < 0) + percent = 0; + + inst->cfg->cpumonitor.total = total; + inst->cfg->cpumonitor.idle = cpu_times[3]; + inst->cfg->cpumonitor.percent = (int) percent; + } + else if (ncpu > 1) + { + for (i = 0; i < ncpu; i++) + { + long cpu_times[CPU_STATES]; + size = CPU_STATES * sizeof(long); + int cpu_time_mib[] = { CTL_KERN, KERN_CPTIME2, 0 }; + cpu_time_mib[2] = i; + if (sysctl(cpu_time_mib, 3, &cpu_times, &size, NULL, 0) < 0) + return; + + long total = 0; + for (j = 0; j < CPU_STATES - 1; j++) + total += cpu_times[j]; + + long used = total - (cpu_times[4]); + double ratio = (float) total / 100.0; + int percent = used / ratio; + if (percent > 100) + percent = 100; + else if (percent < 0) + percent = 0; + core = eina_list_nth(inst->cfg->cpumonitor.cores, i); + core->percent = (int) percent; + core->total = total; + core->idle = cpu_times[4]; + + percent_all += (int) percent; + total_all += total; + idle_all += core->idle; + } + + inst->cfg->cpumonitor.total = total_all / ncpu; + inst->cfg->cpumonitor.idle = idle_all / ncpu; + inst->cfg->cpumonitor.percent = (percent_all / ncpu) + (percent_all % ncpu); + } +#endif +} + diff -Nru e20-201702271931/src/modules/sysinfo/memusage/memusage.c e20-201702281931/src/modules/sysinfo/memusage/memusage.c --- e20-201702271931/src/modules/sysinfo/memusage/memusage.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/memusage/memusage.c 2017-02-28 19:31:37.000000000 +0000 @@ -6,23 +6,266 @@ { int interval; Instance *inst; - int memstatus; - int swapstatus; + int mem_percent; + int swp_percent; + unsigned long mem_total; + unsigned long mem_used; + unsigned long mem_cached; + unsigned long mem_buffers; + unsigned long mem_shared; + unsigned long swp_total; + unsigned long swp_used; }; static void -_memusage_face_update(Instance *inst, int mem, int swap) +_memusage_popup_update(Instance *inst) +{ + Evas_Object *pbar; + int val_mb, val_perc; + char buf[128]; + + if (!inst->cfg->memusage.popup) + return; + + if (inst->cfg->memusage.mem_total) + { + pbar = evas_object_data_get(inst->cfg->memusage.popup, "mem_used_pbar"); + val_mb = inst->cfg->memusage.mem_used / 1024; + val_perc = 100 * ((float)inst->cfg->memusage.mem_used / + (float)inst->cfg->memusage.mem_total); + snprintf(buf, sizeof(buf), "%d MB (%d %%)", val_mb, val_perc); + elm_progressbar_value_set(pbar, (float)val_perc / 100); + elm_progressbar_unit_format_set(pbar, buf); + + pbar = evas_object_data_get(inst->cfg->memusage.popup, "mem_buffers_pbar"); + val_mb = inst->cfg->memusage.mem_buffers / 1024; + val_perc = 100 * ((float)inst->cfg->memusage.mem_buffers / + (float)inst->cfg->memusage.mem_total); + snprintf(buf, sizeof(buf), "%d MB (%d %%)", val_mb, val_perc); + elm_progressbar_value_set(pbar, (float)val_perc / 100); + elm_progressbar_unit_format_set(pbar, buf); + + pbar = evas_object_data_get(inst->cfg->memusage.popup, "mem_cached_pbar"); + val_mb = inst->cfg->memusage.mem_cached / 1024; + val_perc = 100 * ((float)inst->cfg->memusage.mem_cached / + (float)inst->cfg->memusage.mem_total); + snprintf(buf, sizeof(buf), "%d MB (%d %%)", val_mb, val_perc); + elm_progressbar_value_set(pbar, (float)val_perc / 100); + elm_progressbar_unit_format_set(pbar, buf); + + pbar = evas_object_data_get(inst->cfg->memusage.popup, "mem_shared_pbar"); + val_mb = inst->cfg->memusage.mem_shared / 1024; + val_perc = 100 * ((float)inst->cfg->memusage.mem_shared / + (float)inst->cfg->memusage.mem_total); + snprintf(buf, sizeof(buf), "%d MB (%d %%)", val_mb, val_perc); + elm_progressbar_value_set(pbar, (float)val_perc / 100); + elm_progressbar_unit_format_set(pbar, buf); + } + + if (inst->cfg->memusage.swp_total) + { + pbar = evas_object_data_get(inst->cfg->memusage.popup, "swap_pbar"); + val_mb = inst->cfg->memusage.swp_used / 1024; + val_perc = 100 * ((float)inst->cfg->memusage.swp_used / + (float)inst->cfg->memusage.swp_total); + snprintf(buf, sizeof(buf), "%d MB (%d %%)", val_mb, val_perc); + elm_progressbar_value_set(pbar, (float)val_perc / 100); + elm_progressbar_unit_format_set(pbar, buf); + } +} + +static void +_memusage_face_update(Instance *inst) { Edje_Message_Int_Set *msg; - msg = malloc(sizeof(Edje_Message_Int_Set) + 2 * sizeof(int)); + msg = malloc(sizeof(Edje_Message_Int_Set) + 9 * sizeof(int)); EINA_SAFETY_ON_NULL_RETURN(msg); msg->count = 2; - msg->val[0] = mem; - msg->val[1] = swap; + msg->val[0] = inst->cfg->memusage.mem_percent; + msg->val[1] = inst->cfg->memusage.swp_percent; + msg->val[2] = inst->cfg->memusage.mem_total; + msg->val[3] = inst->cfg->memusage.mem_used; + msg->val[4] = inst->cfg->memusage.mem_cached; + msg->val[5] = inst->cfg->memusage.mem_buffers; + msg->val[6] = inst->cfg->memusage.mem_shared; + msg->val[7] = inst->cfg->memusage.swp_total; + msg->val[8] = inst->cfg->memusage.swp_used; edje_object_message_send(elm_layout_edje_get(inst->cfg->memusage.o_gadget), EDJE_MESSAGE_INT_SET, 1, msg); free(msg); + + if (inst->cfg->memusage.popup) + _memusage_popup_update(inst); +} + +static Evas_Object * +_memusage_configure_cb(Evas_Object *g) +{ + Instance *inst = evas_object_data_get(g, "Instance"); + + if (!sysinfo_config) return NULL; + if (inst->cfg->memusage.popup) return NULL; + return memusage_configure(inst); +} + +static void +_memusage_popup_dismissed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + E_FREE_FUNC(obj, evas_object_del); + inst->cfg->memusage.popup = NULL; +} + +static void +_memusage_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + inst->cfg->memusage.popup = NULL; +} + +static Evas_Object * +_memusage_popup_create(Instance *inst) +{ + Evas_Object *popup, *table, *label, *pbar; + char buf[128], buf2[128]; + + popup = elm_ctxpopup_add(e_comp->elm); + elm_object_style_set(popup, "noblock"); + evas_object_smart_callback_add(popup, "dismissed", + _memusage_popup_dismissed, inst); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, + _memusage_popup_deleted, inst); + + table = elm_table_add(popup); + E_EXPAND(table); E_FILL(table); + elm_object_content_set(popup, table); + evas_object_show(table); + + snprintf(buf, sizeof(buf), _("Memory usage (available %ld MB)"), + inst->cfg->memusage.mem_total / 1024); + snprintf(buf2, sizeof(buf2), "%s", buf); + label = elm_label_add(table); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, buf2); + elm_table_pack(table, label, 0, 0, 2, 1); + evas_object_show(label); + + label = elm_label_add(table); + E_ALIGN(label, 0.0, 0.5); + elm_object_text_set(label, _("Used")); + elm_table_pack(table, label, 0, 1, 1, 1); + evas_object_show(label); + pbar = elm_progressbar_add(table); + E_EXPAND(pbar); E_FILL(pbar); + elm_progressbar_span_size_set(pbar, 200 * e_scale); + elm_table_pack(table, pbar, 1, 1, 1, 1); + evas_object_show(pbar); + evas_object_data_set(popup, "mem_used_pbar", pbar); + + label = elm_label_add(table); + E_ALIGN(label, 0.0, 0.5); + elm_object_text_set(label, _("Buffers")); + elm_table_pack(table, label, 0, 2, 1, 1); + evas_object_show(label); + pbar = elm_progressbar_add(table); + E_EXPAND(pbar); E_FILL(pbar); + elm_progressbar_span_size_set(pbar, 200 * e_scale); + elm_table_pack(table, pbar, 1, 2, 1, 1); + evas_object_show(pbar); + evas_object_data_set(popup, "mem_buffers_pbar", pbar); + + label = elm_label_add(table); + E_ALIGN(label, 0.0, 0.5); + elm_object_text_set(label, _("Cached")); + elm_table_pack(table, label, 0, 3, 1, 1); + evas_object_show(label); + pbar = elm_progressbar_add(table); + E_EXPAND(pbar); E_FILL(pbar); + elm_progressbar_span_size_set(pbar, 200 * e_scale); + elm_table_pack(table, pbar, 1, 3, 1, 1); + evas_object_show(pbar); + evas_object_data_set(popup, "mem_cached_pbar", pbar); + + label = elm_label_add(table); + E_ALIGN(label, 0.0, 0.5); + elm_object_text_set(label, _("Shared")); + elm_table_pack(table, label, 0, 4, 1, 1); + evas_object_show(label); + pbar = elm_progressbar_add(table); + E_EXPAND(pbar); E_FILL(pbar); + elm_progressbar_span_size_set(pbar, 200 * e_scale); + elm_table_pack(table, pbar, 1, 4, 1, 1); + evas_object_show(pbar); + evas_object_data_set(popup, "mem_shared_pbar", pbar); + + snprintf(buf, sizeof(buf), _("Swap usage (available %ld MB)"), + inst->cfg->memusage.swp_total / 1024); + snprintf(buf2, sizeof(buf2), "%s", buf); + label = elm_label_add(table); + E_EXPAND(label); E_ALIGN(label, 0.5, 0.5); + elm_object_text_set(label, buf2); + elm_table_pack(table, label, 0, 5, 2, 1); + evas_object_show(label); + + pbar = elm_progressbar_add(table); + E_EXPAND(pbar); E_FILL(pbar); + elm_table_pack(table, pbar, 0, 6, 2, 1); + evas_object_show(pbar); + evas_object_data_set(popup, "swap_pbar", pbar); + + // place and show the popup + e_gadget_util_ctxpopup_place(inst->o_main, popup, + inst->cfg->memusage.o_gadget); + evas_object_show(popup); + + return popup; +} + +static void +_memusage_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data) +{ + Evas_Event_Mouse_Down *ev = event_data; + Instance *inst = data; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (ev->button != 3) + { + if (inst->cfg->memusage.popup) + elm_ctxpopup_dismiss(inst->cfg->memusage.popup); + else + { + inst->cfg->memusage.popup = _memusage_popup_create(inst); + _memusage_popup_update(inst); + } + } + else + { + if (inst->cfg->memusage.popup) + elm_ctxpopup_dismiss(inst->cfg->memusage.popup); + if (!sysinfo_config) return; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE) + memusage_configure(inst); + else + e_gadget_configure(inst->o_main); + } +} + +static void +_memusage_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Evas_Coord w, h; + Instance *inst = data; + + edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->memusage.o_gadget), + 0, 0, &w, &h); + if (inst->cfg->esm == E_SYSINFO_MODULE_MEMUSAGE) + evas_object_size_hint_aspect_set(inst->o_main, + EVAS_ASPECT_CONTROL_BOTH, w, h); + else + evas_object_size_hint_aspect_set(inst->cfg->memusage.o_gadget, + EVAS_ASPECT_CONTROL_BOTH, w, h); } static void @@ -32,8 +275,20 @@ for (;;) { if (ecore_thread_check(th)) break; - thc->memstatus = _memusage_proc_getmemusage(); - thc->swapstatus = _memusage_proc_getswapusage(); +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + _memusage_sysctl_getusage(&thc->mem_total, &thc->mem_used, + &thc->mem_cached, &thc->mem_buffers, &thc->mem_shared, + &thc->swp_total, &thc->swp_used); +#else + _memusage_proc_getusage(&thc->mem_total, &thc->mem_used, + &thc->mem_cached, &thc->mem_buffers, &thc->mem_shared, + &thc->swp_total, &thc->swp_used); +#endif + if (thc->mem_total > 0) + thc->mem_percent = 100 * ((float)thc->mem_used / (float)thc->mem_total); + if (thc->swp_total > 0) + thc->swp_percent = 100 * ((float)thc->swp_used / (float)thc->swp_total); + ecore_thread_feedback(th, NULL); if (ecore_thread_check(th)) break; usleep((1000000.0 / 8.0) * (double)thc->interval); @@ -50,9 +305,19 @@ Instance *inst = thc->inst; if (!inst->cfg) return; - if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return; + if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE && + inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return; - _memusage_face_update(inst, thc->memstatus, thc->swapstatus); + inst->cfg->memusage.mem_percent = thc->mem_percent; + inst->cfg->memusage.swp_percent = thc->swp_percent; + inst->cfg->memusage.mem_total = thc->mem_total; + inst->cfg->memusage.mem_used = thc->mem_used; + inst->cfg->memusage.mem_cached = thc->mem_cached; + inst->cfg->memusage.mem_buffers = thc->mem_buffers; + inst->cfg->memusage.mem_shared = thc->mem_shared; + inst->cfg->memusage.swp_total = thc->swp_total; + inst->cfg->memusage.swp_used = thc->swp_used; + _memusage_face_update(inst); } void @@ -70,8 +335,8 @@ { thc->inst = inst; thc->interval = inst->cfg->memusage.poll_interval; - thc->memstatus = 0; - thc->swapstatus = 0; + thc->mem_percent = 0; + thc->swp_percent = 0; inst->cfg->memusage.usage_check_thread = ecore_thread_feedback_run(_memusage_cb_usage_check_main, _memusage_cb_usage_check_notify, @@ -87,12 +352,17 @@ if (inst->o_main != event_data) return; + if (inst->cfg->memusage.popup) + E_FREE_FUNC(inst->cfg->memusage.popup, evas_object_del); + if (inst->cfg->memusage.configure) + E_FREE_FUNC(inst->cfg->memusage.configure, evas_object_del); if (inst->cfg->memusage.usage_check_thread) { ecore_thread_cancel(inst->cfg->memusage.usage_check_thread); inst->cfg->memusage.usage_check_thread = NULL; } - evas_object_event_callback_del_full(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_memusage_remove, data); + evas_object_event_callback_del_full(inst->o_main, EVAS_CALLBACK_DEL, + sysinfo_memusage_remove, data); sysinfo_config->items = eina_list_remove(sysinfo_config->items, inst->cfg); E_FREE(inst->cfg); @@ -103,6 +373,10 @@ { Instance *inst = data; + if (inst->cfg->memusage.popup) + E_FREE_FUNC(inst->cfg->memusage.popup, evas_object_del); + if (inst->cfg->memusage.configure) + E_FREE_FUNC(inst->cfg->memusage.configure, evas_object_del); if (inst->cfg->memusage.usage_check_thread) { ecore_thread_cancel(inst->cfg->memusage.usage_check_thread); @@ -111,49 +385,13 @@ } static void -_memusage_eval_instance_aspect(Instance *inst) -{ - Evas_Coord w, h; - Evas_Coord sw = 0, sh = 0; - Evas_Object *owner, *ed; - - if (!inst->o_main) - return; - - owner = e_gadget_site_get(inst->o_main); - if (!owner) - return; - - switch (e_gadget_site_orient_get(owner)) - { - case E_GADGET_SITE_ORIENT_HORIZONTAL: - case E_GADGET_SITE_ORIENT_NONE: - evas_object_geometry_get(owner, NULL, NULL, NULL, &sh); - sw = sh; - break; - - case E_GADGET_SITE_ORIENT_VERTICAL: - evas_object_geometry_get(owner, NULL, NULL, &sw, NULL); - sh = sw; - break; - - default: - sw = sh = 48; - break; - } - - evas_object_resize(inst->cfg->memusage.o_gadget, sw, sh); - ed = elm_layout_edje_get(inst->cfg->memusage.o_gadget); - edje_object_parts_extends_calc(ed, NULL, NULL, &w, &h); - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); -} - -static void _memusage_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) { Instance *inst = data; int orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); + e_gadget_configure_cb_set(inst->o_main, _memusage_configure_cb); + inst->cfg->memusage.o_gadget = elm_layout_add(inst->o_main); if (orient == E_GADGET_SITE_ORIENT_VERTICAL) e_theme_edje_object_set(inst->cfg->memusage.o_gadget, @@ -167,9 +405,15 @@ E_EXPAND(inst->cfg->memusage.o_gadget); E_FILL(inst->cfg->memusage.o_gadget); elm_box_pack_end(inst->o_main, inst->cfg->memusage.o_gadget); + evas_object_event_callback_add(inst->cfg->memusage.o_gadget, + EVAS_CALLBACK_MOUSE_DOWN, + _memusage_mouse_down_cb, inst); + evas_object_event_callback_add(inst->cfg->memusage.o_gadget, + EVAS_CALLBACK_RESIZE, + _memusage_resize_cb, inst); evas_object_show(inst->cfg->memusage.o_gadget); - evas_object_smart_callback_del_full(obj, "gadget_created", _memusage_created_cb, data); - _memusage_eval_instance_aspect(inst); + evas_object_smart_callback_del_full(obj, "gadget_created", + _memusage_created_cb, data); _memusage_config_updated(inst); } @@ -177,12 +421,18 @@ sysinfo_memusage_create(Evas_Object *parent, Instance *inst) { inst->cfg->memusage.o_gadget = elm_layout_add(parent); - e_theme_edje_object_set(inst->cfg->memusage.o_gadget, "base/theme/modules/memusage", + e_theme_edje_object_set(inst->cfg->memusage.o_gadget, + "base/theme/modules/memusage", "e/modules/memusage/main"); E_EXPAND(inst->cfg->memusage.o_gadget); E_FILL(inst->cfg->memusage.o_gadget); + evas_object_event_callback_add(inst->cfg->memusage.o_gadget, + EVAS_CALLBACK_MOUSE_DOWN, + _memusage_mouse_down_cb, inst); + evas_object_event_callback_add(inst->cfg->memusage.o_gadget, + EVAS_CALLBACK_RESIZE, + _memusage_resize_cb, inst); evas_object_show(inst->cfg->memusage.o_gadget); - _memusage_eval_instance_aspect(inst); _memusage_config_updated(inst); return inst->cfg->memusage.o_gadget; @@ -209,6 +459,17 @@ ci->esm = E_SYSINFO_MODULE_MEMUSAGE; ci->memusage.poll_interval = 32; + ci->memusage.mem_percent = 0; + ci->memusage.swp_percent = 0; + ci->memusage.mem_total = 0; + ci->memusage.mem_used = 0; + ci->memusage.mem_cached = 0; + ci->memusage.mem_buffers = 0; + ci->memusage.mem_shared = 0; + ci->memusage.swp_total = 0; + ci->memusage.swp_used = 0; + ci->memusage.popup = NULL; + ci->memusage.configure = NULL; sysinfo_config->items = eina_list_append(sysinfo_config->items, ci); @@ -223,17 +484,31 @@ inst = E_NEW(Instance, 1); inst->cfg = _conf_item_get(id); *id = inst->cfg->id; + inst->cfg->memusage.mem_percent = 0; + inst->cfg->memusage.swp_percent = 0; + inst->cfg->memusage.mem_total = 0; + inst->cfg->memusage.mem_used = 0; + inst->cfg->memusage.mem_cached = 0; + inst->cfg->memusage.mem_buffers = 0; + inst->cfg->memusage.mem_shared = 0; + inst->cfg->memusage.swp_total = 0; + inst->cfg->memusage.swp_used = 0; + inst->cfg->memusage.popup = NULL; + inst->cfg->memusage.configure = NULL; inst->o_main = elm_box_add(parent); E_EXPAND(inst->o_main); - evas_object_smart_callback_add(parent, "gadget_created", _memusage_created_cb, inst); - evas_object_smart_callback_add(parent, "gadget_removed", _memusage_removed_cb, inst); - evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_memusage_remove, inst); + evas_object_data_set(inst->o_main, "Instance", inst); + evas_object_smart_callback_add(parent, "gadget_created", + _memusage_created_cb, inst); + evas_object_smart_callback_add(parent, "gadget_removed", + _memusage_removed_cb, inst); + evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, + sysinfo_memusage_remove, inst); evas_object_show(inst->o_main); if (inst->cfg->id < 0) return inst->o_main; - sysinfo_instances = - eina_list_append(sysinfo_instances, inst); + sysinfo_instances = eina_list_append(sysinfo_instances, inst); return inst->o_main; } diff -Nru e20-201702271931/src/modules/sysinfo/memusage/memusage_config.c e20-201702281931/src/modules/sysinfo/memusage/memusage_config.c --- e20-201702271931/src/modules/sysinfo/memusage/memusage_config.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/memusage/memusage_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,161 @@ +#include "memusage.h" + +static void +_config_close(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + + E_FREE_FUNC(inst->cfg->memusage.configure, evas_object_del); + e_config_save_queue(); +} + +static void +_config_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + int value = elm_radio_value_get(obj); + + switch(value) + { + case 0: + inst->cfg->memusage.poll_interval = 4; + break; + case 1: + inst->cfg->memusage.poll_interval = 8; + break; + case 2: + inst->cfg->memusage.poll_interval = 32; + break; + case 3: + inst->cfg->memusage.poll_interval = 64; + break; + case 4: + inst->cfg->memusage.poll_interval = 256; + break; + default: + inst->cfg->memusage.poll_interval = 32; + } + e_config_save_queue(); + _memusage_config_updated(inst); +} + +Evas_Object * +memusage_configure(Instance *inst) +{ + Evas_Object *popup, *frame, *box, *o, *group, *lbl; + E_Zone *zone = e_zone_current_get(); + + popup = elm_popup_add(e_comp->elm); + E_EXPAND(popup); + elm_popup_allow_events_set(popup, 1); + elm_popup_scrollable_set(popup, 1); + + box = elm_box_add(popup); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + E_FILL(box); + evas_object_show(box); + elm_object_content_set(popup, box); + + lbl = elm_label_add(box); + evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_style_set(lbl, "marker"); + elm_object_text_set(lbl, _("MemUsage Configuration")); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + + frame = elm_frame_add(box); + elm_object_text_set(frame, _("Update Poll Interval")); + E_EXPAND(frame); + E_FILL(frame); + elm_box_pack_end(box, frame); + evas_object_show(frame); + + box = elm_box_add(popup); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 0); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Fast (4 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + group = o; + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 1); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Medium (8 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 2); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Normal (32 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 3); + elm_radio_group_add(o, group); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Slow (64 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 4); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Very Slow (256 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _config_changed, inst); + evas_object_show(o); + + switch(inst->cfg->memusage.poll_interval) + { + case 4: + elm_radio_value_set(group, 0); + break; + case 8: + elm_radio_value_set(group, 1); + break; + case 32: + elm_radio_value_set(group, 2); + break; + case 64: + elm_radio_value_set(group, 3); + break; + case 256: + elm_radio_value_set(group, 4); + break; + default: + elm_radio_value_set(group, 2); + } + + elm_object_content_set(frame, box); + popup = e_comp_object_util_add(popup, E_COMP_OBJECT_TYPE_NONE); + evas_object_layer_set(popup, E_LAYER_POPUP); + evas_object_resize(popup, zone->w / 4, zone->h / 3); + e_comp_object_util_center_on_zone(popup, zone); + evas_object_show(popup); + e_comp_object_util_autoclose(popup, NULL, e_comp_object_util_autoclose_on_escape, NULL); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _config_close, inst); + + return inst->cfg->memusage.configure = popup; +} + diff -Nru e20-201702271931/src/modules/sysinfo/memusage/memusage.h e20-201702281931/src/modules/sysinfo/memusage/memusage.h --- e20-201702271931/src/modules/sysinfo/memusage/memusage.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/memusage/memusage.h 2017-02-28 19:31:37.000000000 +0000 @@ -4,7 +4,22 @@ #include "../sysinfo.h" void _memusage_config_updated(Instance *inst); -int _memusage_proc_getmemusage(); -int _memusage_proc_getswapusage(); +Evas_Object *memusage_configure(Instance *inst); + +void _memusage_proc_getusage(unsigned long *mem_total, + unsigned long *mem_used, + unsigned long *mem_cached, + unsigned long *mem_buffers, + unsigned long *mem_shared, + unsigned long *swp_total, + unsigned long *swp_used); + +void _memusage_sysctl_getusage(unsigned long *mem_total, + unsigned long *mem_used, + unsigned long *mem_cached, + unsigned long *mem_buffers, + unsigned long *mem_shared, + unsigned long *swp_total, + unsigned long *swp_used); #endif diff -Nru e20-201702271931/src/modules/sysinfo/memusage/memusage_proc.c e20-201702281931/src/modules/sysinfo/memusage/memusage_proc.c --- e20-201702271931/src/modules/sysinfo/memusage/memusage_proc.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/memusage/memusage_proc.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,84 +1,95 @@ #include "memusage.h" -int _memusage_proc_getswapusage(void) -{ - long swap_total = 0, swap_free = 0, swap_used = 0; - int percent = 0; - char buf[4096], *line, *tok; - FILE *f; - f = fopen("/proc/meminfo", "r"); - if (f) - { - while(fgets(buf, sizeof(buf), f) != NULL) - { - if (!strncmp("SwapTotal:", buf, 10)) - { - line = strchr(buf, ':')+1; - while(isspace(*line)) line++; - tok = strtok(line, " "); - swap_total = atol(tok); - } - else if (!strncmp("SwapFree:", buf, 9)) - { - line = strchr(buf, ':')+1; - while(isspace(*line)) line++; - tok = strtok(line, " "); - swap_free = atol(tok); - } - if (swap_total && swap_free) - break; - } - fclose(f); - - swap_used = swap_total - swap_free; - if (swap_total > 0) - percent = 100 * ((float)swap_used / (float)swap_total); - } - if (percent > 100) percent = 100; - else if (percent < 0) percent = 0; +unsigned long _line_parse(const char *line) +{ + char *p, *tok; - return percent; + p = strchr(line, ':') + 1; + while(isspace(*p)) p++; + tok = strtok(p, " "); + return atol(tok); } -int _memusage_proc_getmemusage(void) +void _memusage_proc_getusage(unsigned long *mem_total, + unsigned long *mem_used, + unsigned long *mem_cached, + unsigned long *mem_buffers, + unsigned long *mem_shared, + unsigned long *swp_total, + unsigned long *swp_used) { - long mem_total = 0, mem_free = 0, mem_used = 0; - int percent = 0; - char buf[4096], *line, *tok; + char line[256]; + int found = 0; + unsigned long tmp_swp_total = 0; + unsigned long tmp_swp_free = 0; + unsigned long tmp_mem_free = 0; + unsigned long tmp_mem_cached = 0; + unsigned long tmp_mem_slab = 0; FILE *f; + *mem_total = 0; + *mem_used = 0; + *mem_cached = 0; + *mem_buffers = 0; + *mem_shared = 0; + *swp_total = 0; + *swp_used = 0; + f = fopen("/proc/meminfo", "r"); - if (f) + if (!f) return; + + while(fgets(line, sizeof(line), f) != NULL) { - while(fgets(buf, sizeof(buf), f) != NULL) + if (!strncmp("MemTotal:", line, 9)) + { + *mem_total = _line_parse(line); + found++; + } + else if (!strncmp("MemFree:", line, 8)) { - if (!strncmp("MemTotal:", buf, 9)) - { - line = strchr(buf, ':')+1; - while(isspace(*line)) line++; - tok = strtok(line, " "); - mem_total = atol(tok); - } - else if (!strncmp("MemFree:", buf, 8)) - { - line = strchr(buf, ':')+1; - while(isspace(*line)) line++; - tok = strtok(line, " "); - mem_free = atol(tok); - } - if (mem_total && mem_free) - break; - } - fclose(f); - - mem_used = mem_total - mem_free; - if (mem_total > 0) - percent = 100 * ((float)mem_used / (float)mem_total); + tmp_mem_free = _line_parse(line); + found++; + } + else if (!strncmp("Cached:", line, 7)) + { + tmp_mem_cached = _line_parse(line); + found++; + } + else if (!strncmp("Slab:", line, 5)) + { + tmp_mem_slab = _line_parse(line); + found++; + } + else if (!strncmp("Buffers:", line, 8)) + { + *mem_buffers = _line_parse(line); + found++; + } + else if (!strncmp("Shmem:", line, 6)) + { + *mem_shared = _line_parse(line); + found++; + } + else if (!strncmp("SwapTotal:", line, 10)) + { + tmp_swp_total = _line_parse(line); + found++; + } + else if (!strncmp("SwapFree:", line, 9)) + { + tmp_swp_free = _line_parse(line); + found++; + } + + if (found >= 8) + break; } - if (percent > 100) percent = 100; - else if (percent < 0) percent = 0; + fclose(f); - return percent; -} + *mem_cached = tmp_mem_cached + tmp_mem_slab; + *mem_used = *mem_total - tmp_mem_free - *mem_cached - *mem_buffers; + *swp_total = tmp_swp_total; + *swp_used = tmp_swp_total - tmp_swp_free; +} diff -Nru e20-201702271931/src/modules/sysinfo/memusage/memusage_sysctl.c e20-201702281931/src/modules/sysinfo/memusage/memusage_sysctl.c --- e20-201702271931/src/modules/sysinfo/memusage/memusage_sysctl.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/memusage/memusage_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,147 @@ +#include "memusage.h" + +#if defined(__FreeBSD__) || defined(__DragonFly__) +# include +# include +# include +#endif + +#if defined(__OpenBSD__) +# include +# include +# include +# include +#endif + +#if defined(__FreeBSD__) || defined(__DragonFly__) +static long int +_sysctlfromname(const char *name, void *mib, int depth, size_t *len) +{ + long int result; + + if (sysctlnametomib(name, mib, len) < 0) return -1; + + *len = sizeof(result); + if (sysctl(mib, depth, &result, len, NULL, 0) < 0) return -1; + + return result; +} +#endif + +void _memusage_sysctl_getusage(unsigned long *mem_total, + unsigned long *mem_used, + unsigned long *mem_cached, + unsigned long *mem_buffers, + unsigned long *mem_shared, + unsigned long *swp_total, + unsigned long *swp_used) +{ + size_t len; + int i = 0; + *mem_total = *mem_used = *mem_cached = *mem_buffers = *mem_shared = 0; + *swp_total = *swp_used = 0; +#if defined(__FreeBSD__) || defined(__DragonFly__) + int total_pages = 0, free_pages = 0, inactive_pages = 0; + long int result = 0; + int page_size = getpagesize(); + + int *mib = malloc(sizeof(int) * 4); + if (mib == NULL) return; + + mib[0] = CTL_HW; mib[1] = HW_PHYSMEM; + len = sizeof(*mem_total); + if (sysctl(mib, 2, mem_total, &len, NULL, 0) == -1) + return; + *mem_total /= 1024; + + total_pages = _sysctlfromname("vm.stats.vm.v_page_count", mib, 4, &len); + if (total_pages < 0) return; + + free_pages = _sysctlfromname("vm.stats.vm.v_free_count", mib, 4, &len); + if (free_pages < 0) return; + + inactive_pages = _sysctlfromname("vm.stats.vm.v_inactive_count", mib, 4, &len); + if (inactive_pages < 0) return; + + *mem_used = (total_pages - free_pages - inactive_pages) * page_size >> 10; + + result = _sysctlfromname("vfs.bufspace", mib, 2, &len); + if (result < 0) return; + *mem_buffers = (result / 1024); + + result = _sysctlfromname("vm.stats.vm.v_active_count", mib, 4, &len); + if (result < 0) return; + *mem_cached = ((result * page_size) / 1024); + + result = _sysctlfromname("vm.stats.vm.v_cache_count", mib, 4, &len); + if (result < 0) return; + *mem_shared = (result * page_size) / 1024; + + result = _sysctlfromname("vm.swap_total", mib, 2, &len); + if (result < 0) return; + *swp_total = (result / 1024); + + struct xswdev xsw; + // previous mib is important for this one... + + while (i++) + { + mib[2] = i; + len = sizeof(xsw); + if (sysctl(mib, 3, &xsw, &len, NULL, 0) == -1) break; + + *swp_used += xsw.xsw_used * page_size; + } + + *swp_used >>= 10; + + free(mib); +#elif defined(__OpenBSD__) + static int mib[] = { CTL_HW, HW_PHYSMEM64 }; + static int bcstats_mib[] = { CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT }; + struct bcachestats bcstats; + static int uvmexp_mib[] = { CTL_VM, VM_UVMEXP }; + struct uvmexp uvmexp; + int nswap, rnswap; + struct swapent *swdev = NULL; + + len = sizeof(*mem_total); + if (sysctl(mib, 2, mem_total, &len, NULL, 0) == -1) + return; + + len = sizeof(uvmexp); + if (sysctl(uvmexp_mib, 2, &uvmexp, &len, NULL, 0) == -1) + return; + + len = sizeof(bcstats); + if (sysctl(bcstats_mib, 3, &bcstats, &len, NULL, 0) == -1) + return; + + // Don't fail if there's not swap! + nswap = swapctl(SWAP_NSWAP, 0, 0); + if (nswap == 0) goto swap_out; + + swdev = calloc(nswap, sizeof(*swdev)); + if (swdev == NULL) goto swap_out; + + rnswap = swapctl(SWAP_STATS, swdev, nswap); + if (rnswap == -1) goto swap_out; + + for (i = 0; i < nswap; i++)// nswap; i++) + { + if (swdev[i].se_flags & SWF_ENABLE) + { + *swp_used += (swdev[i].se_inuse / (1024 / DEV_BSIZE)); + *swp_total += (swdev[i].se_nblks / (1024 / DEV_BSIZE)); + } + } +swap_out: + if (swdev) free(swdev); + + *mem_total /= 1024; + *mem_cached = (uvmexp.pagesize * bcstats.numbufpages) / 1024; + *mem_used = (uvmexp.active * uvmexp.pagesize) / 1024 ; + *mem_buffers = (uvmexp.pagesize * (uvmexp.npages - uvmexp.free)) / 1024; + *mem_shared = (uvmexp.pagesize * uvmexp.wired) / 1024; +#endif +} diff -Nru e20-201702271931/src/modules/sysinfo/mod.c e20-201702281931/src/modules/sysinfo/mod.c --- e20-201702271931/src/modules/sysinfo/mod.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/mod.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,5 +1,7 @@ #include "sysinfo.h" +#define CONFIG_VERSION 2 + static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_item_edd = NULL; Eina_List *sysinfo_instances = NULL; @@ -9,20 +11,25 @@ EINTERN void sysinfo_init(void) { + Eina_List *l; + Config_Item *ci; + conf_item_edd = E_CONFIG_DD_NEW("Sysinfo_Config_Item", Config_Item); #undef T #undef D #define T Config_Item #define D conf_item_edd E_CONFIG_VAL(D, T, id, INT); + E_CONFIG_VAL(D, T, version, INT); E_CONFIG_VAL(D, T, esm, INT); E_CONFIG_VAL(D, T, batman.poll_interval, INT); E_CONFIG_VAL(D, T, batman.alert, INT); E_CONFIG_VAL(D, T, batman.alert_p, INT); E_CONFIG_VAL(D, T, batman.alert_timeout, INT); E_CONFIG_VAL(D, T, batman.suspend_below, INT); + E_CONFIG_VAL(D, T, batman.suspend_method, INT); E_CONFIG_VAL(D, T, batman.force_mode, INT); - #if defined HAVE_EEZE || defined __OpenBSD__ || defined __NetBSD__ +#if defined HAVE_EEZE || defined __OpenBSD__ || defined __NetBSD__ E_CONFIG_VAL(D, T, batman.fuzzy, INT); #endif E_CONFIG_VAL(D, T, batman.desktop_notifications, INT); @@ -42,6 +49,11 @@ E_CONFIG_VAL(D, T, cpumonitor.poll_interval, INT); E_CONFIG_VAL(D, T, memusage.poll_interval, INT); E_CONFIG_VAL(D, T, netstatus.poll_interval, INT); + E_CONFIG_VAL(D, T, netstatus.automax, INT); + E_CONFIG_VAL(D, T, netstatus.inmax, INT); + E_CONFIG_VAL(D, T, netstatus.receive_units, INT); + E_CONFIG_VAL(D, T, netstatus.outmax, INT); + E_CONFIG_VAL(D, T, netstatus.send_units, INT); conf_edd = E_CONFIG_DD_NEW("Sysinfo_Config", Config); #undef T @@ -54,11 +66,10 @@ if (!sysinfo_config) { - Config_Item *ci; - sysinfo_config = E_NEW(Config, 1); ci = E_NEW(Config_Item, 1); ci->id = 0; + ci->version = CONFIG_VERSION; ci->esm = E_SYSINFO_MODULE_NONE; ci->batman.poll_interval = 512; @@ -66,16 +77,18 @@ ci->batman.alert_p = 10; ci->batman.alert_timeout = 0; ci->batman.suspend_below = 0; + ci->batman.suspend_method = 0; ci->batman.force_mode = 0; ci->batman.full = -2; ci->batman.time_left = -2; - ci->batman.time_full = -2; ci->batman.have_battery = -2; ci->batman.have_power = -2; #if defined HAVE_EEZE || defined __OpenBSD__ || defined __NetBSD__ ci->batman.fuzzy = 0; #endif ci->batman.desktop_notifications = 0; + ci->batman.popup = NULL; + ci->batman.configure = NULL; ci->thermal.poll_interval = 128; ci->thermal.low = 30; ci->thermal.high = 80; @@ -93,10 +106,30 @@ ci->cpumonitor.poll_interval = 32; ci->cpumonitor.total = 0; ci->cpumonitor.idle = 0; + ci->cpumonitor.percent = 0; + ci->cpumonitor.popup = NULL; + ci->cpumonitor.configure = NULL; ci->memusage.poll_interval = 32; + ci->memusage.mem_percent = 0; + ci->memusage.swp_percent = 0; + ci->memusage.popup = NULL; + ci->memusage.configure = NULL; ci->netstatus.poll_interval = 32; + ci->netstatus.automax = EINA_TRUE; + ci->netstatus.receive_units = NETSTATUS_UNIT_BYTES; + ci->netstatus.send_units = NETSTATUS_UNIT_BYTES; ci->netstatus.in = 0; ci->netstatus.out = 0; + ci->netstatus.inmax = 0; + ci->netstatus.outmax = 0; + ci->netstatus.incurrent = 0; + ci->netstatus.outcurrent = 0; + ci->netstatus.inpercent = 0; + ci->netstatus.outpercent = 0; + ci->netstatus.instring = NULL; + ci->netstatus.outstring = NULL; + ci->netstatus.popup = NULL; + ci->netstatus.configure = NULL; E_CONFIG_LIMIT(ci->batman.poll_interval, 4, 4096); E_CONFIG_LIMIT(ci->batman.alert, 0, 60); @@ -116,6 +149,19 @@ sysinfo_config->items = eina_list_append(sysinfo_config->items, ci); } + EINA_LIST_FOREACH(sysinfo_config->items, l, ci) + { + if (ci->esm == E_SYSINFO_MODULE_NETSTATUS || ci->esm == E_SYSINFO_MODULE_SYSINFO) + { + if (ci->version < CONFIG_VERSION) + { + ci->version = CONFIG_VERSION; + ci->netstatus.automax = EINA_TRUE; + ci->netstatus.receive_units = NETSTATUS_UNIT_BYTES; + ci->netstatus.send_units = NETSTATUS_UNIT_BYTES; + } + } + } e_gadget_type_add("Batman", batman_create, NULL); e_gadget_type_add("Thermal", thermal_create, NULL); e_gadget_type_add("CpuClock", cpuclock_create, NULL); diff -Nru e20-201702271931/src/modules/sysinfo/netstatus/netstatus.c e20-201702281931/src/modules/sysinfo/netstatus/netstatus.c --- e20-201702271931/src/modules/sysinfo/netstatus/netstatus.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/netstatus/netstatus.c 2017-02-28 19:31:37.000000000 +0000 @@ -6,53 +6,139 @@ { int interval; Instance *inst; - const char *rstatus; - const char *tstatus; + int percent; + long current; }; static void -_netstatus_face_update(Instance *inst, Eina_Bool trans, const char *status) +_netstatus_face_update(Instance *inst) { - if (!trans && status) - { - elm_layout_signal_emit(inst->cfg->netstatus.o_gadget, "e,state,received,active", "e"); - elm_layout_text_set(inst->cfg->netstatus.o_gadget, "e.text.received", status); - } - else if (trans && status) + Edje_Message_Int_Set *msg; + + msg = malloc(sizeof(Edje_Message_Int_Set) + 6 * sizeof(int)); + EINA_SAFETY_ON_NULL_RETURN(msg); + msg->count = 6; + msg->val[0] = inst->cfg->netstatus.incurrent; + msg->val[1] = inst->cfg->netstatus.inpercent; + msg->val[2] = inst->cfg->netstatus.inmax; + msg->val[3] = inst->cfg->netstatus.outcurrent; + msg->val[4] = inst->cfg->netstatus.outpercent; + msg->val[5] = inst->cfg->netstatus.outmax; + edje_object_message_send(elm_layout_edje_get(inst->cfg->netstatus.o_gadget), + EDJE_MESSAGE_INT_SET, 1, msg); + free(msg); + + if (inst->cfg->netstatus.popup) { - elm_layout_signal_emit(inst->cfg->netstatus.o_gadget, "e,state,transmitted,active", "e"); - elm_layout_text_set(inst->cfg->netstatus.o_gadget, "e.text.transmitted", status); + char text[4096]; + snprintf(text, sizeof(text), "%s
%s", inst->cfg->netstatus.instring, inst->cfg->netstatus.outstring); + elm_object_text_set(inst->cfg->netstatus.popup_label, text); } - else if (!trans && !status) +} + +static Evas_Object * +_netstatus_configure_cb(Evas_Object *g) +{ + Instance *inst = evas_object_data_get(g, "Instance"); + + if (!sysinfo_config) return NULL; + if (inst->cfg->netstatus.popup) return NULL; + return netstatus_configure(inst); +} + +static void +_netstatus_popup_dismissed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + E_FREE_FUNC(obj, evas_object_del); + inst->cfg->netstatus.popup = NULL; +} + +static void +_netstatus_popup_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Instance *inst = data; + inst->cfg->netstatus.popup = NULL; +} + +static void +_netstatus_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data) +{ + Evas_Object *label, *popup; + Evas_Event_Mouse_Down *ev = event_data; + Instance *inst = data; + char text[4096]; + + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (ev->button != 3) { - elm_layout_signal_emit(inst->cfg->netstatus.o_gadget, "e,state,received,idle", "e"); - elm_layout_text_set(inst->cfg->netstatus.o_gadget, "e.text.received", "Rx: 0"); + if (inst->cfg->netstatus.popup) + { + elm_ctxpopup_dismiss(inst->cfg->netstatus.popup); + return; + } + popup = elm_ctxpopup_add(e_comp->elm); + elm_object_style_set(popup, "noblock"); + evas_object_smart_callback_add(popup, "dismissed", _netstatus_popup_dismissed, inst); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _netstatus_popup_deleted, inst); + + snprintf(text, sizeof(text), "%s
%s", inst->cfg->netstatus.instring, inst->cfg->netstatus.outstring); + label = elm_label_add(popup); + elm_object_style_set(label, "marker"); + elm_object_text_set(label, text); + elm_object_content_set(popup, label); + evas_object_show(label); + inst->cfg->netstatus.popup_label = label; + + e_gadget_util_ctxpopup_place(inst->o_main, popup, + inst->cfg->netstatus.o_gadget); + evas_object_show(popup); + inst->cfg->netstatus.popup = popup; } - else if (trans && !status) + else { - elm_layout_signal_emit(inst->cfg->netstatus.o_gadget, "e,state,transmitted,idle", "e"); - elm_layout_text_set(inst->cfg->netstatus.o_gadget, "e.text.transmitted", "Tx: 0"); + if (inst->cfg->netstatus.popup) + elm_ctxpopup_dismiss(inst->cfg->netstatus.popup); + if (!sysinfo_config) return; + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (inst->cfg->esm != E_SYSINFO_MODULE_NETSTATUS) + netstatus_configure(inst); + else + e_gadget_configure(inst->o_main); } } static void +_netstatus_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Evas_Coord w, h; + Instance *inst = data; + + edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->netstatus.o_gadget), 0, 0, &w, &h); + if (inst->cfg->esm == E_SYSINFO_MODULE_NETSTATUS) + evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); + else + evas_object_size_hint_aspect_set(inst->cfg->netstatus.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); +} + +static void _netstatus_cb_usage_check_main(void *data, Ecore_Thread *th) { Thread_Config *thc = data; for (;;) { if (ecore_thread_check(th)) break; - E_FREE_FUNC(thc->rstatus, eina_stringshare_del); - E_FREE_FUNC(thc->tstatus, eina_stringshare_del); - thc->rstatus = _netstatus_proc_getrstatus(thc->inst); - thc->tstatus = _netstatus_proc_gettstatus(thc->inst); +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) + _netstatus_sysctl_getrstatus(thc->inst); + _netstatus_sysctl_gettstatus(thc->inst); +#else + _netstatus_proc_getrstatus(thc->inst); + _netstatus_proc_gettstatus(thc->inst); +#endif ecore_thread_feedback(th, NULL); if (ecore_thread_check(th)) break; usleep((1000000.0 / 8.0) * (double)thc->interval); } - E_FREE_FUNC(thc->rstatus, eina_stringshare_del); - E_FREE_FUNC(thc->tstatus, eina_stringshare_del); - E_FREE_FUNC(thc, free); } static void @@ -66,8 +152,14 @@ if (!inst->cfg) return; if (inst->cfg->esm != E_SYSINFO_MODULE_NETSTATUS && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return; - _netstatus_face_update(inst, EINA_FALSE, thc->rstatus); - _netstatus_face_update(inst, EINA_TRUE, thc->tstatus); + _netstatus_face_update(inst); +} + +static void +_netstatus_cb_usage_check_end(void *data, Ecore_Thread *th EINA_UNUSED) +{ + Thread_Config *thc = data; + E_FREE_FUNC(thc, free); } void @@ -88,7 +180,8 @@ inst->cfg->netstatus.usage_check_thread = ecore_thread_feedback_run(_netstatus_cb_usage_check_main, _netstatus_cb_usage_check_notify, - NULL, NULL, thc, EINA_TRUE); + _netstatus_cb_usage_check_end, + _netstatus_cb_usage_check_end, thc, EINA_TRUE); } e_config_save_queue(); } @@ -100,11 +193,17 @@ if (inst->o_main != event_data) return; + if (inst->cfg->netstatus.popup) + E_FREE_FUNC(inst->cfg->netstatus.popup, evas_object_del); + if (inst->cfg->netstatus.configure) + E_FREE_FUNC(inst->cfg->netstatus.configure, evas_object_del); if (inst->cfg->netstatus.usage_check_thread) { ecore_thread_cancel(inst->cfg->netstatus.usage_check_thread); inst->cfg->netstatus.usage_check_thread = NULL; } + E_FREE_FUNC(inst->cfg->netstatus.instring, eina_stringshare_del); + E_FREE_FUNC(inst->cfg->netstatus.outstring, eina_stringshare_del); evas_object_event_callback_del_full(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_netstatus_remove, data); sysinfo_config->items = eina_list_remove(sysinfo_config->items, inst->cfg); @@ -116,24 +215,40 @@ { Instance *inst = data; + if (inst->cfg->netstatus.popup) + E_FREE_FUNC(inst->cfg->netstatus.popup, evas_object_del); + if (inst->cfg->netstatus.configure) + E_FREE_FUNC(inst->cfg->netstatus.configure, evas_object_del); if (inst->cfg->netstatus.usage_check_thread) { ecore_thread_cancel(inst->cfg->netstatus.usage_check_thread); inst->cfg->netstatus.usage_check_thread = NULL; } + E_FREE_FUNC(inst->cfg->netstatus.instring, eina_stringshare_del); + E_FREE_FUNC(inst->cfg->netstatus.outstring, eina_stringshare_del); } static void _netstatus_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) { Instance *inst = data; + E_Gadget_Site_Orient orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); + + e_gadget_configure_cb_set(inst->o_main, _netstatus_configure_cb); inst->cfg->netstatus.o_gadget = elm_layout_add(inst->o_main); - e_theme_edje_object_set(inst->cfg->netstatus.o_gadget, "base/theme/modules/netstatus", - "e/modules/netstatus/main"); + if (orient == E_GADGET_SITE_ORIENT_VERTICAL) + e_theme_edje_object_set(inst->cfg->netstatus.o_gadget, + "base/theme/modules/netstatus", + "e/modules/netstatus/main_vert"); + else + e_theme_edje_object_set(inst->cfg->netstatus.o_gadget, "base/theme/modules/netstatus", + "e/modules/netstatus/main"); E_EXPAND(inst->cfg->netstatus.o_gadget); E_FILL(inst->cfg->netstatus.o_gadget); elm_box_pack_end(inst->o_main, inst->cfg->netstatus.o_gadget); + evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _netstatus_mouse_down_cb, inst); + evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_RESIZE, _netstatus_resize_cb, inst); evas_object_show(inst->cfg->netstatus.o_gadget); evas_object_smart_callback_del_full(obj, "gadget_created", _netstatus_created_cb, data); _netstatus_config_updated(inst); @@ -147,6 +262,8 @@ "e/modules/netstatus/main"); E_EXPAND(inst->cfg->netstatus.o_gadget); E_FILL(inst->cfg->netstatus.o_gadget); + evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _netstatus_mouse_down_cb, inst); + evas_object_event_callback_add(inst->cfg->netstatus.o_gadget, EVAS_CALLBACK_RESIZE, _netstatus_resize_cb, inst); evas_object_show(inst->cfg->netstatus.o_gadget); _netstatus_config_updated(inst); @@ -174,8 +291,21 @@ ci->esm = E_SYSINFO_MODULE_NETSTATUS; ci->netstatus.poll_interval = 32; + ci->netstatus.automax = EINA_TRUE; + ci->netstatus.inmax = 0; + ci->netstatus.outmax = 0; + ci->netstatus.receive_units = NETSTATUS_UNIT_BYTES; + ci->netstatus.send_units = NETSTATUS_UNIT_BYTES; ci->netstatus.in = 0; ci->netstatus.out = 0; + ci->netstatus.incurrent = 0; + ci->netstatus.outcurrent = 0; + ci->netstatus.inpercent = 0; + ci->netstatus.outpercent = 0; + ci->netstatus.instring = NULL; + ci->netstatus.outstring = NULL; + ci->netstatus.popup = NULL; + ci->netstatus.configure = NULL; sysinfo_config->items = eina_list_append(sysinfo_config->items, ci); return ci; @@ -191,9 +321,16 @@ *id = inst->cfg->id; inst->cfg->netstatus.in = 0; inst->cfg->netstatus.out = 0; + inst->cfg->netstatus.incurrent = 0; + inst->cfg->netstatus.outcurrent = 0; + inst->cfg->netstatus.inpercent = 0; + inst->cfg->netstatus.outpercent = 0; + inst->cfg->netstatus.instring = NULL; + inst->cfg->netstatus.outstring = NULL; + inst->cfg->netstatus.popup = NULL; inst->o_main = elm_box_add(parent); E_EXPAND(inst->o_main); - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, 1); + evas_object_data_set(inst->o_main, "Instance", inst); evas_object_smart_callback_add(parent, "gadget_created", _netstatus_created_cb, inst); evas_object_smart_callback_add(parent, "gadget_removed", _netstatus_removed_cb, inst); evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_netstatus_remove, inst); diff -Nru e20-201702271931/src/modules/sysinfo/netstatus/netstatus_config.c e20-201702281931/src/modules/sysinfo/netstatus/netstatus_config.c --- e20-201702271931/src/modules/sysinfo/netstatus/netstatus_config.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/netstatus/netstatus_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,409 @@ +#include "netstatus.h" + +static void +_config_close(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + + E_FREE_FUNC(inst->cfg->netstatus.configure, evas_object_del); + E_FREE_FUNC(nc, free); + e_config_save_queue(); +} + +static void +_poll_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + int value = elm_radio_value_get(obj); + + switch(value) + { + case 0: + inst->cfg->netstatus.poll_interval = 4; + break; + case 1: + inst->cfg->netstatus.poll_interval = 8; + break; + case 2: + inst->cfg->netstatus.poll_interval = 32; + break; + case 3: + inst->cfg->netstatus.poll_interval = 64; + break; + case 4: + inst->cfg->netstatus.poll_interval = 256; + break; + default: + inst->cfg->netstatus.poll_interval = 32; + } + + e_config_save_queue(); + _netstatus_config_updated(inst); +} + +static void +_update_receive_maximums(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + int value = elm_slider_value_get(nc->receive_max); + + inst->cfg->netstatus.inmax = value * nc->receive_unit_adjust; + e_config_save_queue(); + _netstatus_config_updated(inst); +} + +static void +_update_send_maximums(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + int value = elm_slider_value_get(nc->send_max); + + inst->cfg->netstatus.outmax = value * nc->send_unit_adjust; + e_config_save_queue(); + _netstatus_config_updated(inst); +} + +static void +_receive_hover_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + const char *txt = elm_object_item_text_get(event_info); + + if (!strcmp(txt, _("Bytes"))) + { + inst->cfg->netstatus.receive_units = NETSTATUS_UNIT_BYTES; + nc->receive_unit_adjust = 1; + } + if (!strcmp(txt, _("KB"))) + { + inst->cfg->netstatus.receive_units = NETSTATUS_UNIT_KB; + nc->receive_unit_adjust = 1024; + } + if (!strcmp(txt, _("MB"))) + { + inst->cfg->netstatus.receive_units = NETSTATUS_UNIT_MB; + nc->receive_unit_adjust = 2048; + } + if (!strcmp(txt, _("GB"))) + { + inst->cfg->netstatus.receive_units = NETSTATUS_UNIT_GB; + nc->receive_unit_adjust = 3072; + } + _update_receive_maximums(nc, NULL, NULL); +} + +static void +_send_hover_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + const char *txt = elm_object_item_text_get(event_info); + + if (!strcmp(txt, _("Bytes"))) + { + inst->cfg->netstatus.send_units = NETSTATUS_UNIT_BYTES; + nc->send_unit_adjust = 1; + } + if (!strcmp(txt, _("KB"))) + { + inst->cfg->netstatus.send_units = NETSTATUS_UNIT_KB; + nc->send_unit_adjust = 1024; + } + if (!strcmp(txt, _("MB"))) + { + inst->cfg->netstatus.send_units = NETSTATUS_UNIT_MB; + nc->send_unit_adjust = 2048; + } + if (!strcmp(txt, _("GB"))) + { + inst->cfg->netstatus.send_units = NETSTATUS_UNIT_GB; + nc->send_unit_adjust = 3072; + } + _update_send_maximums(nc, NULL, NULL); +} + +static void +_check_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Netstatus_Config *nc = data; + Instance *inst = nc->inst; + + if (elm_check_state_get(nc->transfer_check)) + { + elm_object_disabled_set(nc->receive_max, EINA_TRUE); + elm_object_disabled_set(nc->receive_units, EINA_TRUE); + elm_object_disabled_set(nc->send_max, EINA_TRUE); + elm_object_disabled_set(nc->send_units, EINA_TRUE); + inst->cfg->netstatus.automax = EINA_TRUE; + } + else + { + elm_object_disabled_set(nc->receive_max, EINA_FALSE); + elm_object_disabled_set(nc->receive_units, EINA_FALSE); + elm_object_disabled_set(nc->send_max, EINA_FALSE); + elm_object_disabled_set(nc->send_units, EINA_FALSE); + inst->cfg->netstatus.automax = EINA_FALSE; + _update_receive_maximums(nc, NULL, NULL); + _update_send_maximums(nc, NULL, NULL); + } +} + +Evas_Object * +netstatus_configure(Instance *inst) +{ + Evas_Object *popup, *frame, *main_box, *box, *o, *group, *lbl; + Evas_Object *hover, *slider, *check; + E_Zone *zone = e_zone_current_get(); + Netstatus_Config *nc = E_NEW(Netstatus_Config, 1); + + nc->inst = inst; + + popup = elm_popup_add(e_comp->elm); + E_EXPAND(popup); + elm_popup_allow_events_set(popup, 1); + elm_popup_scrollable_set(popup, 1); + + main_box = elm_box_add(popup); + elm_box_horizontal_set(main_box, EINA_FALSE); + E_EXPAND(main_box); + E_FILL(main_box); + evas_object_show(main_box); + elm_object_content_set(popup, main_box); + + lbl = elm_label_add(main_box); + evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_style_set(lbl, "marker"); + elm_object_text_set(lbl, _("NetStatus Configuration")); + elm_box_pack_end(main_box, lbl); + evas_object_show(lbl); + + frame = elm_frame_add(main_box); + elm_object_text_set(frame, _("Update Poll Interval")); + E_EXPAND(frame); + E_FILL(frame); + elm_box_pack_end(main_box, frame); + evas_object_show(frame); + + box = elm_box_add(frame); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 0); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Fast (4 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, nc); + evas_object_show(o); + group = o; + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 1); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Medium (8 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, nc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 2); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Normal (32 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, nc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 3); + elm_radio_group_add(o, group); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Slow (64 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, nc); + evas_object_show(o); + + o = elm_radio_add(box); + elm_radio_state_value_set(o, 4); + elm_radio_group_add(o, group); + E_EXPAND(o); + E_ALIGN(o, 0, 0); + elm_object_text_set(o, _("Very Slow (256 ticks)")); + elm_box_pack_end(box, o); + evas_object_smart_callback_add(o, "changed", _poll_changed, nc); + evas_object_show(o); + + switch(inst->cfg->netstatus.poll_interval) + { + case 4: + elm_radio_value_set(group, 0); + break; + case 8: + elm_radio_value_set(group, 1); + break; + case 32: + elm_radio_value_set(group, 2); + break; + case 64: + elm_radio_value_set(group, 3); + break; + case 256: + elm_radio_value_set(group, 4); + break; + default: + elm_radio_value_set(group, 2); + } + + elm_object_content_set(frame, box); + + frame = elm_frame_add(main_box); + elm_object_text_set(frame, _("Maximum Transfer Speed")); + E_EXPAND(frame); + E_FILL(frame); + elm_box_pack_end(main_box, frame); + evas_object_show(frame); + + box = elm_box_add(frame); + elm_box_horizontal_set(box, EINA_FALSE); + E_EXPAND(box); + evas_object_show(box); + + check = elm_check_add(box); + elm_object_text_set(check, _("Use Automatic Maximums")); + elm_check_state_set(check, inst->cfg->netstatus.automax); + evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(check, "changed", _check_changed, nc); + elm_box_pack_end(box, check); + evas_object_show(check); + nc->transfer_check = check; + + slider = elm_slider_add(box); + elm_object_text_set(slider, _("Receive:")); + elm_slider_unit_format_set(slider, "%1.0f"); + elm_slider_indicator_format_set(slider, "%1.0f"); + elm_slider_min_max_set(slider, 0, 1000); + elm_slider_value_set(slider, inst->cfg->netstatus.inmax); + elm_slider_step_set(slider, 10); + elm_slider_span_size_set(slider, 100); + evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(slider, "delay,changed", _update_receive_maximums, nc); + if (inst->cfg->netstatus.automax) elm_object_disabled_set(slider, EINA_TRUE); + elm_box_pack_end(box, slider); + evas_object_show(slider); + nc->receive_max = slider; + + hover = elm_hoversel_add(box); + elm_hoversel_auto_update_set(hover, EINA_TRUE); + elm_hoversel_hover_parent_set(hover, popup); + elm_hoversel_item_add(hover, _("Bytes"), NULL, ELM_ICON_NONE, NULL, NULL); + if (inst->cfg->netstatus.receive_units == NETSTATUS_UNIT_BYTES) + { + elm_object_text_set(hover, _("Bytes")); + nc->receive_unit_adjust = 1; + } + elm_hoversel_item_add(hover, _("KB"), NULL, ELM_ICON_NONE, NULL, NULL); + if (inst->cfg->netstatus.receive_units == NETSTATUS_UNIT_KB) + { + elm_object_text_set(hover, _("KB")); + nc->receive_unit_adjust = 1024; + } + elm_hoversel_item_add(hover, _("MB"), NULL, ELM_ICON_NONE, NULL, NULL); + if (inst->cfg->netstatus.receive_units == NETSTATUS_UNIT_MB) + { + elm_object_text_set(hover, _("MB")); + nc->receive_unit_adjust = 2048; + } + elm_hoversel_item_add(hover, _("GB"), NULL, ELM_ICON_NONE, NULL, NULL); + if (inst->cfg->netstatus.receive_units == NETSTATUS_UNIT_GB) + { + elm_object_text_set(hover, _("GB")); + nc->receive_unit_adjust = 3072; + } + evas_object_size_hint_align_set(hover, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(hover, EVAS_HINT_EXPAND, 0.0); + if (inst->cfg->netstatus.automax) elm_object_disabled_set(hover, EINA_TRUE); + evas_object_smart_callback_add(hover, "selected", _receive_hover_changed, nc); + elm_box_pack_end(box, hover); + evas_object_show(hover); + nc->receive_units = hover; + + elm_slider_value_set(nc->receive_max, ceil((double)inst->cfg->netstatus.inmax / (double)nc->receive_unit_adjust)); + + slider = elm_slider_add(box); + elm_object_text_set(slider, _("Send:")); + elm_slider_unit_format_set(slider, "%1.0f"); + elm_slider_indicator_format_set(slider, "%1.0f"); + elm_slider_min_max_set(slider, 0, 1000); + elm_slider_value_set(slider, inst->cfg->netstatus.outmax); + elm_slider_step_set(slider, 10); + elm_slider_span_size_set(slider, 100); + evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(slider, "delay,changed", _update_send_maximums, nc); + if (inst->cfg->netstatus.automax) elm_object_disabled_set(slider, EINA_TRUE); + elm_box_pack_end(box, slider); + evas_object_show(slider); + nc->send_max = slider; + + hover = elm_hoversel_add(box); + elm_hoversel_auto_update_set(hover, EINA_TRUE); + elm_hoversel_hover_parent_set(hover, popup); + elm_hoversel_item_add(hover, _("Bytes"), NULL, ELM_ICON_NONE, NULL, nc); + if (inst->cfg->netstatus.send_units == NETSTATUS_UNIT_BYTES) + { + elm_object_text_set(hover, _("Bytes")); + nc->send_unit_adjust = 1; + } + elm_hoversel_item_add(hover, _("KB"), NULL, ELM_ICON_NONE, NULL, nc); + if (inst->cfg->netstatus.send_units == NETSTATUS_UNIT_KB) + { + elm_object_text_set(hover, _("KB")); + nc->send_unit_adjust = 1024; + } + elm_hoversel_item_add(hover, _("MB"), NULL, ELM_ICON_NONE, NULL, nc); + if (inst->cfg->netstatus.send_units == NETSTATUS_UNIT_MB) + { + elm_object_text_set(hover, _("MB")); + nc->send_unit_adjust = 2048; + } + elm_hoversel_item_add(hover, _("GB"), NULL, ELM_ICON_NONE, NULL, nc); + if (inst->cfg->netstatus.send_units == NETSTATUS_UNIT_GB) + { + elm_object_text_set(hover, _("GB")); + nc->send_unit_adjust = 3072; + } + evas_object_size_hint_align_set(hover, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(hover, EVAS_HINT_EXPAND, 0.0); + if (inst->cfg->netstatus.automax) elm_object_disabled_set(hover, EINA_TRUE); + evas_object_smart_callback_add(hover, "selected", _send_hover_changed, nc); + elm_box_pack_end(box, hover); + evas_object_show(hover); + nc->send_units = hover; + + elm_slider_value_set(nc->send_max, ceil((double)inst->cfg->netstatus.outmax / (double)nc->send_unit_adjust)); + + elm_object_content_set(frame, box); + popup = e_comp_object_util_add(popup, E_COMP_OBJECT_TYPE_NONE); + evas_object_layer_set(popup, E_LAYER_POPUP); + evas_object_resize(popup, zone->w / 4, zone->h / 3); + e_comp_object_util_center_on_zone(popup, zone); + evas_object_show(popup); + e_comp_object_util_autoclose(popup, NULL, e_comp_object_util_autoclose_on_escape, NULL); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _config_close, nc); + + return inst->cfg->netstatus.configure = popup; +} + diff -Nru e20-201702271931/src/modules/sysinfo/netstatus/netstatus.h e20-201702281931/src/modules/sysinfo/netstatus/netstatus.h --- e20-201702271931/src/modules/sysinfo/netstatus/netstatus.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/netstatus/netstatus.h 2017-02-28 19:31:37.000000000 +0000 @@ -3,8 +3,23 @@ #include "../sysinfo.h" -void _netstatus_config_updated(Instance *inst); -const char *_netstatus_proc_getrstatus(Instance *inst); -const char *_netstatus_proc_gettstatus(Instance *inst); +typedef struct _Netstatus_Config Netstatus_Config; +struct _Netstatus_Config +{ + Instance *inst; + Evas_Object *transfer_check; + Evas_Object *receive_max; + Evas_Object *receive_units; + Evas_Object *send_max; + Evas_Object *send_units; + int receive_unit_adjust; + int send_unit_adjust; +}; +void _netstatus_config_updated(Instance *inst); +void _netstatus_proc_getrstatus(Instance *inst); +void _netstatus_proc_gettstatus(Instance *inst); +void _netstatus_sysctl_getrstatus(Instance *inst); +void _netstatus_sysctl_gettstatus(Instance *inst); +Evas_Object *netstatus_configure(Instance *inst); #endif diff -Nru e20-201702271931/src/modules/sysinfo/netstatus/netstatus_proc.c e20-201702281931/src/modules/sysinfo/netstatus/netstatus_proc.c --- e20-201702271931/src/modules/sysinfo/netstatus/netstatus_proc.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/netstatus/netstatus_proc.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,10 +1,11 @@ #include "netstatus.h" -const char * +void _netstatus_proc_getrstatus(Instance *inst) { long in, dummy, tot_in = 0; long diffin; + int percent = 0; char buf[4096], rin[4096], dummys[64]; FILE *f; @@ -23,26 +24,45 @@ fclose(f); } diffin = tot_in - inst->cfg->netstatus.in; - inst->cfg->netstatus.in = tot_in; - if (!diffin) return NULL; + if (!inst->cfg->netstatus.in) + inst->cfg->netstatus.in = tot_in; else { - diffin /= 0.5; + inst->cfg->netstatus.in = tot_in; + if (inst->cfg->netstatus.automax) + { + if (diffin > inst->cfg->netstatus.inmax) + inst->cfg->netstatus.inmax = diffin; + } + inst->cfg->netstatus.incurrent = diffin; + if (inst->cfg->netstatus.inmax > 0) + percent = 100 * ((float)inst->cfg->netstatus.incurrent / (float)inst->cfg->netstatus.inmax); + if (percent > 100) percent = 100; + else if (percent < 0) percent = 0; + inst->cfg->netstatus.inpercent = percent; + } + if (!diffin) + { + snprintf(rin, sizeof(rin), "%s: 0 B/s", _("Receiving")); + } + else + { if (diffin > 1048576) - snprintf(rin, sizeof(rin), "Rx: %.2f MB/s", ((float)diffin / 1048576)); + snprintf(rin, sizeof(rin), "%s: %.2f MB/s", _("Receiving"), ((float)diffin / 1048576)); else if ((diffin > 1024) && (diffin < 1048576)) - snprintf(rin, sizeof(rin), "Rx: %lu KB/s", (diffin / 1024)); + snprintf(rin, sizeof(rin), "%s: %lu KB/s", _("Receiving"), (diffin / 1024)); else - snprintf(rin, sizeof(rin), "Rx: %lu B/s", diffin); + snprintf(rin, sizeof(rin), "%s: %lu B/s", _("Receiving"), diffin); } - return eina_stringshare_add(rin); + eina_stringshare_replace(&inst->cfg->netstatus.instring, rin); } -const char * - _netstatus_proc_gettstatus(Instance *inst) +void +_netstatus_proc_gettstatus(Instance *inst) { long out, dummy, tot_out = 0; long diffout; + int percent = 0; char buf[4096], rout[4096], dummys[64]; FILE *f; @@ -61,18 +81,36 @@ fclose(f); } diffout = tot_out - inst->cfg->netstatus.out; - inst->cfg->netstatus.out = tot_out; - if (!diffout) return NULL; + if (!inst->cfg->netstatus.out) + inst->cfg->netstatus.out = tot_out; + else + { + inst->cfg->netstatus.out = tot_out; + if (inst->cfg->netstatus.automax) + { + if (diffout > inst->cfg->netstatus.outmax) + inst->cfg->netstatus.outmax = diffout; + } + inst->cfg->netstatus.outcurrent = diffout; + if (inst->cfg->netstatus.outcurrent > 0) + percent = 100 * ((float)inst->cfg->netstatus.outcurrent / (float)inst->cfg->netstatus.outmax); + if (percent > 100) percent = 100; + else if (percent < 0) percent = 0; + inst->cfg->netstatus.outpercent = percent; + } + if (!diffout) + { + snprintf(rout, sizeof(rout), "%s: 0 B/s", _("Sending")); + } else { - diffout /= 0.5; if (diffout > 1048576) - snprintf(rout, sizeof(rout), "Tx: %.2f MB/s", ((float)diffout / 1048576)); + snprintf(rout, sizeof(rout), "%s: %.2f MB/s", _("Sending"), ((float)diffout / 1048576)); else if ((diffout > 1024) && (diffout < 1048576)) - snprintf(rout, sizeof(rout), "Tx: %lu KB/s", (diffout / 1024)); + snprintf(rout, sizeof(rout), "%s: %lu KB/s", _("Sending"), (diffout / 1024)); else - snprintf(rout, sizeof(rout), "Tx: %lu B/s", diffout); + snprintf(rout, sizeof(rout), "%s: %lu B/s", _("Sending"), diffout); } - return eina_stringshare_add(rout); + eina_stringshare_replace(&inst->cfg->netstatus.outstring, rout); } diff -Nru e20-201702271931/src/modules/sysinfo/netstatus/netstatus_sysctl.c e20-201702281931/src/modules/sysinfo/netstatus/netstatus_sysctl.c --- e20-201702271931/src/modules/sysinfo/netstatus/netstatus_sysctl.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/netstatus/netstatus_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,203 @@ +#include "netstatus.h" +#if defined(__FreeBSD__) || defined(__DragonFly__) +# include +# include +# include +# include +#endif + +#if defined(__OpenBSD__) +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if defined(__FreeBSD__) || defined(__DragonFly__) + +static int +get_ifmib_general(int row, struct ifmibdata *data) +{ + int mib[6]; + size_t len; + + mib[0] = CTL_NET; + mib[1] = PF_LINK; + mib[2] = NETLINK_GENERIC; + mib[3] = IFMIB_IFDATA; + mib[4] = row; + mib[5] = IFDATA_GENERAL; + + len = sizeof(*data); + + return sysctl(mib, 6, data, &len, NULL, 0); +} + +static void +_freebsd_generic_network_status(unsigned long int *in, unsigned long int *out) +{ + struct ifmibdata *ifmd; + size_t len; + int i, count; + + len = sizeof(count); + if (sysctlbyname("net.link.generic.system.ifcount", &count, &len, NULL, 0) < 0) + return; + + ifmd = malloc(sizeof(struct ifmibdata)); + if (!ifmd) + return; + + for (i = 1; i <= count; i++) + { + get_ifmib_general(i, ifmd); + *in += ifmd->ifmd_data.ifi_ibytes; + *out += ifmd->ifmd_data.ifi_obytes; + } + + free(ifmd); +} + +#endif + +#if defined(__OpenBSD__) +static void +_openbsd_generic_network_status(unsigned long int *in, unsigned long int *out) +{ + struct ifaddrs *interfaces, *ifa; + + if (getifaddrs(&interfaces) < 0) + return; + + int sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock < 0) + return; + + for (ifa = interfaces; ifa; ifa = ifa->ifa_next) + { + struct ifreq ifreq; + struct if_data if_data; + + ifreq.ifr_data = (void *)&if_data; + strncpy(ifreq.ifr_name, ifa->ifa_name, IFNAMSIZ-1); + if (ioctl(sock, SIOCGIFDATA, &ifreq) < 0) + return; + + struct if_data * const ifi = &if_data; + if (ifi->ifi_type == IFT_ETHER || ifi->ifi_type == IFT_IEEE80211) + { + if (ifi->ifi_ibytes) + *in += ifi->ifi_ibytes; + else + *in += 0; + + if (ifi->ifi_obytes) + *out += ifi->ifi_obytes; + else + *out += 0; + } + } + close(sock); +} +#endif + +void +_netstatus_sysctl_getrstatus(Instance *inst) +{ + char rin[256]; + long tot_in = 0, diffin; + int percent = 0; + unsigned long int incoming = 0, outgoing = 0; +#if defined(__OpenBSD__) + _openbsd_generic_network_status(&incoming, &outgoing); +#elif defined(__FreeBSD__) || defined(__DragonFly__) + _freebsd_generic_network_status(&incoming, &outgoing); +#endif + + tot_in = incoming; + diffin = tot_in - inst->cfg->netstatus.in; + if (!inst->cfg->netstatus.in) + inst->cfg->netstatus.in = tot_in; + else + { + inst->cfg->netstatus.in = tot_in; + if (inst->cfg->netstatus.automax) + { + if (diffin > inst->cfg->netstatus.inmax) + inst->cfg->netstatus.inmax = diffin; + } + inst->cfg->netstatus.incurrent = diffin; + if (inst->cfg->netstatus.inmax > 0) + percent = 100 * ((float)inst->cfg->netstatus.incurrent / (float)inst->cfg->netstatus.inmax); + if (percent > 100) percent = 100; + else if (percent < 0) percent = 0; + inst->cfg->netstatus.inpercent = percent; + } + if (!diffin) + { + snprintf(rin, sizeof(rin), "%s: 0 B/s", _("Receiving")); + } + else + { + if (diffin > 1048576) + snprintf(rin, sizeof(rin), "%s: %.2f MB/s", _("Receiving"), ((float)diffin / 1048576)); + else if ((diffin > 1024) && (diffin < 1048576)) + snprintf(rin, sizeof(rin), "%s: %lu KB/s", _("Receiving"), (diffin / 1024)); + else + snprintf(rin, sizeof(rin), "%s: %lu B/s", _("Receiving"), diffin); + } + eina_stringshare_replace(&inst->cfg->netstatus.instring, rin); +} + +void +_netstatus_sysctl_gettstatus(Instance *inst) +{ + char rout[256]; + long tot_out = 0, diffout; + int percent = 0; + unsigned long int incoming = 0, outgoing = 0; +#if defined(__OpenBSD__) + _openbsd_generic_network_status(&incoming, &outgoing); +#elif defined(__FreeBSD__) || defined(__DragonFly__) + _freebsd_generic_network_status(&incoming, &outgoing); +#endif + tot_out = outgoing; + + diffout = tot_out - inst->cfg->netstatus.out; + if (!inst->cfg->netstatus.out) + inst->cfg->netstatus.out = tot_out; + else + { + inst->cfg->netstatus.out = tot_out; + if (inst->cfg->netstatus.automax) + { + if (diffout > inst->cfg->netstatus.outmax) + inst->cfg->netstatus.outmax = diffout; + } + inst->cfg->netstatus.outcurrent = diffout; + if (inst->cfg->netstatus.outcurrent > 0) + percent = 100 * ((float)inst->cfg->netstatus.outcurrent / (float)inst->cfg->netstatus.outmax); + if (percent > 100) percent = 100; + else if (percent < 0) percent = 0; + inst->cfg->netstatus.outpercent = percent; + } + if (!diffout) + { + snprintf(rout, sizeof(rout), "%s: 0 B/s", _("Sending")); + } + else + { + if (diffout > 1048576) + snprintf(rout, sizeof(rout), "%s: %.2f MB/s", _("Sending"), ((float)diffout / 1048576)); + else if ((diffout > 1024) && (diffout < 1048576)) + snprintf(rout, sizeof(rout), "%s: %lu KB/s", _("Sending"), (diffout / 1024)); + else + snprintf(rout, sizeof(rout), "%s: %lu B/s", _("Sending"), diffout); + } + eina_stringshare_replace(&inst->cfg->netstatus.outstring, rout); +} + diff -Nru e20-201702271931/src/modules/sysinfo/sysinfo.c e20-201702281931/src/modules/sysinfo/sysinfo.c --- e20-201702271931/src/modules/sysinfo/sysinfo.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/sysinfo.c 2017-02-28 19:31:37.000000000 +0000 @@ -41,22 +41,21 @@ Instance *inst = data; inst->o_table = elm_table_add(inst->o_main); - elm_table_homogeneous_set(inst->o_table, EINA_TRUE); + elm_table_homogeneous_set(inst->o_table, EINA_FALSE); E_EXPAND(inst->o_table); - evas_object_size_hint_aspect_set(inst->o_table, EVAS_ASPECT_CONTROL_BOTH, 1, 1); elm_object_content_set(inst->o_main, inst->o_table); evas_object_show(inst->o_table); inst->cfg->sysinfo.o_batman = sysinfo_batman_create(inst->o_table, inst); elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_batman, 0, 0, 1, 1); - inst->cfg->sysinfo.o_thermal = sysinfo_thermal_create(inst->o_table, inst); - elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_thermal, 1, 0, 1, 1); inst->cfg->sysinfo.o_cpuclock = sysinfo_cpuclock_create(inst->o_table, inst); - elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_cpuclock, 0, 1, 1, 1); + elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_cpuclock, 1, 0, 1, 1); inst->cfg->sysinfo.o_cpumonitor = sysinfo_cpumonitor_create(inst->o_table, inst); - elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_cpumonitor, 1, 1, 1, 1); + elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_cpumonitor, 0, 1, 1, 1); inst->cfg->sysinfo.o_memusage = sysinfo_memusage_create(inst->o_table, inst); - elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_memusage, 0, 2, 1, 1); + elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_memusage, 1, 1, 1, 1); + inst->cfg->sysinfo.o_thermal = sysinfo_thermal_create(inst->o_table, inst); + elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_thermal, 0, 2, 1, 1); inst->cfg->sysinfo.o_netstatus = sysinfo_netstatus_create(inst->o_table, inst); elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_netstatus, 1, 2, 1, 1); @@ -91,13 +90,14 @@ ci->batman.force_mode = 0; ci->batman.full = -2; ci->batman.time_left = -2; - ci->batman.time_full = -2; ci->batman.have_battery = -2; ci->batman.have_power = -2; #if defined HAVE_EEZE || defined __OpenBSD__ || defined __NetBSD__ ci->batman.fuzzy = 0; #endif ci->batman.desktop_notifications = 0; + ci->batman.popup = NULL; + ci->batman.configure = NULL; ci->thermal.poll_interval = 128; ci->thermal.low = 30; ci->thermal.high = 80; @@ -114,10 +114,32 @@ ci->cpumonitor.poll_interval = 32; ci->cpumonitor.total = 0; ci->cpumonitor.idle = 0; + ci->cpumonitor.percent = 0; + ci->cpumonitor.popup = NULL; + ci->cpumonitor.configure = NULL; ci->memusage.poll_interval = 32; + ci->memusage.mem_percent = 0; + ci->memusage.swp_percent = 0; + ci->memusage.popup = NULL; + ci->memusage.configure = NULL; ci->netstatus.poll_interval = 32; ci->netstatus.in = 0; ci->netstatus.out = 0; + ci->netstatus.inmax = 0; + ci->netstatus.outmax = 0; + ci->netstatus.incurrent = 0; + ci->netstatus.outcurrent = 0; + ci->netstatus.inpercent = 0; + ci->netstatus.outpercent = 0; + ci->netstatus.instring = NULL; + ci->netstatus.outstring = NULL; + ci->netstatus.popup = NULL; + ci->netstatus.configure = NULL; + ci->netstatus.automax = EINA_TRUE; + ci->netstatus.inmax = 0; + ci->netstatus.outmax = 0; + ci->netstatus.receive_units = NETSTATUS_UNIT_BYTES; + ci->netstatus.send_units = NETSTATUS_UNIT_BYTES; sysinfo_config->items = eina_list_append(sysinfo_config->items, ci); @@ -136,7 +158,6 @@ inst->o_main = elm_scroller_add(parent); elm_object_style_set(inst->o_main, "no_inset_shadow"); E_EXPAND(inst->o_main); - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, _sysinfo_deleted_cb, inst); evas_object_show(inst->o_main); diff -Nru e20-201702271931/src/modules/sysinfo/sysinfo.h e20-201702281931/src/modules/sysinfo/sysinfo.h --- e20-201702271931/src/modules/sysinfo/sysinfo.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/sysinfo.h 2017-02-28 19:31:37.000000000 +0000 @@ -27,6 +27,15 @@ E_SYSINFO_MODULE_SYSINFO }; +typedef enum _Netstatus_Unit Netstatus_Unit; +enum _Netstatus_Unit +{ + NETSTATUS_UNIT_BYTES = 0, + NETSTATUS_UNIT_KB, + NETSTATUS_UNIT_MB, + NETSTATUS_UNIT_GB +}; + typedef enum _Sensor_Type { SENSOR_TYPE_NONE, @@ -112,10 +121,13 @@ struct _Config_Item { int id; + int version; E_Sysinfo_Module esm; struct { Evas_Object *o_gadget; + Evas_Object *popup; + Evas_Object *configure; /* saved * loaded config values */ int poll_interval; int alert; /* Alert on minutes remaining */ @@ -125,13 +137,9 @@ int suspend_method; /* Method used to suspend the machine */ int force_mode; /* force use of batget or hal */ /* just config state */ - Ecore_Exe *batget_exe; - Ecore_Event_Handler *batget_data_handler; - Ecore_Event_Handler *batget_del_handler; Ecore_Timer *alert_timer; int full; int time_left; - int time_full; int have_battery; int have_power; int desktop_notifications; @@ -178,24 +186,56 @@ struct { Evas_Object *o_gadget; + Evas_Object *o_gadget_box; + Evas_Object *event; + Evas_Object *popup; + Evas_Object *popup_pbar; + Evas_Object *configure; int poll_interval; + int percent; long total; long idle; + Ecore_Thread *usage_check_thread; Eina_List *cores; } cpumonitor; struct { Evas_Object *o_gadget; + Evas_Object *popup; + Evas_Object *configure; int poll_interval; + int mem_percent; + int swp_percent; + unsigned long mem_total; + unsigned long mem_used; + unsigned long mem_cached; + unsigned long mem_buffers; + unsigned long mem_shared; + unsigned long swp_total; + unsigned long swp_used; Ecore_Thread *usage_check_thread; } memusage; struct { Evas_Object *o_gadget; + Evas_Object *popup; + Evas_Object *popup_label; + Evas_Object *configure; + Eina_Bool automax; + Netstatus_Unit receive_units; + Netstatus_Unit send_units; int poll_interval; long in; long out; + long incurrent; + long outcurrent; + long inmax; + long outmax; + int inpercent; + int outpercent; + Eina_Stringshare *instring; + Eina_Stringshare *outstring; Ecore_Thread *usage_check_thread; } netstatus; struct { diff -Nru e20-201702271931/src/modules/sysinfo/thermal/thermal.c e20-201702281931/src/modules/sysinfo/thermal/thermal.c --- e20-201702271931/src/modules/sysinfo/thermal/thermal.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/thermal/thermal.c 2017-02-28 19:31:37.000000000 +0000 @@ -3,11 +3,14 @@ static void _thermal_thread_free(Tempthread *tth) { +#if defined(HAVE_EEZE) const char *s; +#endif + if (!tth) return; eina_stringshare_del(tth->sensor_name); eina_stringshare_del(tth->sensor_path); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) EINA_LIST_FREE(tth->tempdevs, s) eina_stringshare_del(s); #endif free(tth->extn); @@ -65,7 +68,7 @@ } } -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) static Eina_Bool _thermal_udev_poll(void *data) { @@ -77,7 +80,7 @@ } #endif -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __DragonflyBSD__ +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) static void _thermal_check_sysctl(void *data, Ecore_Thread *th) { @@ -96,13 +99,12 @@ } #endif -#if !defined HAVE_EEZE && !defined __FreeBSD__ && !defined __OpenBSD__ && !defined __DragonflyBSD__ +#if !defined(HAVE_EEZE) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) static void _thermal_check_fallback(void *data, Ecore_Thread *th) { Tempthread *tth = data; int ptemp = -500, temp; - for (;;) { if (ecore_thread_check(th)) break; @@ -115,14 +117,13 @@ } #endif -#if !defined HAVE_EEZE +#if !defined(HAVE_EEZE) static void _thermal_check_notify(void *data, Ecore_Thread *th, void *msg) { Tempthread *tth = data; Instance *inst = tth->inst; int temp = (int)((long)msg); - if (th != inst->cfg->thermal.th) return; _thermal_apply(inst, temp); } @@ -148,12 +149,12 @@ if (inst->cfg->thermal.sensor_name) tth->sensor_name = eina_stringshare_add(inst->cfg->thermal.sensor_name); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) _thermal_udev_poll(tth); inst->cfg->thermal.poller = ecore_poller_add(ECORE_POLLER_CORE, inst->cfg->thermal.poll_interval, _thermal_udev_poll, tth); inst->cfg->thermal.tth = tth; -#elif defined __FreeBSD__ || defined __OpenBSD__ || defined __DragonflyBSD__ +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) inst->cfg->thermal.th = ecore_thread_feedback_run(_thermal_check_sysctl, _thermal_check_notify, _thermal_check_done, @@ -173,16 +174,29 @@ { if (inst->cfg->thermal.th) ecore_thread_cancel(inst->cfg->thermal.th); if (inst->cfg->thermal.sensor_name) eina_stringshare_del(inst->cfg->thermal.sensor_name); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) if (inst->cfg->thermal.poller) { - ecore_poller_del(inst->cfg->thermal.poller); + E_FREE_FUNC(inst->cfg->thermal.poller, ecore_poller_del); _thermal_thread_free(inst->cfg->thermal.tth); } #endif } static void +_thermal_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_data EINA_UNUSED) +{ + Evas_Coord w, h; + Instance *inst = data; + + edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->thermal.o_gadget), 0, 0, &w, &h); + if (inst->cfg->esm == E_SYSINFO_MODULE_THERMAL) + evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); + else + evas_object_size_hint_aspect_set(inst->cfg->thermal.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); +} + +static void _thermal_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data) { Instance *inst = data; @@ -191,7 +205,7 @@ _thermal_face_shutdown(inst); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) eeze_shutdown(); #endif @@ -208,7 +222,7 @@ _thermal_face_shutdown(inst); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) eeze_shutdown(); #endif } @@ -217,16 +231,23 @@ _thermal_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED) { Instance *inst = data; + E_Gadget_Site_Orient orient = e_gadget_site_orient_get(e_gadget_site_get(inst->o_main)); inst->cfg->thermal.temp = 900; inst->cfg->thermal.have_temp = EINA_FALSE; inst->cfg->thermal.o_gadget = elm_layout_add(inst->o_main); - e_theme_edje_object_set(inst->cfg->thermal.o_gadget, "base/theme/modules/temperature", - "e/modules/temperature/main"); + if (orient == E_GADGET_SITE_ORIENT_VERTICAL) + e_theme_edje_object_set(inst->cfg->thermal.o_gadget, + "base/theme/modules/thermal", + "e/modules/thermal/main_vert"); + else + e_theme_edje_object_set(inst->cfg->thermal.o_gadget, "base/theme/modules/thermal", + "e/modules/thermal/main"); E_EXPAND(inst->cfg->thermal.o_gadget); E_FILL(inst->cfg->thermal.o_gadget); elm_box_pack_end(inst->o_main, inst->cfg->thermal.o_gadget); + evas_object_event_callback_add(inst->cfg->thermal.o_gadget, EVAS_CALLBACK_RESIZE, _thermal_resize_cb, inst); evas_object_show(inst->cfg->thermal.o_gadget); evas_object_smart_callback_del_full(obj, "gadget_created", _thermal_created_cb, data); _thermal_config_updated(inst); @@ -243,6 +264,7 @@ "e/modules/temperature/main"); E_EXPAND(inst->cfg->thermal.o_gadget); E_FILL(inst->cfg->thermal.o_gadget); + evas_object_event_callback_add(inst->cfg->thermal.o_gadget, EVAS_CALLBACK_RESIZE, _thermal_resize_cb, inst); evas_object_show(inst->cfg->thermal.o_gadget); _thermal_config_updated(inst); @@ -291,18 +313,16 @@ *id = inst->cfg->id; inst->o_main = elm_box_add(parent); E_EXPAND(inst->o_main); - evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, 1); evas_object_smart_callback_add(parent, "gadget_created", _thermal_created_cb, inst); evas_object_smart_callback_add(parent, "gadget_removed", _thermal_removed_cb, inst); evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_thermal_remove, inst); evas_object_show(inst->o_main); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) eeze_init(); #endif if (inst->cfg->id < 0) return inst->o_main; - sysinfo_instances = eina_list_append(sysinfo_instances, inst); diff -Nru e20-201702271931/src/modules/sysinfo/thermal/thermal_sysctl.c e20-201702281931/src/modules/sysinfo/thermal/thermal_sysctl.c --- e20-201702271931/src/modules/sysinfo/thermal/thermal_sysctl.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/sysinfo/thermal/thermal_sysctl.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,30 +1,30 @@ #include "thermal.h" -#if defined (__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) # include # include # include #endif -#ifdef __OpenBSD__ -#include -#include -#include -#include -#include +#if defined(__OpenBSD__) +# include +# include +# include +# include +# include #endif -#if defined (__FreeBSD__) || defined(__DragonFly__) || defined (__OpenBSD__) +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) typedef struct { int mib[CTL_MAXNAME]; -#if defined (__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) unsigned int miblen; #endif int dummy; } Extn; -#if defined (__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) static const char *sources[] = { "hw.acpi.thermal.tz0.temperature", @@ -35,7 +35,7 @@ }; #endif -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) static struct sensor snsr; static size_t slen = sizeof(snsr); #endif @@ -43,20 +43,19 @@ static void init(Tempthread *tth) { - Eina_List *therms; - char path[512]; -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) int dev, numt; struct sensordev snsrdev; size_t sdlen = sizeof(snsrdev); #endif + #if defined (__FreeBSD__) || defined(__DragonFly__) unsigned i; size_t len; int rc; #endif - Extn *extn; + Extn *extn; if (tth->initted) return; tth->initted = EINA_TRUE; @@ -71,6 +70,7 @@ tth->sensor_name = NULL; eina_stringshare_del(tth->sensor_path); tth->sensor_path = NULL; + #if defined (__FreeBSD__) || defined(__DragonFly__) for (i = 0; sources[i]; i++) { @@ -82,6 +82,7 @@ break; } } + #elif defined(__OpenBSD__) extn->mib[0] = CTL_HW; extn->mib[1] = HW_SENSORS; @@ -99,13 +100,13 @@ if (strcmp(snsrdev.xname, "cpu0") == 0) { tth->sensor_type = SENSOR_TYPE_OPENBSD; - tth->sensor_name = strdup("cpu0"); + tth->sensor_name = eina_stringshare_add("cpu0"); break; } else if (strcmp(snsrdev.xname, "km0") == 0) { tth->sensor_type = SENSOR_TYPE_OPENBSD; - tth->sensor_name = strdup("km0"); + tth->sensor_name = eina_stringshare_add("km0"); break; } } @@ -113,11 +114,9 @@ } if ((tth->sensor_type) && (tth->sensor_name) && (!tth->sensor_path)) { - char *name; - if (tth->sensor_type == SENSOR_TYPE_FREEBSD) { -#if defined (__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) len = sizeof(extn->mib) / sizeof(extn->mib[0]); rc = sysctlnametomib(tth->sensor_name, extn->mib, &len); if (rc == 0) @@ -129,7 +128,7 @@ } else if (tth->sensor_type == SENSOR_TYPE_OPENBSD) { -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) for (numt = 0; numt < snsrdev.maxnumt[SENSOR_TEMP]; numt++) { extn->mib[4] = numt; @@ -149,10 +148,8 @@ static int check(Tempthread *tth) { - FILE *f = NULL; int ret = 0; int temp = 0; - char buf[512]; #if defined (__FreeBSD__) || defined(__DragonFly__) size_t len; size_t ftemp = 0; @@ -180,7 +177,7 @@ } else if (tth->sensor_type == SENSOR_TYPE_OPENBSD) { -#ifdef __OpenBSD_ +#if defined(__OpenBSD__) if (sysctl(extn->mib, 5, &snsr, &slen, NULL, 0) != -1) { temp = (snsr.value - 273150000) / 1000000.0; @@ -194,7 +191,6 @@ return -999; error: - if (f) fclose(f); tth->sensor_type = SENSOR_TYPE_NONE; eina_stringshare_del(tth->sensor_name); tth->sensor_name = NULL; diff -Nru e20-201702271931/src/modules/tasks/e_mod_main.c e20-201702281931/src/modules/tasks/e_mod_main.c --- e20-201702271931/src/modules/tasks/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/tasks/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -474,9 +474,9 @@ if (e_drag_current_get()) { if (task_refill_timer) - ecore_timer_reset(task_refill_timer); + ecore_timer_loop_reset(task_refill_timer); else - task_refill_timer = ecore_timer_add(0.5, _refill_timer, NULL); + task_refill_timer = ecore_timer_loop_add(0.5, _refill_timer, NULL); return; } diff -Nru e20-201702271931/src/modules/teamwork/e_mod_tw.c e20-201702281931/src/modules/teamwork/e_mod_tw.c --- e20-201702271931/src/modules/teamwork/e_mod_tw.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/teamwork/e_mod_tw.c 2017-02-28 19:31:37.000000000 +0000 @@ -184,7 +184,7 @@ void **test = ecore_con_url_data_get(ev->url_con); if ((!test) || (*test != tw_mod)) return ECORE_CALLBACK_RENEW; - i = (Media*)test; + i = (void *)test; if (!i->valid) return ECORE_CALLBACK_DONE; i->timestamp = (unsigned long long)ecore_time_unix_get(); if (tw_media_add(i->addr, i->buf, i->timestamp, i->video) == 1) @@ -203,7 +203,7 @@ void **test = ecore_con_url_data_get(ev->url_con); if ((!test) || (*test != tw_mod)) return ECORE_CALLBACK_RENEW; - i = (Media*)test; + i = (void *)test; if (i->dummy) return ECORE_CALLBACK_DONE; if (!i->buf) i->buf = eina_binbuf_new(); eina_binbuf_append_length(i->buf, ev->data, ev->size); @@ -220,7 +220,7 @@ void **test = ecore_con_url_data_get(ev->url_con); if ((!test) || (*test != tw_mod)) return ECORE_CALLBACK_RENEW; - i = (Media*)test; + i = (void *)test; if (i->valid) { @@ -504,8 +504,8 @@ { if (EINA_DBL_NONZERO(tw_config->mouse_out_delay)) { - if (tw_hide_timer) ecore_timer_reset(tw_hide_timer); - else tw_hide_timer = ecore_timer_add(tw_config->mouse_out_delay, tw_hide, NULL); + if (tw_hide_timer) ecore_timer_loop_reset(tw_hide_timer); + else tw_hide_timer = ecore_timer_loop_add(tw_config->mouse_out_delay, tw_hide, NULL); } else tw_hide(NULL); @@ -622,7 +622,7 @@ if (ic->timestamp >= now) { /* stop the idler for now to avoid pointless spinning */ - ecore_timer_add(24 * 60 * 60, (Ecore_Task_Cb)tw_idler_start, NULL); + ecore_timer_loop_add(24 * 60 * 60, (Ecore_Task_Cb)tw_idler_start, NULL); media_cleaner[mcl->video] = NULL; tw_cache_list[mcl->video] = mcl; return EINA_FALSE; @@ -862,7 +862,7 @@ evas_object_hide(obj); evas_object_hide(data); emotion_object_play_set(obj, EINA_FALSE); - ecore_timer_add(3.0, stupid_obj_del_workaround_hack, data); + ecore_timer_loop_add(3.0, stupid_obj_del_workaround_hack, data); if (!tw_tmpfile) return; eina_stringshare_replace(&tw_tmpfile, NULL); } @@ -1124,8 +1124,8 @@ if (tw_mod->force || tw_mod->sticky) return; if (EINA_DBL_NONZERO(tw_config->mouse_out_delay)) { - if (tw_hide_timer) ecore_timer_reset(tw_hide_timer); - else tw_hide_timer = ecore_timer_add(tw_config->mouse_out_delay, tw_hide, NULL); + if (tw_hide_timer) ecore_timer_loop_reset(tw_hide_timer); + else tw_hide_timer = ecore_timer_loop_add(tw_config->mouse_out_delay, tw_hide, NULL); } else tw_hide(NULL); diff -Nru e20-201702271931/src/modules/temperature/e_mod_main.c e20-201702281931/src/modules/temperature/e_mod_main.c --- e20-201702271931/src/modules/temperature/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/temperature/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -114,7 +114,7 @@ #ifdef HAVE_EEZE static Eina_Bool -_temprature_udev_poll(void *data) +_temperature_udev_poll(void *data) { Tempthread *tth = data; int temp = temperature_udev_get(tth); @@ -323,7 +323,7 @@ } static void -_temprature_check_main(void *data, Ecore_Thread *th) +_temperature_check_main(void *data, Ecore_Thread *th) { Tempthread *tth = data; int ptemp = -500, temp; @@ -340,7 +340,7 @@ } static void -_temprature_check_notify(void *data, Ecore_Thread *th, void *msg) +_temperature_check_notify(void *data, Ecore_Thread *th, void *msg) { Tempthread *tth = data; Config_Face *inst = tth->inst; @@ -351,7 +351,7 @@ } static void -_temprature_check_done(void *data, Ecore_Thread *th EINA_UNUSED) +_temperature_check_done(void *data, Ecore_Thread *th EINA_UNUSED) { _temperature_thread_free(data); } @@ -374,15 +374,15 @@ if (inst->backend != TEMPGET) { inst->poller = ecore_poller_add(ECORE_POLLER_CORE, inst->poll_interval, - _temprature_udev_poll, tth); + _temperature_udev_poll, tth); inst->tth = tth; } else #endif - inst->th = ecore_thread_feedback_run(_temprature_check_main, - _temprature_check_notify, - _temprature_check_done, - _temprature_check_done, + inst->th = ecore_thread_feedback_run(_temperature_check_main, + _temperature_check_notify, + _temperature_check_done, + _temperature_check_done, tth, EINA_TRUE); } diff -Nru e20-201702271931/src/modules/tiling/e_mod_tiling.c e20-201702281931/src/modules/tiling/e_mod_tiling.c --- e20-201702271931/src/modules/tiling/e_mod_tiling.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/tiling/e_mod_tiling.c 2017-02-28 19:31:37.000000000 +0000 @@ -51,7 +51,7 @@ static void _client_track(E_Client *ec); static void _client_untrack(E_Client *ec); -static Eina_Bool _add_client(E_Client *ec); +static Eina_Bool _add_client(E_Client *ec, Tiling_Split_Type type); static void _remove_client(E_Client *ec); static void _client_apply_settings(E_Client *ec, Client_Extra *extra); static void _foreach_desk(void (*func)(E_Desk *desk)); @@ -124,6 +124,16 @@ return e_desk_current_get(z); } +static Tiling_Split_Type +_current_tiled_state(void) +{ + Tiling_Split_Type type = _G.split_type; + + if (type == TILING_SPLIT_FLOAT) + return TILING_SPLIT_HORIZONTAL; + return type; +} + static Tiling_Info * _initialize_tinfo(const E_Desk *desk) { @@ -509,7 +519,7 @@ E_CLIENT_FOREACH(ec) { - _add_client(ec); + _add_client(ec, _G.split_type); } _reapply_tree(); @@ -550,8 +560,59 @@ _toggle_tiling_based_on_state(ec, EINA_TRUE); } +/** + * Find the next tiled client under the current coordinates + */ +static Window_Tree* +_tilable_client(int x, int y) +{ + E_Client *ec; + + E_CLIENT_FOREACH(ec) + { + Eina_Rectangle c; + Window_Tree *wt; + + e_client_geometry_get(ec, &c.x, &c.y, &c.w, &c.h); + + if (!eina_rectangle_coords_inside(&c, x, y)) continue; + + if (!(wt = tiling_window_tree_client_find(_G.tinfo->tree, ec))) continue; + + return wt; + } + return NULL; +} + +static void +_insert_client(E_Client *ec, Tiling_Split_Type type) +{ + E_Client *ec_focused = e_client_focused_get(); + Window_Tree *place = NULL; + + if (ec_focused == ec) + { + //if we are placing the currently focused client, search for client under the focused client + Eina_Rectangle c; + + e_client_geometry_get(ec, &c.x, &c.y, &c.w, &c.h); + + place = _tilable_client(c.x + c.w/2, c.y + c.h/2); + } + else + { + //otherwise place next to the given client + place = tiling_window_tree_client_find(_G.tinfo->tree, + ec_focused); + + } + + _G.tinfo->tree = + tiling_window_tree_add(_G.tinfo->tree, place, ec, type); +} + static Eina_Bool -_add_client(E_Client *ec) +_add_client(E_Client *ec, Tiling_Split_Type type) { /* Should I need to check that the client is not already added? */ if (!ec) @@ -573,7 +634,7 @@ if (is_ignored_window(extra)) return EINA_FALSE; - if (_G.split_type == TILING_SPLIT_FLOAT) + if (type == TILING_SPLIT_FLOAT) { extra->floating = EINA_TRUE; return EINA_FALSE; @@ -589,26 +650,7 @@ _client_apply_settings(ec, extra); /* Window tree updating. */ - { - E_Client *ec_focused = e_client_focused_get(); - - /* If focused is NULL, it should return the root. */ - Window_Tree *parent = tiling_window_tree_client_find(_G.tinfo->tree, - ec_focused); - - if (!parent && (ec_focused != ec)) - { - Client_Extra *extra_focused = - eina_hash_find(_G.client_extras, &ec_focused); - if (_G.tinfo->tree && extra_focused && extra_focused->tiled) - { - ERR("Couldn't find tree item for focused client %p. Using root..", e_client_focused_get()); - } - } - - _G.tinfo->tree = - tiling_window_tree_add(_G.tinfo->tree, parent, ec, _G.split_type); - } + _insert_client(ec, type); if (started) _reapply_tree(); @@ -690,7 +732,7 @@ } else { - _add_client(ec); + _add_client(ec, _current_tiled_state()); } } @@ -888,13 +930,13 @@ evas_object_show(comp_obj); - _G.split_popup.timer = ecore_timer_add(TILING_POPUP_TIMEOUT, _split_type_popup_timer_del_cb, NULL); + _G.split_popup.timer = ecore_timer_loop_add(TILING_POPUP_TIMEOUT, _split_type_popup_timer_del_cb, NULL); } else { if (desk != _G.split_popup.desk) e_comp_object_util_center_on_zone(comp_obj, e_zone_current_get()); - ecore_timer_reset(_G.split_popup.timer); + ecore_timer_loop_reset(_G.split_popup.timer); } @@ -1234,7 +1276,7 @@ if (e_object_is_del(E_OBJECT(ec))) return; - _add_client(ec); + _add_client(ec, _G.split_type); } static Eina_Bool @@ -1263,7 +1305,7 @@ } else if (!extra->tiled && is_tilable(ec)) { - _add_client(ec); + _add_client(ec, _current_tiled_state()); return EINA_TRUE; } @@ -1304,7 +1346,7 @@ if (!desk_should_tile_check(ev->ec->desk)) return true; - _add_client(ev->ec); + _add_client(ev->ec, _current_tiled_state()); return true; } @@ -1419,8 +1461,12 @@ _G.handler_client_resize_begin = e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, _resize_begin_hook, NULL); - _G.handler_client_add = - e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, _add_hook, NULL); + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + _G.handler_client_add = + e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, _add_hook, NULL); + else + _G.handler_client_add = + e_client_hook_add(E_CLIENT_HOOK_UNIGNORE, _add_hook, NULL); HANDLER(_G.handler_client_resize, CLIENT_RESIZE, _resize_hook); HANDLER(_G.handler_client_move, CLIENT_MOVE, _move_hook); @@ -1523,7 +1569,7 @@ E_CLIENT_FOREACH(ec) { - _add_client(ec); + _add_client(ec, _G.split_type); } } started = EINA_TRUE; diff -Nru e20-201702271931/src/modules/tiling/window_tree.c e20-201702281931/src/modules/tiling/window_tree.c --- e20-201702271931/src/modules/tiling/window_tree.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/tiling/window_tree.c 2017-02-28 19:31:37.000000000 +0000 @@ -114,7 +114,7 @@ parent_split_type = _tiling_window_tree_split_type_get(parent); if ((parent_split_type != split_type) && (parent->children)) { - parent = (Window_Tree *)parent->children; + parent = (Window_Tree *)(void *)parent->children; } } @@ -124,7 +124,7 @@ { if (parent->children) { - _tiling_window_tree_parent_add(parent, new_node, NULL, EINA_TRUE); + _tiling_window_tree_parent_add(parent, new_node, parent, EINA_TRUE); } else { @@ -341,7 +341,7 @@ } /* Adjust the last item's weight in case weight < 1.0 */ - ((Window_Tree *)root->children->last)->weight += 1.0 - total_weight; + ((Window_Tree *)(void *)root->children->last)->weight += 1.0 - total_weight; } void @@ -366,13 +366,13 @@ static Window_Tree * _inlist_next(Window_Tree *it) { - return (Window_Tree *)EINA_INLIST_GET(it)->next; + return (Window_Tree *)(void *)EINA_INLIST_GET(it)->next; } static Window_Tree * _inlist_prev(Window_Tree *it) { - return (Window_Tree *)EINA_INLIST_GET(it)->prev; + return (Window_Tree *)(void *)EINA_INLIST_GET(it)->prev; } static Eina_Bool @@ -388,12 +388,12 @@ if (dir > 0) { itr_func = _inlist_prev; - children_start = (Window_Tree *)parent->children->last; + children_start = (Window_Tree *)(void *)parent->children->last; } else { itr_func = _inlist_next; - children_start = (Window_Tree *)parent->children; + children_start = (Window_Tree *)(void *)parent->children; } itr = (Window_Tree *)children_start; @@ -728,5 +728,4 @@ { tiling_window_tree_dump(itr, level + 1); } -} - +} \ No newline at end of file diff -Nru e20-201702271931/src/modules/tiling/window_tree.h e20-201702281931/src/modules/tiling/window_tree.h --- e20-201702271931/src/modules/tiling/window_tree.h 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/tiling/window_tree.h 2017-02-28 19:31:37.000000000 +0000 @@ -49,4 +49,6 @@ double w_diff, int h_dir, double h_diff); void tiling_window_tree_node_change_pos(Window_Tree *node, int key); + +Eina_Bool tiling_window_tree_repair(void); #endif diff -Nru e20-201702271931/src/modules/time/clock.c e20-201702281931/src/modules/time/clock.c --- e20-201702271931/src/modules/time/clock.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/time/clock.c 2017-02-28 19:31:37.000000000 +0000 @@ -205,7 +205,7 @@ if (clock_timer) ecore_timer_interval_set(clock_timer, sec); else - clock_timer = ecore_timer_add(sec, _clock_timer, NULL); + clock_timer = ecore_timer_loop_add(sec, _clock_timer, NULL); return EINA_TRUE; } @@ -382,7 +382,7 @@ if (inst->cfg->advanced) { _clock_timer(NULL); - ecore_timer_reset(clock_timer); + ecore_timer_loop_reset(clock_timer); } _eval_instance_size(inst); } @@ -512,7 +512,7 @@ advanced |= inst->cfg->advanced; if (!inst->cfg->advanced) continue; _clock_timer(NULL); - ecore_timer_reset(clock_timer); + ecore_timer_loop_reset(clock_timer); } _eval_instance_size(inst); } diff -Nru e20-201702271931/src/modules/time/mod.c e20-201702281931/src/modules/time/mod.c --- e20-201702271931/src/modules/time/mod.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/time/mod.c 2017-02-28 19:31:37.000000000 +0000 @@ -121,7 +121,6 @@ E_API void * e_modapi_init(E_Module *m) { - if (!E_EFL_VERSION_MINIMUM(1, 17, 99)) return NULL; clock_init(); time_config->module = m; diff -Nru e20-201702271931/src/modules/time/time.c e20-201702281931/src/modules/time/time.c --- e20-201702271931/src/modules/time/time.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/time/time.c 2017-02-28 19:31:37.000000000 +0000 @@ -122,8 +122,8 @@ /* disable warning for known-safe code */ DISABLE_WARNING(format-nonliteral, format-nonliteral, format-nonliteral) if (!strftime(buf, bufsz, inst->cfg->time_str[1] ?: default_str, (const struct tm *)tm)) -ENABLE_WARNING(format-nonliteral, format-nonliteral, format-nonliteral) strncpy(buf, "ERROR", bufsz - 1); +ENABLE_WARNING(format-nonliteral, format-nonliteral, format-nonliteral) break; default: break; } @@ -147,8 +147,8 @@ /* disable warning for known-safe code */ DISABLE_WARNING(format-nonliteral, format-nonliteral, format-nonliteral) if (!strftime(buf, bufsz, inst->cfg->time_str[0] ?: default_fmt, (const struct tm *)tm)) -ENABLE_WARNING(format-nonliteral, format-nonliteral, format-nonliteral) strncpy(buf, "ERROR", bufsz - 1); +ENABLE_WARNING(format-nonliteral, format-nonliteral, format-nonliteral) return tm->tm_sec; } @@ -276,7 +276,7 @@ t_tomorrow = mktime(&today) + 24 * 60 * 60; if (update_today) ecore_timer_interval_set(update_today, t_tomorrow - t); - else update_today = ecore_timer_add(t_tomorrow - t, _update_today_timer, NULL); + else update_today = ecore_timer_loop_add(t_tomorrow - t, _update_today_timer, NULL); return EINA_TRUE; } diff -Nru e20-201702271931/src/modules/winlist/e_winlist.c e20-201702281931/src/modules/winlist/e_winlist.c --- e20-201702271931/src/modules/winlist/e_winlist.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/winlist/e_winlist.c 2017-02-28 19:31:37.000000000 +0000 @@ -890,7 +890,7 @@ { _scroll_to = 1; if (!_scroll_timer) - _scroll_timer = ecore_timer_add(0.01, _e_winlist_scroll_timer, NULL); + _scroll_timer = ecore_timer_loop_add(0.01, _e_winlist_scroll_timer, NULL); if (!_animator) _animator = ecore_animator_add(_e_winlist_animator, NULL); } diff -Nru e20-201702271931/src/modules/wireless/mod.c e20-201702281931/src/modules/wireless/mod.c --- e20-201702271931/src/modules/wireless/mod.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wireless/mod.c 2017-02-28 19:31:37.000000000 +0000 @@ -17,7 +17,6 @@ E_API void * e_modapi_init(E_Module *m) { - if (!E_EFL_VERSION_MINIMUM(1, 17, 99)) return NULL; dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); connman_init(); wireless_gadget_init(); diff -Nru e20-201702271931/src/modules/wireless/wireless.c e20-201702281931/src/modules/wireless/wireless.c --- e20-201702271931/src/modules/wireless/wireless.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wireless/wireless.c 2017-02-28 19:31:37.000000000 +0000 @@ -941,7 +941,6 @@ elm_object_content_set(ctx, box); wireless_popup.popup = e_comp_object_util_add(ctx, E_COMP_OBJECT_TYPE_NONE); evas_object_layer_set(wireless_popup.popup, E_LAYER_POPUP); - e_comp_object_util_autoclose(wireless_popup.popup, NULL, e_comp_object_util_autoclose_on_escape, NULL); zone = e_zone_current_get(); evas_object_resize(wireless_popup.popup, zone->w / 5, zone->h / 3); diff -Nru e20-201702271931/src/modules/wizard/e_wizard.c e20-201702281931/src/modules/wizard/e_wizard.c --- e20-201702271931/src/modules/wizard/e_wizard.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wizard/e_wizard.c 2017-02-28 19:31:37.000000000 +0000 @@ -320,7 +320,7 @@ { /* Advance within 15 secs if no xdg event */ if (!next_timer) - next_timer = ecore_timer_add(7.0, _e_wizard_cb_next_page, NULL); + next_timer = ecore_timer_loop_add(7.0, _e_wizard_cb_next_page, NULL); next_can = 0; _e_wizard_next_eval(); return 0; @@ -340,7 +340,7 @@ { /* Advance within 15 secs if no xdg event */ if (!next_timer) - next_timer = ecore_timer_add(7.0, _e_wizard_cb_next_page, NULL); + next_timer = ecore_timer_loop_add(7.0, _e_wizard_cb_next_page, NULL); next_can = 0; _e_wizard_next_eval(); return 0; diff -Nru e20-201702271931/src/modules/wizard/page_000.c e20-201702281931/src/modules/wizard/page_000.c --- e20-201702271931/src/modules/wizard/page_000.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wizard/page_000.c 2017-02-28 19:31:37.000000000 +0000 @@ -39,7 +39,7 @@ /* advance in 1 sec */ if (!_next_timer) - _next_timer = ecore_timer_add(1.0, _next_page, NULL); + _next_timer = ecore_timer_loop_add(1.0, _next_page, NULL); return 1; } diff -Nru e20-201702271931/src/modules/wizard/page_040.c e20-201702281931/src/modules/wizard/page_040.c --- e20-201702271931/src/modules/wizard/page_040.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wizard/page_040.c 2017-02-28 19:31:37.000000000 +0000 @@ -41,7 +41,7 @@ extra_desks = ecore_file_ls(buf); /* advance in 1 sec */ - _next_timer = ecore_timer_add(1.0, _next_page, NULL); + _next_timer = ecore_timer_loop_add(1.0, _next_page, NULL); EINA_LIST_FREE(extra_desks, file) { diff -Nru e20-201702271931/src/modules/wizard/page_110.c e20-201702281931/src/modules/wizard/page_110.c --- e20-201702271931/src/modules/wizard/page_110.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wizard/page_110.c 2017-02-28 19:31:37.000000000 +0000 @@ -127,7 +127,7 @@ _check_connman_owner, pg); if (connman_timeout) ecore_timer_del(connman_timeout); - connman_timeout = ecore_timer_add(0.5, _connman_fail, pg); + connman_timeout = ecore_timer_loop_add(0.5, _connman_fail, pg); have_connman = EINA_TRUE; e_wizard_button_next_enable_set(0); } diff -Nru e20-201702271931/src/modules/wl_buffer/e_mod_main.c e20-201702281931/src/modules/wl_buffer/e_mod_main.c --- e20-201702271931/src/modules/wl_buffer/e_mod_main.c 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/modules/wl_buffer/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,50 @@ +#include "e.h" + +E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Buffer" }; + +E_API void * +e_modapi_init(E_Module *m) +{ + char *bsize; + int w = 1024, h = 768; + + printf("LOAD Wl_Buffer MODULE\n"); + + bsize = getenv("E_WL_SIZE"); + if (bsize) + sscanf(bsize, "%dx%d", &w, &h); + + e_comp->ee = ecore_evas_buffer_new(w, h); + + if (!e_comp->ee) + { + ERR("Could not create ecore_evas canvas"); + return NULL; + } + e_comp_gl_set(EINA_FALSE); + elm_config_accel_preference_set("none"); + elm_config_accel_preference_override_set(EINA_TRUE); + ecore_evas_data_set(e_comp->ee, "comp", e_comp); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!e_comp_wl_init(), NULL); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!e_comp_canvas_init(1024, 768), NULL); + + ecore_event_evas_init(); + ecore_evas_input_event_register(e_comp->ee); + + e_comp_wl_input_pointer_enabled_set(EINA_TRUE); + e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); + e_comp_wl_input_touch_enabled_set(EINA_TRUE); + + /* e_comp->pointer = */ + /* e_pointer_window_new(ecore_evas_window_get(e_comp->ee), EINA_TRUE); */ + e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE); + e_comp->pointer->color = EINA_TRUE; + + e_comp_wl->dmabuf_disable = EINA_TRUE; + ecore_evas_pointer_warp(e_comp->ee, w / 2, h / 2); + ecore_evas_pointer_xy_get(e_comp->ee, &e_comp_wl->ptr.x, + &e_comp_wl->ptr.y); + evas_event_feed_mouse_in(e_comp->evas, 0, NULL); + + return m; +} diff -Nru e20-201702271931/src/modules/wl_desktop_shell/wl_shell.c e20-201702281931/src/modules/wl_desktop_shell/wl_shell.c --- e20-201702271931/src/modules/wl_desktop_shell/wl_shell.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wl_desktop_shell/wl_shell.c 2017-02-28 19:31:37.000000000 +0000 @@ -49,8 +49,8 @@ } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(e_comp_wl->ptr.x), - wl_fixed_to_int(e_comp_wl->ptr.y), + e_comp_wl->ptr.x, + e_comp_wl->ptr.y, &ev.canvas.x, &ev.canvas.y); e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); @@ -81,8 +81,6 @@ e_comp_wl->resize.resource = resource; e_comp_wl->resize.edges = edges; - e_comp_wl->ptr.grab_x = e_comp_wl->ptr.x - wl_fixed_from_int(ec->client.x); - e_comp_wl->ptr.grab_y = e_comp_wl->ptr.y - wl_fixed_from_int(ec->client.y); switch (e_comp_wl->ptr.button) { @@ -101,8 +99,8 @@ } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(e_comp_wl->ptr.x), - wl_fixed_to_int(e_comp_wl->ptr.y), + e_comp_wl->ptr.x, + e_comp_wl->ptr.y, &ev.canvas.x, &ev.canvas.y); e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE); diff -Nru e20-201702271931/src/modules/wl_desktop_shell/xdg5.c e20-201702281931/src/modules/wl_desktop_shell/xdg5.c --- e20-201702271931/src/modules/wl_desktop_shell/xdg5.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wl_desktop_shell/xdg5.c 2017-02-28 19:31:37.000000000 +0000 @@ -237,6 +237,7 @@ if (e_object_is_del(E_OBJECT(ec))) return; if ((ec->maximized) || (ec->fullscreen)) return; + if (serial != e_comp_wl->ptr.serial[0]) return; switch (e_comp_wl->ptr.button) { @@ -255,8 +256,8 @@ } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(e_comp_wl->ptr.x), - wl_fixed_to_int(e_comp_wl->ptr.y), + e_comp_wl->ptr.x, + e_comp_wl->ptr.y, &ev.canvas.x, &ev.canvas.y); e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); @@ -280,6 +281,7 @@ return; } if (e_object_is_del(E_OBJECT(ec))) return; + if (serial != e_comp_wl->ptr.serial[0]) return; if ((edges == 0) || (edges > 15) || ((edges & 3) == 3) || ((edges & 12) == 12)) return; @@ -288,8 +290,6 @@ e_comp_wl->resize.resource = resource; e_comp_wl->resize.edges = edges; - e_comp_wl->ptr.grab_x = e_comp_wl->ptr.x - wl_fixed_from_int(ec->client.x); - e_comp_wl->ptr.grab_y = e_comp_wl->ptr.y - wl_fixed_from_int(ec->client.y); switch (e_comp_wl->ptr.button) { @@ -308,8 +308,8 @@ } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(e_comp_wl->ptr.x), - wl_fixed_to_int(e_comp_wl->ptr.y), + e_comp_wl->ptr.x, + e_comp_wl->ptr.y, &ev.canvas.x, &ev.canvas.y); e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE); diff -Nru e20-201702271931/src/modules/wl_desktop_shell/xdg6.c e20-201702281931/src/modules/wl_desktop_shell/xdg6.c --- e20-201702271931/src/modules/wl_desktop_shell/xdg6.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wl_desktop_shell/xdg6.c 2017-02-28 19:31:37.000000000 +0000 @@ -857,6 +857,13 @@ return; } if (e_object_is_del(E_OBJECT(ec))) return; + if (e_pixmap_usable_get(ec->pixmap)) + { + wl_resource_post_error(resource, + ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, + "buffer attached/committed before configure"); + return; + } p = wl_resource_get_user_data(positioner_resource); if (!p) { @@ -1036,6 +1043,7 @@ if (e_object_is_del(E_OBJECT(ec))) return; if ((ec->maximized) || (ec->fullscreen)) return; + if (serial != e_comp_wl->ptr.serial[0]) return; switch (e_comp_wl->ptr.button) { @@ -1054,8 +1062,8 @@ } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(e_comp_wl->ptr.x), - wl_fixed_to_int(e_comp_wl->ptr.y), + e_comp_wl->ptr.x, + e_comp_wl->ptr.y, &ev.canvas.x, &ev.canvas.y); e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); @@ -1079,6 +1087,7 @@ return; } if (e_object_is_del(E_OBJECT(ec))) return; + if (serial != e_comp_wl->ptr.serial[0]) return; if ((edges == 0) || (edges > 15) || ((edges & 3) == 3) || ((edges & 12) == 12)) return; @@ -1087,8 +1096,6 @@ e_comp_wl->resize.resource = resource; e_comp_wl->resize.edges = edges; - e_comp_wl->ptr.grab_x = e_comp_wl->ptr.x - wl_fixed_from_int(ec->client.x); - e_comp_wl->ptr.grab_y = e_comp_wl->ptr.y - wl_fixed_from_int(ec->client.y); switch (e_comp_wl->ptr.button) { @@ -1107,8 +1114,8 @@ } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(e_comp_wl->ptr.x), - wl_fixed_to_int(e_comp_wl->ptr.y), + e_comp_wl->ptr.x, + e_comp_wl->ptr.y, &ev.canvas.x, &ev.canvas.y); e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE); @@ -1177,6 +1184,13 @@ return; } if (e_object_is_del(E_OBJECT(ec))) return; + if (e_pixmap_usable_get(ec->pixmap)) + { + wl_resource_post_error(resource, + ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, + "buffer attached/committed before configure"); + return; + } cdata = ec->comp_data; if (cdata->shell.surface) @@ -1268,6 +1282,13 @@ return; } if (e_object_is_del(E_OBJECT(ec))) return; + if (e_pixmap_usable_get(ec->pixmap)) + { + wl_resource_post_error(surface_resource, + ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, + "buffer attached/committed before configure"); + return; + } ec->netwm.ping = 1; cdata = ec->comp_data; diff -Nru e20-201702271931/src/modules/wl_drm/e_mod_main.c e20-201702281931/src/modules/wl_drm/e_mod_main.c --- e20-201702271931/src/modules/wl_drm/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/wl_drm/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -1,18 +1,16 @@ +#define E_COMP_WL #include "e.h" #include -#ifdef HAVE_DRM2 -# include -# include +#include +#include static Ecore_Event_Handler *seat_handler; -#else -# include -#endif E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" }; static Ecore_Event_Handler *activate_handler; static Ecore_Event_Handler *output_handler; +static Ecore_Event_Handler *input_handler; static Eina_Bool session_state = EINA_FALSE; static const char *conn_types[] = @@ -48,11 +46,7 @@ static Eina_Bool _e_mod_drm_cb_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { -# ifdef HAVE_DRM2 Ecore_Drm2_Event_Activate *ev; -# else - Ecore_Drm_Event_Activate *ev; -# endif if (!(ev = event)) goto end; @@ -99,11 +93,7 @@ E_Randr2_Screen *screen; Eina_Bool connected = EINA_FALSE; int subpixel = 0; -#ifdef HAVE_DRM2 Ecore_Drm2_Event_Output_Changed *e; -#else - Ecore_Drm_Event_Output *e; -#endif if (!(e = event)) goto end; @@ -114,13 +104,8 @@ if ((!strcmp(screen->info.name, e->name)) && (!strcmp(screen->info.screen, e->model))) { -#ifdef HAVE_DRM2 connected = e->enabled; subpixel = e->subpixel; -#else - connected = e->plug; - subpixel = e->subpixel_order; -#endif if (connected) { @@ -147,48 +132,6 @@ return ECORE_CALLBACK_PASS_ON; } -#ifndef HAVE_DRM2 -static Ecore_Drm_Output_Mode * -_e_mod_drm_mode_screen_find(E_Randr2_Screen *s, Ecore_Drm_Output *output) -{ - Ecore_Drm_Output_Mode *mode, *m = NULL; - const Eina_List *l; - int diff, distance = 0x7fffffff; - - EINA_LIST_FOREACH(ecore_drm_output_modes_get(output), l, mode) - { - diff = (100 * abs(s->config.mode.w - mode->width)) + - (100 * abs(s->config.mode.h - mode->height)) + - fabs((100 * s->config.mode.refresh) - (100 * mode->refresh)); - if (diff < distance) - { - m = mode; - distance = diff; - } - } - - return m; -} - -static Eina_Bool -_e_mod_drm_output_exists(Ecore_Drm_Output *output, unsigned int crtc) -{ - /* find out if this output can go into the 'possibles' */ - return ecore_drm_output_possible_crtc_get(output, crtc); -} - -static char * -_e_mod_drm_output_screen_get(Ecore_Drm_Output *output) -{ - const char *model; - - model = ecore_drm_output_model_get(output); - if (!model) return NULL; - - return strdup(model); -} -#endif - static E_Randr2_Screen * _info_unconf_primary_find(E_Randr2 *r) { @@ -355,7 +298,6 @@ } } -#ifdef HAVE_DRM2 static E_Randr2 * _drm2_randr_create(void) { @@ -504,30 +446,24 @@ s->config.geom.w, s->config.geom.h); } - /* TODO: cannot support rotations until we support planes - * and we cannot support planes until Atomic support is in */ - s->info.can_rot_0 = EINA_FALSE; s->info.can_rot_90 = EINA_FALSE; s->info.can_rot_180 = EINA_FALSE; s->info.can_rot_270 = EINA_FALSE; -/* # if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 18) */ -/* unsigned int rotations; */ + int rotations; -/* rotations = */ -/* ecore_drm_output_supported_rotations_get(output, */ -/* ECORE_DRM_PLANE_TYPE_PRIMARY); */ - -/* if (rotations & ECORE_DRM_PLANE_ROTATION_NORMAL) */ -/* s->info.can_rot_0 = EINA_TRUE; */ -/* if (rotations & ECORE_DRM_PLANE_ROTATION_90) */ -/* s->info.can_rot_90 = EINA_TRUE; */ -/* if (rotations & ECORE_DRM_PLANE_ROTATION_180) */ -/* s->info.can_rot_180 = EINA_TRUE; */ -/* if (rotations & ECORE_DRM_PLANE_ROTATION_270) */ -/* s->info.can_rot_270 = EINA_TRUE; */ -/* # endif */ + rotations = + ecore_drm2_output_supported_rotations_get(output); + + if (rotations & ECORE_DRM2_ROTATION_NORMAL) + s->info.can_rot_0 = EINA_TRUE; + if (rotations & ECORE_DRM2_ROTATION_90) + s->info.can_rot_90 = EINA_TRUE; + if (rotations & ECORE_DRM2_ROTATION_180) + s->info.can_rot_180 = EINA_TRUE; + if (rotations & ECORE_DRM2_ROTATION_270) + s->info.can_rot_270 = EINA_TRUE; if (cs) { @@ -685,6 +621,18 @@ /* TODO: cannot support rotations until we support planes * and we cannot support planes until Atomic support is in */ + int orient = 0; + + if (s->config.rotation == 0) + orient = ECORE_DRM2_ROTATION_NORMAL; + else if (s->config.rotation == 90) + orient = ECORE_DRM2_ROTATION_90; + else if (s->config.rotation == 180) + orient = ECORE_DRM2_ROTATION_180; + else if (s->config.rotation == 270) + orient = ECORE_DRM2_ROTATION_270; + + ecore_drm2_output_rotation_set(output, orient); if (s->config.priority == top_priority) _drm2_output_primary_set(outputs, output); @@ -807,355 +755,6 @@ } } -#else -static E_Randr2 * -_drm_randr_create(void) -{ - Ecore_Drm_Device *dev; - Ecore_Drm_Output *output; - const Eina_List *l, *ll; - E_Randr2 *r = NULL; - unsigned int type; - - printf("DRM RRR: ................. info get!\n"); - - r = E_NEW(E_Randr2, 1); - if (!r) return NULL; - - EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) - { - EINA_LIST_FOREACH(dev->outputs, ll, output) - { - E_Randr2_Screen *s; - E_Config_Randr2_Screen *cs; - const Eina_List *m; - Ecore_Drm_Output_Mode *omode; - // size_t n, e = 0; - unsigned int j; - int priority; - Eina_Bool ok = EINA_FALSE; - Eina_Bool possible = EINA_FALSE; - - s = E_NEW(E_Randr2_Screen, 1); - if (!s) continue; - - s->info.name = ecore_drm_output_name_get(output); - printf("DRM RRR: .... out %s\n", s->info.name); - - s->info.connected = ecore_drm_output_connected_get(output); - printf("DRM RRR: ...... connected %i\n", s->info.connected); - - s->info.screen = _e_mod_drm_output_screen_get(output); - - s->info.edid = ecore_drm_output_edid_get(output); - if (s->info.edid) - s->id = malloc(strlen(s->info.name) + 1 + strlen(s->info.edid) + 1); - else - s->id = malloc(strlen(s->info.name) + 1 + 1); - if (!s->id) - { - free(s->info.screen); - free(s->info.edid); - free(s); - continue; - } - strcpy(s->id, s->info.name); - strcat(s->id, "/"); - if (s->info.edid) strcat(s->id, s->info.edid); - - printf("DRM RRR: Created Screen: %s\n", s->id); - - type = MIN(ecore_drm_output_connector_type_get(output), - EINA_C_ARRAY_LENGTH(conn_types) - 1); - s->info.connector = rtype[type]; - s->info.is_lid = ((type == DRM_MODE_CONNECTOR_LVDS) || - (type == DRM_MODE_CONNECTOR_eDP)); - s->info.lid_closed = (s->info.is_lid && e_acpi_lid_is_closed()); - printf("DRM RRR: ...... lid_closed = %i (%i && %i)\n", - s->info.lid_closed, s->info.is_lid, e_acpi_lid_is_closed()); - - s->info.backlight = ecore_drm_output_backlight_get(output); - - ecore_drm_output_physical_size_get(output, &s->info.size.w, - &s->info.size.h); - - EINA_LIST_FOREACH(ecore_drm_output_modes_get(output), m, omode) - { - E_Randr2_Mode *rmode; - - rmode = malloc(sizeof(E_Randr2_Mode)); - if (!rmode) continue; - - rmode->w = omode->width; - rmode->h = omode->height; - rmode->refresh = omode->refresh; - rmode->preferred = (omode->flags & DRM_MODE_TYPE_PREFERRED); - - s->info.modes = eina_list_append(s->info.modes, rmode); - } - - cs = NULL; - priority = 0; - if (e_randr2_cfg) - cs = e_randr2_config_screen_find(s, e_randr2_cfg); - if (cs) - priority = cs->priority; - else if (ecore_drm_output_primary_get(dev) == output) - priority = 100; - s->config.priority = priority; - - for (j = 0; j < dev->crtc_count; j++) - { - if (dev->crtcs[j] == ecore_drm_output_crtc_id_get(output)) - { - ok = EINA_TRUE; - break; - } - } - - if (!ok) - { - /* get possible crtcs, compare to output_crtc_id_get */ - for (j = 0; j < dev->crtc_count; j++) - { - if (_e_mod_drm_output_exists(output, dev->crtcs[j])) - { - ok = EINA_TRUE; - possible = EINA_TRUE; - break; - } - } - } - - if (ok) - { - if (!possible) - { - unsigned int refresh; - - ecore_drm_output_position_get(output, &s->config.geom.x, - &s->config.geom.y); - ecore_drm_output_crtc_size_get(output, &s->config.geom.w, - &s->config.geom.h); - - ecore_drm_output_current_resolution_get(output, - &s->config.mode.w, - &s->config.mode.h, - &refresh); - s->config.mode.refresh = refresh; - s->config.enabled = - ((s->config.mode.w != 0) && (s->config.mode.h != 0)); - - printf("DRM RRR: '%s' %i %i %ix%i\n", s->info.name, - s->config.geom.x, s->config.geom.y, - s->config.geom.w, s->config.geom.h); - } - -#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 18) - unsigned int rotations; - - rotations = - ecore_drm_output_supported_rotations_get(output, - ECORE_DRM_PLANE_TYPE_PRIMARY); - - if (rotations & ECORE_DRM_PLANE_ROTATION_NORMAL) - s->info.can_rot_0 = EINA_TRUE; - if (rotations & ECORE_DRM_PLANE_ROTATION_90) - s->info.can_rot_90 = EINA_TRUE; - if (rotations & ECORE_DRM_PLANE_ROTATION_180) - s->info.can_rot_180 = EINA_TRUE; - if (rotations & ECORE_DRM_PLANE_ROTATION_270) - s->info.can_rot_270 = EINA_TRUE; -#endif - - if (cs) - { - if (cs->profile) - s->config.profile = strdup(cs->profile); - else - s->config.profile = NULL; - s->config.scale_multiplier = cs->scale_multiplier; - } - } - - r->screens = eina_list_append(r->screens, s); - } - } - - _e_mod_drm_relative_fixup(r); - - return r; -} - -static void -_drm_randr_apply(void) -{ - Ecore_Drm_Device *dev; - Ecore_Drm_Output *out; - E_Randr2_Screen *s; - const Eina_List *l, *ll; - int nw, nh, pw, ph, ww, hh; - int minw, minh, maxw, maxh; - int top_priority = 0; - - /* TODO: what the actual fuck */ - - nw = e_randr2->w; - nh = e_randr2->h; - EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) - { - ecore_drm_screen_size_range_get(dev, &minw, &minh, &maxw, &maxh); - printf("DRM RRR: size range: %ix%i -> %ix%i\n", minw, minh, maxw, maxh); - - ecore_drm_outputs_geometry_get(dev, NULL, NULL, &pw, &ph); - if (nw > maxw) nw = maxw; - if (nh > maxh) nh = maxh; - if (nw < minw) nw = minw; - if (nh < minh) nh = minh; - ww = nw; - hh = nh; - if (nw < pw) ww = pw; - if (nh < ph) hh = ph; - - printf("DRM RRR: set vsize: %ix%i\n", ww, hh); - - EINA_LIST_FOREACH(e_randr2->screens, ll, s) - { - Ecore_Drm_Output_Mode *mode = NULL; - - printf("DRM RRR: find output for '%s'\n", s->info.name); - - out = ecore_drm_device_output_name_find(dev, s->info.name); - if (!out) continue; - - if (s->config.configured) - { - printf("\tDRM RRR: configured by E\n"); - - if (s->config.enabled) - { - printf("\tDRM RRR: Enabled\n"); - mode = _e_mod_drm_mode_screen_find(s, out); - } - else - { - printf("\tDRM RRR: Disabled\n"); - } - - if (s->config.priority > top_priority) - top_priority = s->config.priority; - - printf("\tDRM RRR: Priority: %d\n", s->config.priority); - - printf("\tDRM RRR: Geom: %d %d %d %d\n", - s->config.geom.x, s->config.geom.y, - s->config.geom.w, s->config.geom.h); - - if (mode) - { - printf("\tDRM RRR: Found Valid Drm Mode\n"); - printf("\t\tDRM RRR: %dx%d\n", mode->width, mode->height); - } - else - printf("\tDRM RRR: No Valid Drm Mode Found\n"); - - ecore_drm_output_mode_set(out, mode, - s->config.geom.x, s->config.geom.y); -#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 18) - int orient; - - if (s->config.rotation == 0) - orient = (1 << 0); - else if (s->config.rotation == 90) - orient = (1 << 1); - else if (s->config.rotation == 180) - orient = (1 << 2); - else if (s->config.rotation == 270) - orient = (1 << 3); - - ecore_drm_output_rotation_set(out, - ECORE_DRM_PLANE_TYPE_PRIMARY, - orient); -#endif - - if (s->config.priority == top_priority) - ecore_drm_output_primary_set(out); - - if (s->config.enabled) - ecore_drm_output_enable(out); - else - ecore_drm_output_disable(out); - - printf("\tDRM RRR: Mode\n"); - printf("\t\tDRM RRR: Geom: %d %d\n", - s->config.mode.w, s->config.mode.h); - printf("\t\tDRM RRR: Refresh: %f\n", s->config.mode.refresh); - printf("\t\tDRM RRR: Preferred: %d\n", - s->config.mode.preferred); - - printf("\tDRM RRR: Rotation: %d\n", s->config.rotation); - - printf("\tDRM RRR: Relative Mode: %d\n", - s->config.relative.mode); - printf("\tDRM RRR: Relative To: %s\n", - s->config.relative.to); - printf("\tDRM RRR: Align: %f\n", s->config.relative.align); - } - } - } -} - -static void -_drm_dpms(int set) -{ - Ecore_Drm_Device *dev; - Ecore_Drm_Output *out; - E_Randr2_Screen *s; - const Eina_List *l, *ll; - - EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) - { - EINA_LIST_FOREACH(e_randr2->screens, ll, s) - { - out = ecore_drm_device_output_name_find(dev, s->info.name); - if (!out) continue; - - if ((!s->config.configured) || s->config.enabled) - ecore_drm_output_dpms_set(out, set); - } - } -} - -static void -_drm_read_pixels(E_Comp_Wl_Output *output, void *pixels) -{ - Ecore_Drm_Device *dev; - Ecore_Drm_Fb *fb; - const Eina_List *drm_devs, *l; - int i = 0, bstride; - unsigned char *s, *d = pixels; - - drm_devs = ecore_drm_devices_get(); - EINA_LIST_FOREACH(drm_devs, l, dev) - { - fb = dev->next; - if (!fb) fb = dev->current; - if (fb) break; - } - - if (!fb) return; - - bstride = output->w * sizeof(int); - - for (i = output->y; i < output->y + output->h; i++) - { - s = fb->mmap; - s += (fb->stride * i) + (output->x * sizeof(int)); - memcpy(d, s, (output->w * sizeof(int))); - d += bstride; - } -} -#endif static Eina_Bool _drm_randr_available(void) @@ -1163,13 +762,6 @@ return EINA_TRUE; } -#ifndef HAVE_DRM2 -static void -_drm_randr_stub(void) -{} -#endif - -#ifdef HAVE_DRM2 static Eina_Bool _drm2_cb_seat_caps(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { @@ -1185,7 +777,7 @@ else if (ev->pointer_count > 0) { e_comp_wl_input_pointer_enabled_set(EINA_TRUE); - e_pointers_size_set(e_config->cursor_size); + e_pointer_show(e_comp->pointer); } if (ev->keyboard_count <= 0) @@ -1193,6 +785,11 @@ else if (ev->keyboard_count > 0) e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); + if (ev->touch_count <= 0) + e_comp_wl_input_touch_enabled_set(EINA_FALSE); + else if (ev->touch_count > 0) + e_comp_wl_input_touch_enabled_set(EINA_TRUE); + return ECORE_CALLBACK_RENEW; } @@ -1208,12 +805,10 @@ { ecore_event_handler_del(seat_handler); } -#endif static E_Comp_Screen_Iface drmiface = { .available = _drm_randr_available, -#ifdef HAVE_DRM2 .init = _drm2_init, .shutdown = _drm2_shutdown, .create = _drm2_randr_create, @@ -1221,15 +816,18 @@ .dpms = _drm2_dpms, .key_down = _drm2_key_down, .key_up = _drm2_key_up, -#else - .init = _drm_randr_stub, - .shutdown = _drm_randr_stub, - .create = _drm_randr_create, - .apply = _drm_randr_apply, - .dpms = _drm_dpms, -#endif + .relative_motion = EINA_TRUE, + .backlight_enabled = EINA_TRUE, }; +static Eina_Bool +_pointer_motion(void *d EINA_UNUSED, int t EINA_UNUSED, Elput_Event_Pointer_Motion *ev) +{ + e_comp_wl_extension_relative_motion_event(ev->time_usec, ev->dx, ev->dy, + ev->dx_unaccel, ev->dy_unaccel); + return ECORE_CALLBACK_RENEW; +} + E_API void * e_modapi_init(E_Module *m) { @@ -1278,11 +876,7 @@ if (!e_comp_wl_init()) return NULL; if (!e_comp_canvas_init(w, h)) return NULL; -#ifdef HAVE_DRM2 e_comp_wl->extensions->screenshooter.read_pixels = _drm2_read_pixels; -#else - e_comp_wl->extensions->screenshooter.read_pixels = _drm_read_pixels; -#endif ecore_evas_pointer_xy_get(e_comp->ee, &e_comp_wl->ptr.x, &e_comp_wl->ptr.y); @@ -1292,12 +886,9 @@ e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); e_comp_wl_input_touch_enabled_set(EINA_TRUE); - /* comp->pointer = */ - /* e_pointer_window_new(ecore_evas_window_get(comp->ee), 1); */ e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE); e_comp->pointer->color = EINA_TRUE; -#ifdef HAVE_DRM2 activate_handler = ecore_event_handler_add(ECORE_DRM2_EVENT_ACTIVATE, _e_mod_drm_cb_activate, NULL); @@ -1305,15 +896,10 @@ output_handler = ecore_event_handler_add(ECORE_DRM2_EVENT_OUTPUT_CHANGED, _e_mod_drm_cb_output, NULL); -#else - activate_handler = - ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE, - _e_mod_drm_cb_activate, NULL); - output_handler = - ecore_event_handler_add(ECORE_DRM_EVENT_OUTPUT, - _e_mod_drm_cb_output, NULL); -#endif + input_handler = + ecore_event_handler_add(ELPUT_EVENT_POINTER_MOTION, + (Ecore_Event_Handler_Cb)_pointer_motion, NULL); return m; } @@ -1321,14 +907,13 @@ E_API int e_modapi_shutdown(E_Module *m EINA_UNUSED) { - /* shutdown ecore_drm */ - /* ecore_drm_shutdown(); */ - if (output_handler) ecore_event_handler_del(output_handler); output_handler = NULL; if (activate_handler) ecore_event_handler_del(activate_handler); activate_handler = NULL; + E_FREE_FUNC(input_handler, ecore_event_handler_del); + return 1; } diff -Nru e20-201702271931/src/modules/xkbswitch/e_mod_config.c e20-201702281931/src/modules/xkbswitch/e_mod_config.c --- e20-201702271931/src/modules/xkbswitch/e_mod_config.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/xkbswitch/e_mod_config.c 2017-02-28 19:31:37.000000000 +0000 @@ -231,12 +231,29 @@ } static void +_list_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +{ + Evas_Object **o; + + o = data; + + *o = NULL; +} + +static void _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata) { E_Config_XKB_Layout *cl; _xkb.cfd = NULL; + if (cfdata->compose_list) + evas_object_event_callback_del(cfdata->compose_list, EVAS_CALLBACK_DEL, _list_del); + if (cfdata->lv3_list) + evas_object_event_callback_del(cfdata->lv3_list, EVAS_CALLBACK_DEL, _list_del); + if (cfdata->switch_list) + evas_object_event_callback_del(cfdata->switch_list, EVAS_CALLBACK_DEL, _list_del); + EINA_LIST_FREE(cfdata->cfg_layouts, cl) { eina_stringshare_del(cl->name); @@ -446,16 +463,6 @@ } static void -_list_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) -{ - Evas_Object **o; - - o = data; - - *o = NULL; -} - -static void _option_del(void *data, Evas_Object *obj, void *event EINA_UNUSED) { Eina_List **list; @@ -751,7 +758,7 @@ ecore_timer_del(cfdata->fill_delay); /* Trigger the fill */ - cfdata->fill_delay = ecore_timer_add(0.2, _cb_fill_delay, cfdata); + cfdata->fill_delay = ecore_timer_loop_add(0.2, _cb_fill_delay, cfdata); return mainn; } @@ -791,7 +798,7 @@ ecore_timer_del(cfdata->fill_delay); /* Trigger the fill */ - cfdata->fill_delay = ecore_timer_add(0.2, _cb_fill_delay, cfdata); + cfdata->fill_delay = ecore_timer_loop_add(0.2, _cb_fill_delay, cfdata); return sc; } @@ -1361,7 +1368,7 @@ if (cfdata->dlg_fill_delay) ecore_timer_del(cfdata->dlg_fill_delay); /* Trigger the fill */ - cfdata->dlg_fill_delay = ecore_timer_add(0.2, _cb_dlg_fill_delay, cfdata); + cfdata->dlg_fill_delay = ecore_timer_loop_add(0.2, _cb_dlg_fill_delay, cfdata); /* Some buttons */ e_dialog_button_add(dlg, _("OK"), NULL, _dlg_add_cb_ok, cfdata); diff -Nru e20-201702271931/src/modules/xkbswitch/e_mod_parse.c e20-201702281931/src/modules/xkbswitch/e_mod_parse.c --- e20-201702271931/src/modules/xkbswitch/e_mod_parse.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/xkbswitch/e_mod_parse.c 2017-02-28 19:31:37.000000000 +0000 @@ -290,11 +290,9 @@ break; } } - if (i < (sizeof(grplabels) / sizeof(grplabels[0]))) continue; - optmisc = eina_list_append(optmisc, option); + if (i >= EINA_C_ARRAY_LENGTH(grplabels)) + optmisc = eina_list_append(optmisc, option); } - else continue; - free(tmp); } else diff -Nru e20-201702271931/src/modules/xwayland/e_mod_main.c e20-201702281931/src/modules/xwayland/e_mod_main.c --- e20-201702271931/src/modules/xwayland/e_mod_main.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/modules/xwayland/e_mod_main.c 2017-02-28 19:31:37.000000000 +0000 @@ -371,11 +371,7 @@ return NULL; #ifdef HAVE_PULSE - #ifdef EFL_VERSION_1_19 efl_del(efl_add(ECORE_AUDIO_OUT_PULSE_CLASS, NULL)); - #else - eo_del(eo_add(ECORE_AUDIO_OUT_PULSE_CLASS, NULL)); - #endif #endif /* record wayland display */ @@ -413,6 +409,7 @@ snprintf(disp, sizeof(disp), ":%d", exs->disp); DBG("XWayland Listening on display: %s", disp); setenv("DISPLAY", disp, 1); + ecore_event_add(E_EVENT_COMPOSITOR_XWAYLAND_INIT, NULL, NULL, NULL); /* setup ecore_fd handlers for abstract and unix socket fds */ exs->abs_hdlr = @@ -459,7 +456,8 @@ E_API void * e_modapi_init(E_Module *m) { - return xwl_init(m); + ecore_timer_loop_add(2.0, (Ecore_Task_Cb)xwl_init, m); + return m; } E_API int diff -Nru e20-201702271931/src/protocol/relative-pointer-unstable-v1.xml e20-201702281931/src/protocol/relative-pointer-unstable-v1.xml --- e20-201702271931/src/protocol/relative-pointer-unstable-v1.xml 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/protocol/relative-pointer-unstable-v1.xml 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,136 @@ + + + + + Copyright © 2014 Jonas Ådahl + Copyright © 2015 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol specifies a set of interfaces used for making clients able to + receive relative pointer events not obstructed by barriers (such as the + monitor edge or other pointer barriers). + + To start receiving relative pointer events, a client must first bind the + global interface "wp_relative_pointer_manager" which, if a compositor + supports relative pointer motion events, is exposed by the registry. After + having created the relative pointer manager proxy object, the client uses + it to create the actual relative pointer object using the + "get_relative_pointer" request given a wl_pointer. The relative pointer + motion events will then, when applicable, be transmitted via the proxy of + the newly created relative pointer object. See the documentation of the + relative pointer interface for more details. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + A global interface used for getting the relative pointer object for a + given pointer. + + + + + Used by the client to notify the server that it will no longer use this + relative pointer manager object. + + + + + + Create a relative pointer interface given a wl_pointer object. See the + wp_relative_pointer interface for more details. + + + + + + + + + A wp_relative_pointer object is an extension to the wl_pointer interface + used for emitting relative pointer events. It shares the same focus as + wl_pointer objects of the same seat and will only emit events when it has + focus. + + + + + + + + + Relative x/y pointer motion from the pointer of the seat associated with + this object. + + A relative motion is in the same dimension as regular wl_pointer motion + events, except they do not represent an absolute position. For example, + moving a pointer from (x, y) to (x', y') would have the equivalent + relative motion (x' - x, y' - y). If a pointer motion caused the + absolute pointer position to be clipped by for example the edge of the + monitor, the relative motion is unaffected by the clipping and will + represent the unclipped motion. + + This event also contains non-accelerated motion deltas. The + non-accelerated delta is, when applicable, the regular pointer motion + delta as it was before having applied motion acceleration and other + transformations such as normalization. + + Note that the non-accelerated delta does not represent 'raw' events as + they were read from some device. Pointer motion acceleration is device- + and configuration-specific and non-accelerated deltas and accelerated + deltas may have the same value on some devices. + + Relative motions are not coupled to wl_pointer.motion events, and can be + sent in combination with such events, but also independently. There may + also be scenarios where wl_pointer.motion is sent, but there is no + relative motion. The order of an absolute and relative motion event + originating from the same physical motion is not guaranteed. + + If the client needs button events or focus state, it can receive them + from a wl_pointer object of the same seat that the wp_relative_pointer + object is associated with. + + + + + + + + + + + diff -Nru e20-201702271931/src/protocol/xdg-foreign-unstable-v1.xml e20-201702281931/src/protocol/xdg-foreign-unstable-v1.xml --- e20-201702271931/src/protocol/xdg-foreign-unstable-v1.xml 1970-01-01 00:00:00.000000000 +0000 +++ e20-201702281931/src/protocol/xdg-foreign-unstable-v1.xml 2017-02-28 19:31:37.000000000 +0000 @@ -0,0 +1,182 @@ + + + + + Copyright © 2015-2016 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol specifies a way for making it possible to reference a surface + of a different client. With such a reference, a client can, by using the + interfaces provided by this protocol, manipulate the relationship between + its own surfaces and the surface of some other client. For example, stack + some of its own surface above the other clients surface. + + In order for a client A to get a reference of a surface of client B, client + B must first export its surface using xdg_exporter.export. Upon doing this, + client B will receive a handle (a unique string) that it may share with + client A in some way (for example D-Bus). After client A has received the + handle from client B, it may use xdg_importer.import to create a reference + to the surface client B just exported. See the corresponding requests for + details. + + A possible use case for this is out-of-process dialogs. For example when a + sandboxed client without file system access needs the user to select a file + on the file system, given sandbox environment support, it can export its + surface, passing the exported surface handle to an unsandboxed process that + can show a file browser dialog and stack it above the sandboxed client's + surface. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + A global interface used for exporting surfaces that can later be imported + using xdg_importer. + + + + + Notify the compositor that the xdg_exporter object will no longer be + used. + + + + + + The export request exports the passed surface so that it can later be + imported via xdg_importer. When called, a new xdg_exported object will + be created and xdg_exported.handle will be sent immediately. See the + corresponding interface and event for details. + + A surface may be exported multiple times, and each exported handle may + be used to create a xdg_imported multiple times. Only xdg_surface + surfaces may be exported. + + + + + + + + + A global interface used for importing surfaces exported by xdg_exporter. + With this interface, a client can create a reference to a surface of + another client. + + + + + Notify the compositor that the xdg_importer object will no longer be + used. + + + + + + The import request imports a surface from any client given a handle + retrieved by exporting said surface using xdg_exporter.export. When + called, a new xdg_imported object will be created. This new object + represents the imported surface, and the importing client can + manipulate its relationship using it. See xdg_imported for details. + + + + + + + + + A xdg_exported object represents an exported reference to a surface. The + exported surface may be referenced as long as the xdg_exported object not + destroyed. Destroying the xdg_exported invalidates any relationship the + importer may have established using xdg_imported. + + + + + Revoke the previously exported surface. This invalidates any + relationship the importer may have set up using the xdg_imported created + given the handle sent via xdg_exported.handle. + + + + + + The handle event contains the unique handle of this exported surface + reference. It may be shared with any client, which then can use it to + import the surface by calling xdg_importer.import. A handle may be + used to import the surface multiple times. + + + + + + + + A xdg_imported object represents an imported reference to surface exported + by some client. A client can use this interface to manipulate + relationships between its own surfaces and the imported surface. + + + + + Notify the compositor that it will no longer use the xdg_imported + object. Any relationship that may have been set up will at this point + be invalidated. + + + + + + Set the imported surface as the parent of some surface of the client. + The passed surface must be a toplevel xdg_surface. Calling this function + sets up a surface to surface relation with the same stacking and positioning + semantics as xdg_surface.set_parent. + + + + + + + The imported surface handle has been destroyed and any relationship set + up has been invalidated. This may happen for various reasons, for + example if the exported surface or the exported surface handle has been + destroyed, if the handle used for importing was invalid. + + + + + diff -Nru e20-201702271931/src/tests/focusgrab.c e20-201702281931/src/tests/focusgrab.c --- e20-201702271931/src/tests/focusgrab.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/tests/focusgrab.c 2017-02-28 19:31:37.000000000 +0000 @@ -16,7 +16,7 @@ ecore_evas_init(); ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL); ecore_evas_show(ee); - ecore_timer_add(3.0, (Ecore_Task_Cb)_focus, ee); + ecore_timer_loop_add(3.0, (Ecore_Task_Cb)_focus, ee); ecore_main_loop_begin(); return 0; } diff -Nru e20-201702271931/src/tests/fullscreen.c e20-201702281931/src/tests/fullscreen.c --- e20-201702271931/src/tests/fullscreen.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/tests/fullscreen.c 2017-02-28 19:31:37.000000000 +0000 @@ -27,7 +27,7 @@ ecore_evas_init(); ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL); - ecore_timer_add(2, fs, ee); + ecore_timer_loop_add(2, fs, ee); ecore_evas_show(ee); ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, (Ecore_Event_Handler_Cb)key, ee); ecore_main_loop_begin(); diff -Nru e20-201702271931/src/tests/override_fullscreen.c e20-201702281931/src/tests/override_fullscreen.c --- e20-201702271931/src/tests/override_fullscreen.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/tests/override_fullscreen.c 2017-02-28 19:31:37.000000000 +0000 @@ -25,7 +25,7 @@ ecore_x_netwm_state_request_send(a, 0, ECORE_X_WINDOW_STATE_FULLSCREEN, -1, 1); ecore_x_icccm_name_class_set(a, "override_fullscreen", "test"); - ecore_timer_add(1.0, test_state, NULL); + ecore_timer_loop_add(1.0, test_state, NULL); ecore_main_loop_begin(); return 0; } diff -Nru e20-201702271931/src/tests/shaped_input.c e20-201702281931/src/tests/shaped_input.c --- e20-201702271931/src/tests/shaped_input.c 2017-02-27 19:31:54.000000000 +0000 +++ e20-201702281931/src/tests/shaped_input.c 2017-02-28 19:31:37.000000000 +0000 @@ -37,7 +37,7 @@ a = ecore_x_window_input_new(0, 0, 0, 100, 100); ecore_x_window_show(a); - ecore_timer_add(0.01, _shape, NULL); + ecore_timer_loop_add(0.01, _shape, NULL); ecore_x_icccm_name_class_set(a, "shaped_input", "test");