EAPI int e_modapi_shutdown(E_Module *m) { E_Music_Control_Module_Context *ctxt; EINA_SAFETY_ON_NULL_RETURN_VAL(music_control_mod, 0); ctxt = music_control_mod->data; E_FREE_FUNC(ctxt->meta_title, eina_stringshare_del); E_FREE_FUNC(ctxt->meta_album, eina_stringshare_del); E_FREE_FUNC(ctxt->meta_artist, eina_stringshare_del); E_FREE_FUNC(ctxt->meta_cover, eina_stringshare_del); free(ctxt->config); E_CONFIG_DD_FREE(ctxt->conf_edd); E_FREE_FUNC(desklock_handler, ecore_event_handler_del); media_player2_player_proxy_unref(ctxt->mpris2_player); mpris_media_player2_proxy_unref(ctxt->mrpis2); eldbus_connection_unref(ctxt->conn); eldbus_shutdown(); e_gadcon_provider_unregister(&_gc_class); if (eina_list_count(ctxt->instances)) ERR("Live instances."); free(ctxt); music_control_mod = NULL; return 1; }
static void parse_metadata(E_Music_Control_Module_Context *ctxt, Eina_Value *array) { unsigned i; E_FREE_FUNC(ctxt->meta_title, eina_stringshare_del); E_FREE_FUNC(ctxt->meta_album, eina_stringshare_del); E_FREE_FUNC(ctxt->meta_artist, eina_stringshare_del); E_FREE_FUNC(ctxt->meta_cover, eina_stringshare_del); // DBG("Metadata: %s", eina_value_to_string(array)); for (i = 0; i < eina_value_array_count(array); i++) { const char *key, *str_val; Eina_Value st, subst; Efreet_Uri *uri; eina_value_array_value_get(array, i, &st); eina_value_struct_get(&st, "arg0", &key); if (!strcmp(key, "xesam:title")) { eina_value_struct_value_get(&st, "arg1", &subst); eina_value_struct_get(&subst, "arg0", &str_val); ctxt->meta_title = eina_stringshare_add(str_val); eina_value_flush(&subst); } else if (!strcmp(key, "xesam:album")) { eina_value_struct_value_get(&st, "arg1", &subst); eina_value_struct_get(&subst, "arg0", &str_val); ctxt->meta_album = eina_stringshare_add(str_val); eina_value_flush(&subst); } else if (!strcmp(key, "xesam:artist")) { Eina_Value arr; eina_value_struct_value_get(&st, "arg1", &subst); eina_value_struct_value_get(&subst, "arg0", &arr); eina_value_array_get(&arr, 0, &str_val); ctxt->meta_artist = eina_stringshare_add(str_val); eina_value_flush(&arr); eina_value_flush(&subst); } else if (!strcmp(key, "mpris:artUrl")) { eina_value_struct_value_get(&st, "arg1", &subst); eina_value_struct_get(&subst, "arg0", &str_val); uri = efreet_uri_decode(str_val); if (uri && !strncmp(uri->protocol, "file", 4)) ctxt->meta_cover = eina_stringshare_add(uri->path); E_FREE_FUNC(uri, efreet_uri_free); eina_value_flush(&subst); } eina_value_flush(&st); } }
EAPI void e_backlight_level_set(E_Zone *zone, double val, double tim) { double bl_now; // zone == NULL == everything // 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 (val < 0.0) val = 0.0; else if (val > 1.0) val = 1.0; if ((fabs(val - e_bl_val) < DBL_EPSILON) && (!bl_anim)) return; if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); ecore_event_add(E_EVENT_BACKLIGHT_CHANGE, NULL, NULL, NULL); bl_now = e_bl_val; e_bl_val = val; if (fabs(tim) < DBL_EPSILON) { _e_backlight_set(zone, val); return; } // if (e_config->backlight.mode != E_BACKLIGHT_MODE_NORMAL) return; if (e_config->backlight.mode == E_BACKLIGHT_MODE_NORMAL) tim = 0.5; else if (tim < 0.0) tim = e_config->backlight.transition; E_FREE_FUNC(bl_anim, ecore_animator_del); bl_anim = ecore_animator_timeline_add(tim, _bl_anim, zone); bl_animval = bl_now; }
static void _e_pointer_active_handle(E_Pointer *ptr) { _e_pointer_active(ptr); if (ptr->idle_tmr) ecore_timer_reset(ptr->idle_tmr); else { E_FREE_FUNC(ptr->idle_poll, ecore_poller_del); if (e_powersave_mode_get() >= E_POWERSAVE_MODE_MEDIUM) return; if (!e_config->idle_cursor) return; ptr->idle_tmr = ecore_timer_loop_add(1.0, _e_pointer_cb_idle_pre, ptr); } }
static Eina_Bool _e_elm_win_trap_hide(void *data, Evas_Object *o) { Elm_Win_Trap_Ctx *ctx = data; EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE); if (!ctx->visible) return EINA_FALSE; if (strncmp(ecore_evas_engine_name_get(e_win_ee_get(o)), "wayland", 7)) E_FREE_FUNC(ctx->pointer, e_object_del); #ifdef HAVE_WAYLAND else if (ctx->client) e_pixmap_alias(NULL, E_PIXMAP_TYPE_WL, ecore_wl2_window_surface_id_get(elm_win_wl_window_get(o))); #endif if (!ctx->client) return EINA_TRUE; ctx->visible = 0; evas_object_hide(ctx->client->frame); return EINA_FALSE; }
static Eina_Bool _e_pointer_cb_idle_wait(void *data) { E_Pointer *ptr; if (!(ptr = data)) return ECORE_CALLBACK_RENEW; ptr->idle_tmr = NULL; if ((e_powersave_mode_get() >= E_POWERSAVE_MODE_MEDIUM) || (!e_config->idle_cursor)) { E_FREE_FUNC(ptr->idle_poll, ecore_poller_del); return ECORE_CALLBACK_CANCEL; } if (!ptr->idle_poll) ptr->idle_poll = ecore_poller_add(ECORE_POLLER_CORE, 64, _e_pointer_cb_idle_poller, ptr); return ECORE_CALLBACK_CANCEL; }
E_API void e_screensaver_update(void) { int timeout; Eina_Bool changed = EINA_FALSE; timeout = e_screensaver_timeout_get(EINA_TRUE); if (!((e_config->screensaver_enable) && (!e_config->mode.presentation) && (!((e_util_fullscreen_current_any()) && (e_config->no_dpms_on_fullscreen))))) timeout = 0; if (_e_screensaver_timeout != timeout) { _e_screensaver_timeout = timeout; changed = EINA_TRUE; } #ifndef HAVE_WAYLAND_ONLY int interval = 0, blanking = 0, expose = 0; interval = e_config->screensaver_interval; blanking = e_config->screensaver_blanking; expose = e_config->screensaver_expose; // if (_e_screensaver_interval != interval) // { // _e_screensaver_interval = interval; // changed = EINA_TRUE; // } if (_e_screensaver_blanking != blanking) { _e_screensaver_blanking = blanking; changed = EINA_TRUE; } if (_e_screensaver_expose != expose) { _e_screensaver_expose = expose; changed = EINA_TRUE; } if (e_comp->comp_type != E_PIXMAP_TYPE_WL) { if (changed) { // this toggling of dpms is a bug workaround in x that i found // where if we change screensaver timeouts and force a manual // wake of the screen e.g. on lid open/close we have to toggle // it for x to stop thinking the monitor is off when it's // actually on and this causes later dpms issues where the // screen doesnt turn off at all because x thinks interanlly // that the monitor is still off... so this is odd, but it's // necessary on some hardware. if (!e_config->screensaver_dpms_off) { int enabled; enabled = ((e_config->screensaver_enable) && (!e_config->mode.presentation)); ecore_x_dpms_enabled_set(!enabled); ecore_x_dpms_enabled_set(enabled); } ecore_x_screensaver_set(timeout, interval, blanking, expose); } } #endif #ifdef HAVE_WAYLAND if (changed && (e_comp->comp_type == E_PIXMAP_TYPE_WL)) { E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del); if (timeout) _e_screensaver_timer = ecore_timer_loop_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1); } #endif }