void TestController::platformRunUntil(bool& condition, double timeout)
{
    if (timeout == m_noTimeout) {
        // Never timeout if we are debugging or not meant to timeout.
        while (!condition)
            ecore_main_loop_iterate();

        return;
    }
    timer = ecore_timer_loop_add(timeout, timerFired, 0);
    ecore_main_loop_begin();
}
Пример #2
0
Timer::Timer (double seconds, sigc::slot<bool, Timer&> task, bool loop) :
  mETimer (NULL),
  mTask (task)  
{
  if (!loop)
  {
    mETimer = ecore_timer_add (seconds, Timer::dispatcherFunc, this);
  }
  else
  {
    mETimer = ecore_timer_loop_add (seconds, Timer::dispatcherFunc, this);
  }
}
Пример #3
0
static void
_win_song_set(Win *w, Song *s)
{
   Edje_Message_Int mi;
   Song *previous;
   char str[32];

   w->play.position = 0.0;
   w->play.length = 0.0;
   previous = w->song;
   w->song = s;
   if (!s) goto end;

   if (s->trackno > 0)
     snprintf(str, sizeof(str), "%d", s->trackno);
   else
     str[0] = '\0';

   edje_object_part_text_set(w->edje, "ejy.text.trackno", str);
   edje_object_part_text_set(w->edje, "ejy.text.title", s->title);
   edje_object_part_text_set(w->edje, "ejy.text.album", s->album);
   edje_object_part_text_set(w->edje, "ejy.text.artist", s->artist);
   edje_object_part_text_set(w->edje, "ejy.text.genre", s->genre);

   mi.val = s->rating;
   edje_object_message_send(elm_layout_edje_get(w->nowplaying), EDJE_MESSAGE_INT, MSG_RATING, &mi);

   emotion_object_file_set(w->emotion, s->path);
   emotion_object_position_set(w->emotion, w->play.position);
   w->play.playing = EINA_TRUE;
   w->play.playing_last = EINA_FALSE;
   emotion_object_play_set(w->emotion, EINA_TRUE);
   emotion_object_audio_volume_set(w->emotion, w->play.volume);

end:
   if ((!w->play.playing) && (w->timer.play_eval))
     {
        ecore_timer_del(w->timer.play_eval);
        w->timer.play_eval = NULL;
     }
   else if ((w->play.playing) && (!w->timer.play_eval))
     w->timer.play_eval = ecore_timer_loop_add
       (0.1, _win_play_eval_timer, w);

   _win_nowplaying_update(w, previous);
   _win_play_eval(w);
   _win_toolbar_eval(w);

   ecore_event_add(ENJOY_EVENT_PLAYER_CAPS_CHANGE, NULL, NULL, NULL);
   ecore_event_add(ENJOY_EVENT_PLAYER_TRACK_CHANGE, NULL, NULL, NULL);
}
Пример #4
0
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);
     }
}
Пример #5
0
static Eina_Bool 
_e_pointer_cb_idle_pre(void *data)
{
   E_Pointer *ptr;

   if (!(ptr = data)) return ECORE_CALLBACK_RENEW;

   if (ptr->canvas)
     ecore_evas_pointer_xy_get(ptr->ee, &ptr->x, &ptr->y);
#ifndef HAVE_WAYLAND_ONLY
   else
     ecore_x_pointer_xy_get(ptr->win, &ptr->x, &ptr->y);
#endif

   ptr->idle_tmr = ecore_timer_loop_add(4.0, _e_pointer_cb_idle_wait, ptr);

   return ECORE_CALLBACK_CANCEL;
}
Пример #6
0
static Eina_Bool
_ecore_wl_input_cursor_update(void *data)
{
   struct wl_cursor_image *cursor_image;
   struct wl_buffer *buffer;
   Ecore_Wl_Input *input = data;
   unsigned int delay;

   if ((!input) || (!input->cursor)) return EINA_FALSE;

   cursor_image = input->cursor->images[input->cursor_current_index];
   if (!cursor_image) return ECORE_CALLBACK_RENEW;

   if ((buffer = wl_cursor_image_get_buffer(cursor_image)))
     {
        ecore_wl_input_pointer_set(input, input->cursor_surface,
                                   cursor_image->hotspot_x,
                                   cursor_image->hotspot_y);
        wl_surface_attach(input->cursor_surface, buffer, 0, 0);
        wl_surface_damage(input->cursor_surface, 0, 0,
                          cursor_image->width, cursor_image->height);
        wl_surface_commit(input->cursor_surface);

        if ((input->cursor->image_count > 1) && (!input->cursor_frame_cb))
          _ecore_wl_input_cb_pointer_frame(input, NULL, 0);
     }

   if (input->cursor->image_count <= 1)
     return ECORE_CALLBACK_CANCEL;

   delay = cursor_image->delay;
   input->cursor_current_index =
      (input->cursor_current_index + 1) % input->cursor->image_count;

   if (!input->cursor_timer)
     input->cursor_timer =
        ecore_timer_loop_add(delay / 1000.0,
                             _ecore_wl_input_cursor_update, input);
   else
     ecore_timer_interval_set(input->cursor_timer, delay / 1000.0);

   return ECORE_CALLBACK_RENEW;
}
Пример #7
0
/**
 * Add a animator to tick off at every animaton tick during main loop execution.
 * @param func The function to call when it ticks off
 * @param data The data to pass to the function
 * @return A handle to the new animator
 * @ingroup Ecore_Animator_Group
 *
 * This function adds a animator and returns its handle on success and NULL on
 * failure. The function @p func will be called every N seconds where N is the
 * frametime interval set by ecore_animator_frametime_set(). The function will
 * be passed the @p data pointer as its parameter.
 *
 * When the animator @p func is called, it must return a value of either 1 or 0.
 * If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at the
 * next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be deleted
 * automatically making any references/handles for it invalid.
 */
EAPI Ecore_Animator *
ecore_animator_add(Ecore_Task_Cb func, const void *data)
{
   Ecore_Animator *animator;

   if (!func) return NULL;
   animator = calloc(1, sizeof(Ecore_Animator));
   if (!animator) return NULL;
   ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR);
   animator->func = func;
   animator->data = (void *)data;
   animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
   if (!timer)
     {
        double t_loop = ecore_loop_time_get();
        double sync_0 = 0.0;
        double d = -fmod(t_loop - sync_0, animators_frametime);

        timer = ecore_timer_loop_add(animators_frametime, _ecore_animator, NULL);
        ecore_timer_delay(timer, d);
     }
   return animator;
}
Пример #8
0
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
}
Пример #9
0
E_API void *
e_modapi_init(E_Module *m)
{
   Eina_List *l;
   Evry_Module *em;
   char buf[4096];

   _mod_evry = m;

   /* add module supplied action */
   act = e_action_add("everything");
   if (act)
     {
        act->func.go = _e_mod_action_cb;
        act->func.go_edge = _e_mod_action_cb_edge;
        e_action_predef_name_set
          (N_("Everything Launcher"),
          N_("Show Everything Launcher"),
          "everything", "", NULL, 0);
     }

   maug = e_int_menus_menu_augmentation_add
       ("main/1", _e_mod_menu_add, NULL, NULL, NULL);

   e_configure_registry_category_add
     ("launcher", 80, _("Launcher"), NULL, "modules-launcher");

   snprintf(buf, sizeof(buf), "%s/e-module-everything.edj", e_module_dir_get(m));
   module_icon = eina_stringshare_add(buf);

   e_configure_registry_item_add
     ("launcher/run_everything", 40, _("Everything Configuration"),
     NULL, module_icon, evry_config_dialog);
   evry_init();

   _evry_type_init("NONE");
   _evry_type_init("FILE");
   _evry_type_init("DIRECTORY");
   _evry_type_init("APPLICATION");
   _evry_type_init("ACTION");
   _evry_type_init("PLUGIN");
   _evry_type_init("BORDER");
   _evry_type_init("TEXT");

   _config_init();

   _evry_events[EVRY_EVENT_ITEMS_UPDATE] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_ITEM_SELECTED] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_ITEM_CHANGED] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_ACTION_PERFORMED] = ecore_event_type_new();
   _evry_events[EVRY_EVENT_PLUGIN_SELECTED] = ecore_event_type_new();

   evry = E_NEW(Evry_API, 1);
#define SET(func) (evry->func = &evry_##func);
   SET(api_version_check);
   SET(item_new);
   SET(item_free);
   SET(item_ref);
   SET(plugin_new);
   SET(plugin_free);
   SET(plugin_register);
   SET(plugin_unregister);
   SET(plugin_update);
   SET(plugin_find);
   SET(action_new);
   SET(action_free);
   SET(action_register);
   SET(action_unregister);
   SET(action_find);
   SET(api_version_check);
   SET(type_register);
   SET(icon_theme_get);
   SET(fuzzy_match);
   SET(util_exec_app);
   SET(util_url_escape);
   SET(util_url_unescape);
   SET(util_file_detail_set);
   SET(util_plugin_items_add);
   SET(util_md5_sum);
   SET(util_icon_get);
   SET(item_changed);
   SET(file_path_get);
   SET(file_url_get);
   SET(history_item_add);
   SET(history_types_get);
   SET(history_item_usage_set);
   SET(event_handler_add);
#undef SET

   evry_history_init();
   evry_plug_actions_init();
   evry_plug_apps_init(m);
   evry_plug_files_init(m);
   evry_plug_windows_init(m);
   evry_plug_settings_init(m);
   evry_plug_calc_init(m);
   e_datastore_set("evry_api", evry);

   EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
     em->active = em->init(evry);

   evry_plug_collection_init();
   evry_plug_clipboard_init();
   evry_plug_text_init();
   evry_view_init();
   evry_view_help_init();
   evry_gadget_init();

   e_module_priority_set(m, -1000);
   e_module_delayed_set(m, 1);

   /* cleanup every hour :) */
   cleanup_timer = ecore_timer_loop_add(3600, _cleanup_history, NULL);

   return m;
}