Esempio n. 1
0
EAPI Evas_Object *
evas_object_top_get(const Evas *e)
{
   Evas_Object *obj = NULL;
   Eina_Inlist *list;
   Evas_Layer *layer;

   MAGIC_CHECK(e, Evas, MAGIC_EVAS);
   return NULL;
   MAGIC_CHECK_END();

   list = EINA_INLIST_GET(e->layers);
   if (!list) return NULL;

   layer = (Evas_Layer *) list->last;
   if (!layer) return NULL;

   list = EINA_INLIST_GET(layer->objects);
   if (!list) return NULL;

   obj = (Evas_Object *) list->last;
   if (!obj) return NULL;

   while (obj)
     {
	if (!obj->delete_me) return obj;
	obj = evas_object_below_get_internal(obj);
     }

   return obj;
}
Esempio n. 2
0
/**
 * Resumes a frozen (paused) timer.
 *
 * @param timer The timer to be resumed.
 *
 * The timer will be resumed from its previous relative position in time. That
 * means, if it had X seconds remaining until expire when it was paused, it will
 * be started now with those same X seconds remaining to expire again. But
 * notice that the interval time won't be touched by this call or by
 * ecore_timer_freeze().
 *
 * @see ecore_timer_freeze()
 */
EAPI void
ecore_timer_thaw(Ecore_Timer *timer)
{
   double now;

   _ecore_lock();

   if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
     {
        ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
                         "ecore_timer_thaw");
        goto unlock;
     }

   /* Timer not frozen */
   if (!timer->frozen)
     goto unlock;

   suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
   now = ecore_time_get();

   _ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data);
unlock:
   _ecore_unlock();
}
Esempio n. 3
0
/**
 * Delete the specified timer from the timer list.
 * @param   timer The timer to delete.
 * @return  The data pointer set for the timer when @ref ecore_timer_add was
 *          called.  @c NULL is returned if the function is unsuccessful.
 *
 * Note: @p timer must be a valid handle. If the timer function has already
 * returned 0, the handle is no longer valid (and does not need to be delete).
 */
EAPI void *
ecore_timer_del(Ecore_Timer *timer)
{
   if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
     {
        ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
                         "ecore_timer_del");
        return NULL;
     }

   if (timer->frozen && !timer->references)
     {
        void *data = timer->data;

        suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));

        if (timer->delete_me)
          timers_delete_me--;

        free(timer);
        return data;
     }

   EINA_SAFETY_ON_TRUE_RETURN_VAL(timer->delete_me, NULL);
   timer->delete_me = 1;
   timers_delete_me++;
   return timer->data;
}
Esempio n. 4
0
Ecore_File_Monitor *
ecore_file_monitor_backend_add(const char *path,
                            void (*func) (void *data, Ecore_File_Monitor *em,
                                          Ecore_File_Event event,
                                          const char *path),
                            void *data)
{
   Ecore_File_Monitor *em;
   size_t len;

   if (!path) return NULL;
   if (!func) return NULL;

   em = calloc(1, sizeof(Ecore_File_Monitor_Poll));
   if (!em) return NULL;

   if (!_timer)
     _timer = ecore_timer_add(_interval, _ecore_file_monitor_poll_handler, NULL);
   else
     ecore_timer_interval_set(_timer, ECORE_FILE_INTERVAL_MIN);

   em->path = strdup(path);
   len = strlen(em->path);
   if (em->path[len - 1] == '/' && strcmp(em->path, "/"))
     em->path[len - 1] = 0;

   em->func = func;
   em->data = data;

   ECORE_FILE_MONITOR_POLL(em)->mtime = ecore_file_mod_time(em->path);
   _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));

   if (ecore_file_exists(em->path))
     {
        if (ecore_file_is_dir(em->path))
          {
             /* Check for subdirs */
             Eina_List *files;
             char *file;

             files = ecore_file_ls(em->path);
             EINA_LIST_FREE(files, file)
                    {
                       Ecore_File *f;
                       char buf[PATH_MAX];

                       f = calloc(1, sizeof(Ecore_File));
                       if (!f)
                    {
                       free(file);
                         continue;
                    }

                       snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
                       f->name = file;
                       f->mtime = ecore_file_mod_time(buf);
                       f->is_dir = ecore_file_is_dir(buf);
                       em->files = (Ecore_File *) eina_inlist_append(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f));
                    }
          }
Esempio n. 5
0
EAPI void
ecore_timer_freeze(Ecore_Timer *timer)
{
   double now;

   if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
     {
        ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
                         "ecore_timer_freeze");
        return ;
     }

   /* Timer already frozen */
   if (timer->frozen)
     return ;

   timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
   suspended = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));

   now = ecore_time_get();

   timer->pending = timer->at - now;
   timer->at = 0.0;
   timer->frozen = 1;
}
Esempio n. 6
0
static inline void
_ecore_timer_reschedule(Ecore_Timer * timer, double when)
{
	if ((timer->delete_me) || (timer->frozen))
		return;

	timers =
	    (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers),
					       EINA_INLIST_GET(timer));

	/* if the timer would have gone off more than 15 seconds ago,
	 * assume that the system hung and set the timer to go off
	 * timer->in from now. this handles system hangs, suspends
	 * and more, so ecore will only "replay" the timers while
	 * the system is suspended if it is suspended for less than
	 * 15 seconds (basically). this also handles if the process
	 * is stopped in a debugger or IO and other handling gets
	 * really slow within the main loop.
	 */
	if ((timer->at + timer->in) < (when - 15.0))
		_ecore_timer_set(timer, when + timer->in, timer->in,
				 timer->func, timer->data);
	else
		_ecore_timer_set(timer, timer->at + timer->in, timer->in,
				 timer->func, timer->data);
}
Esempio n. 7
0
/**
 * Get the exact tile for the given position and zoom.
 *
 * If the tile was unused then it's removed from the cache.
 *
 * After usage, please give it back using
 * ewk_tile_matrix_tile_put(). If you just want to check if it exists,
 * then use ewk_tile_matrix_tile_exact_exists().
 *
 * @param tm the tile matrix to get tile from.
 * @param col the column number.
 * @param row the row number.
 * @param zoom the exact zoom to use.
 *
 * @return The tile instance or @c NULL if none is found. If the tile
 *         was in the unused cache it will be @b removed (thus
 *         considered used) and one should give it back with
 *         ewk_tile_matrix_tile_put() afterwards.
 *
 * @see ewk_tile_matrix_tile_nearest_get()
 * @see ewk_tile_matrix_tile_exact_get()
 */
Ewk_Tile *ewk_tile_matrix_tile_exact_get(Ewk_Tile_Matrix *tm, unsigned long col, unsigned int row, float zoom)
{
    Ewk_Tile *t, *item, *item_found = NULL;
    Eina_Inlist *inl;

    t = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
    if (!t)
        return NULL;

    if (t->zoom == zoom)
        goto end;

    EINA_INLIST_FOREACH(EINA_INLIST_GET(t), item) {
        if (item->zoom != zoom)
            continue;
        item_found = item;
        break;
    }

    if (!item_found)
        return NULL;

    inl = eina_inlist_promote(EINA_INLIST_GET(t), EINA_INLIST_GET(item_found));
    eina_matrixsparse_data_idx_replace(tm->matrix, row, col, inl, NULL);

end:
    if (!t->visible) {
        if (!ewk_tile_unused_cache_tile_get(tm->tuc, t))
            WRN("Ewk_Tile was unused but not in cache? bug!");
    }

    return t;
}
Esempio n. 8
0
EAPI void *
ecore_exe_free(Ecore_Exe *exe)
{
   void *data;

   if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
     {
        ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_free");
        return NULL;
     }

   data = exe->data;

   if (exe->pre_free_cb)
     exe->pre_free_cb(data, exe);

   CloseHandle(exe->process2);
   CloseHandle(exe->process_thread);
   CloseHandle(exe->process);
   free(exe->cmd);
   _ecore_exe_win32_pipes_close(exe);
   exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
   ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
   if (exe->tag) free(exe->tag);
   free(exe);

   return data;
}
Esempio n. 9
0
static void
_evas_cache_engine_image_remove_activ(Evas_Cache_Engine_Image *cache,
                                      Engine_Image_Entry *eim)
{
   if (eim->flags.cached)
     {
        if (eim->flags.dirty)
          {
	     cache->dirty = eina_inlist_remove(cache->dirty, EINA_INLIST_GET(eim));
          }
        else
          if (eim->flags.activ)
            {
	       eina_hash_del(cache->activ, eim->cache_key, eim);
            }
          else
            {
               cache->usage -= cache->func.mem_size_get(eim);
	       eina_hash_del(cache->inactiv, eim->cache_key, eim);
               cache->lru = eina_inlist_remove(cache->lru, EINA_INLIST_GET(eim));
            }
        eim->flags.cached = 0;
        eim->flags.dirty = 0;
        eim->flags.activ = 0;
     }
}
Esempio n. 10
0
static void
_ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data)
{
   Ecore_Timer *t2;

   timers_added = 1;
   timer->at = at;
   timer->in = in;
   timer->func = func;
   timer->data = data;
   timer->just_added = 1;
   timer->frozen = 0;
   timer->pending = 0.0;
   if (timers)
     {
        EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2)
          {
             if (timer->at > t2->at)
               {
                  timers = (Ecore_Timer *) eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
                  return;
               }
          }
     }
   timers = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
}
Esempio n. 11
0
void
_ecore_idle_exiter_call(void)
{
   if (!idle_exiter_current)
     {
        /* regular main loop, start from head */
         idle_exiter_current = idle_exiters;
     }
   else
     {
        /* recursive main loop, continue from where we were */
         idle_exiter_current =
           (Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
     }

   while (idle_exiter_current)
     {
        Ecore_Idle_Exiter *ie = (Ecore_Idle_Exiter *)idle_exiter_current;
        if (!ie->delete_me)
          {
             ie->references++;
             if (!_ecore_call_task_cb(ie->func, ie->data))
               {
                  if (!ie->delete_me) _ecore_idle_exiter_del(ie);
               }
             ie->references--;
          }
        if (idle_exiter_current) /* may have changed in recursive main loops */
          idle_exiter_current =
            (Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
     }
   if (idle_exiters_delete_me)
     {
        Ecore_Idle_Exiter *l;
        int deleted_idler_exiters_in_use = 0;

        for (l = idle_exiters; l; )
          {
             Ecore_Idle_Exiter *ie = l;

             l = (Ecore_Idle_Exiter *)EINA_INLIST_GET(l)->next;
             if (ie->delete_me)
               {
                  if (ie->references)
                    {
                       deleted_idler_exiters_in_use++;
                       continue;
                    }

                  idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
                  ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
                  ecore_idle_exiter_mp_free(ie);
               }
          }
        if (!deleted_idler_exiters_in_use)
          idle_exiters_delete_me = 0;
     }
}
Esempio n. 12
0
void
_ecore_timer_cleanup(void)
{
   Ecore_Timer *l;
   int in_use = 0, todo = timers_delete_me, done = 0;

   if (!timers_delete_me) return;
   for (l = timers; l;)
     {
        Ecore_Timer *timer = l;

        l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
        if (timer->delete_me)
          {
             if (timer->references)
               {
                  in_use++;
                  continue;
               }
             timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
             ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
             free(timer);
             timers_delete_me--;
             done++;
             if (timers_delete_me == 0) return;
          }
     }
   for (l = suspended; l;)
     {
        Ecore_Timer *timer = l;

        l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
        if (timer->delete_me)
          {
             if (timer->references)
               {
                  in_use++;
                  continue;
               }
             suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
             ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
             free(timer);
             timers_delete_me--;
             done++;
             if (timers_delete_me == 0) return;
          }
     }

   if ((!in_use) && (timers_delete_me))
     {
        ERR("%d timers to delete, but they were not found!"
            "Stats: todo=%d, done=%d, pending=%d, in_use=%d. "
            "reset counter.",
            timers_delete_me, todo, done, todo - done, in_use);
        timers_delete_me = 0;
     }
}
Esempio n. 13
0
int
_ecore_timer_call(double when)
{
   if (!timers) return 0;
   if (last_check > when)
     {
        Ecore_Timer *timer;
        /* User set time backwards */
        EINA_INLIST_FOREACH(timers, timer) timer->at -= (last_check - when);
     }
   last_check = when;

   if (!timer_current)
     {
        /* regular main loop, start from head */
        timer_current = timers;
     }
   else
     {
        /* recursive main loop, continue from where we were */
        Ecore_Timer *timer_old = timer_current;
        timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
        _ecore_timer_reschedule(timer_old, when);
     }

   while (timer_current)
     {
        Ecore_Timer *timer = timer_current;

        if (timer->at > when)
          {
             timer_current = NULL; /* ended walk, next should restart. */
             return 0;
          }

        if ((timer->just_added) || (timer->delete_me))
          {
             timer_current = (Ecore_Timer*)EINA_INLIST_GET(timer_current)->next;
             continue;
          }

        timer->references++;
        if (!timer->func(timer->data))
          {
             if (!timer->delete_me) ecore_timer_del(timer);
          }
        timer->references--;

        if (timer_current) /* may have changed in recursive main loops */
          timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;

        _ecore_timer_reschedule(timer, when);
     }
   return 0;
}
Esempio n. 14
0
static void
_ecore_con_info_slave_free(CB_Data *cbdata)
{
   info_slaves = (CB_Data *)eina_inlist_remove(EINA_INLIST_GET(info_slaves),
                                               EINA_INLIST_GET(cbdata));
   ecore_main_fd_handler_del(cbdata->fdh);
   ecore_event_handler_del(cbdata->handler);
   close(ecore_main_fd_handler_fd_get(cbdata->fdh));
   if (cbdata->data) ecore_con_server_infos_del(cbdata->data, cbdata);
   free(cbdata);
}
Esempio n. 15
0
EAPI void
evas_common_tilebuf_free_render_rects(Tilebuf_Rect *rects)
{
   while (rects)
     {
	Tilebuf_Rect *r;

	r = rects;
	rects = (Tilebuf_Rect *)eina_inlist_remove(EINA_INLIST_GET(rects), EINA_INLIST_GET(r));
	free(r);
     }
}
void
ecore_file_monitor_inotify_del(Ecore_File_Monitor *em)
{
   int fd;

   _monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));

   fd = ecore_main_fd_handler_fd_get(_fdh);
   if (ECORE_FILE_MONITOR_INOTIFY(em)->wd)
     inotify_rm_watch(fd, ECORE_FILE_MONITOR_INOTIFY(em)->wd);
   free(em->path);
   free(em);
}
Esempio n. 17
0
void
_ecore_animator_shutdown(void)
{
   _end_tick();
   while (animators)
     {
        Ecore_Animator *animator;

        animator = animators;
        animators = (Ecore_Animator *)eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
        ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
        ecore_animator_mp_free(animator);
     }
}
Esempio n. 18
0
static inline Ecore_Timer *
_ecore_timer_after_get(Ecore_Timer *base)
{
   Ecore_Timer *timer = (Ecore_Timer *) EINA_INLIST_GET(base)->next;
   double maxtime = base->at + precision;

   while ((timer) && ((timer->delete_me) || (timer->just_added)) && (timer->at <= maxtime))
     timer = (Ecore_Timer *) EINA_INLIST_GET(timer)->next;

   if ((!timer) || (timer->at > maxtime))
     return NULL;

   return timer;
}
Esempio n. 19
0
static Comic_Chapter_Item *
_comic_chapter_item_new(Comic_Chapter *cc)
{
   Comic_Chapter_Item *cci;

   cci = calloc(1, sizeof(Comic_Chapter_Item));
   //DBG("new item: cc %g", cc->number);
   _comic_chapter_item_update(cci, cc, EINA_FALSE);
   cc->csd->chapters = eina_inlist_remove(cc->csd->chapters, EINA_INLIST_GET(cc));
   cc->csd->cs->chapters = eina_inlist_sorted_insert(cc->csd->cs->chapters, EINA_INLIST_GET(cci), (Eina_Compare_Cb)_comic_chapter_item_sort_cb);
   cci->chapters = eina_inlist_append(cci->chapters, EINA_INLIST_GET(cc));
   cci->chapter_count++;
   return cci;
}
Esempio n. 20
0
Comic_Chapter_Item *
comic_chapter_item_chapter_add(Comic_Chapter *cc, Comic_Chapter_Item *cci)
{
   Eina_Bool forward = EINA_TRUE;

   //DBG("(cc=%g, cci=%g)", cc->number, cci ? cci->cc->number : 0);
   if (!cc->csd->cs->chapters)
     return _comic_chapter_item_new(cc);

   if (!cci)
     {
        if (cc->number > cc->csd->cs->total / 2)
          {
             cci = EINA_INLIST_CONTAINER_GET(cc->csd->cs->chapters->last, Comic_Chapter_Item);
             forward = EINA_FALSE;
          }
        else
          cci = EINA_INLIST_CONTAINER_GET(cc->csd->cs->chapters, Comic_Chapter_Item);
     }
   if (cci->cc->number > cc->number)
     forward = EINA_FALSE;
   if (forward)
     {
        //DBG("ITER: FORWARD");
        for (; cci; cci = comic_chapter_item_next_get(cci))
          {
             if (cci->cc->number < cc->number) continue;
             cc->csd->chapters = eina_inlist_remove(cc->csd->chapters, EINA_INLIST_GET(cc));
             //DBG("INSERT: %g", cci->cc->number);
             cci->chapters = eina_inlist_sorted_insert(cci->chapters, EINA_INLIST_GET(cc), (Eina_Compare_Cb)_comic_chapter_sort_cb);
             cci->chapter_count++;
             _comic_chapter_item_update(cci, cc, EINA_FALSE);
             return cci;
          }
        return _comic_chapter_item_new(cc);
     }
    //DBG("ITER: BACKWARD");
    for (; cci; cci = comic_chapter_item_prev_get(cci))
      {
         if (cci->cc->number > cc->number) continue;
         cc->csd->chapters = eina_inlist_remove(cc->csd->chapters, EINA_INLIST_GET(cc));
         //DBG("INSERT: %g", cci->cc->number);
         cci->chapters = eina_inlist_sorted_insert(cci->chapters, EINA_INLIST_GET(cc), (Eina_Compare_Cb)_comic_chapter_sort_cb);
         cci->chapter_count++;
         _comic_chapter_item_update(cci, cc, EINA_FALSE);
         return cci;
      }
   return _comic_chapter_item_new(cc);
}
Esempio n. 21
0
static Eina_Bool
_do_tick(void)
{
   Ecore_Animator *animator;

   EINA_INLIST_FOREACH(animators, animator)
     {
        animator->just_added = EINA_FALSE;
     }
   EINA_INLIST_FOREACH(animators, animator)
     {
        if ((!animator->delete_me) && 
            (!animator->suspended) && 
            (!animator->just_added))
          {
             if (!_ecore_call_task_cb(animator->func, animator->data))
               {
                  animator->delete_me = EINA_TRUE;
                  animators_delete_me++;
               }
          }
        else animator->just_added = EINA_FALSE;
     }
   if (animators_delete_me)
     {
        Ecore_Animator *l;
        for (l = animators; l; )
          {
             animator = l;
             l = (Ecore_Animator *)EINA_INLIST_GET(l)->next;
             if (animator->delete_me)
               {
                  animators = (Ecore_Animator *)
                    eina_inlist_remove(EINA_INLIST_GET(animators),
                                       EINA_INLIST_GET(animator));
                  ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
                  ecore_animator_mp_free(animator);
                  animators_delete_me--;
                  if (animators_delete_me == 0) break;
               }
          }
     }
   if (!animators)
     {
        _end_tick();
        return ECORE_CALLBACK_CANCEL;
     }
   return ECORE_CALLBACK_RENEW;
}
Esempio n. 22
0
EAPI void
evas_object_lower(Evas_Object *obj)
{
   MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
   return;
   MAGIC_CHECK_END();
   if (evas_object_intercept_call_lower(obj)) return;
   if (!((EINA_INLIST_GET(obj))->prev))
     {
	evas_object_inform_call_restack(obj);
	return;
     }
   if (obj->smart.parent)
     evas_object_smart_member_lower(obj);
   else
     {
	if (obj->in_layer)
	  obj->layer->objects = (Evas_Object *)eina_inlist_promote(EINA_INLIST_GET(obj->layer->objects),
								   EINA_INLIST_GET(obj));
     }
   if (obj->clip.clipees)
     {
	evas_object_inform_call_restack(obj);
	return;
     }
   if (obj->layer) evas_render_invalidate(obj->layer->evas);
   obj->restack = 1;
   evas_object_change(obj);
   evas_object_inform_call_restack(obj);
   if (obj->layer->evas->events_frozen <= 0)
     {
	if (!evas_event_passes_through(obj))
	  {
	     if (!obj->smart.smart)
	       {
		  if (evas_object_is_in_output_rect(obj,
						    obj->layer->evas->pointer.x,
						    obj->layer->evas->pointer.y, 1, 1) &&
		      obj->cur.visible)
		    evas_event_feed_mouse_move(obj->layer->evas,
					       obj->layer->evas->pointer.x,
					       obj->layer->evas->pointer.y,
					       obj->layer->evas->last_timestamp,
					       NULL);
	       }
	  }
     }
}
Esempio n. 23
0
static void
esql_mysac_res(Esql_Res *res)
{
   MYSAC_ROW *row;
   MYSAC_RES *re;
   MYSAC *m;
   Esql_Row *r;

   re = res->backend.res = mysac_get_res(res->e->backend.db);
   if (!re) return;
   m = res->e->backend.db;
   res->desc = esql_module_desc_get(re->nb_cols, (Esql_Module_Setup_Cb)esql_module_setup_cb, res);
   mysac_first_row(re);
   row = mysac_fetch_row(re);
   if (!row) /* must be insert/update/etc */
     {
        res->affected = m->affected_rows;
        res->id = m->insert_id;
        return;
     }
   res->row_count = mysac_num_rows(re);
   do
     {
        r = esql_row_calloc(1);
        EINA_SAFETY_ON_NULL_RETURN(r);
        r->res = res;
        esql_mysac_row_init(r, row);
        res->rows = eina_inlist_append(res->rows, EINA_INLIST_GET(r));
     } while ((row = mysac_fetch_row(re)));
}
Esempio n. 24
0
static Eina_Simple_XML_Node_Data *
_eina_simple_xml_node_data_new(Eina_Simple_XML_Node_Tag *parent, Eina_Simple_XML_Node_Type type, const char *content, unsigned length)
{
   Eina_Simple_XML_Node_Data *n;

   if (!content) return NULL;

   n = malloc(sizeof(*n) + length + 1);

   if (!n)
     {
        ERR("could not allocate memory for node");
        return NULL;
     }

   EINA_MAGIC_SET(&n->base, EINA_MAGIC_SIMPLE_XML_DATA);
   n->base.type = type;
   n->base.parent = parent;

   n->length = length;
   memcpy(n->data, content, length);
   n->data[length] = '\0';

   if (parent)
     parent->children = eina_inlist_append
       (parent->children, EINA_INLIST_GET(&n->base));

   return n;
}
Esempio n. 25
0
EAPI Eina_Bool
eldbus_signal_handler_match_extra_vset(Eldbus_Signal_Handler *sh, va_list ap)
{
   const char *key = NULL, *read;
   DBusError err;

   ELDBUS_SIGNAL_HANDLER_CHECK_RETVAL(sh, EINA_FALSE);

   dbus_error_init(&err);
   dbus_bus_remove_match(sh->conn->dbus_conn,
                         eina_strbuf_string_get(sh->match), &err);
   EINA_SAFETY_ON_TRUE_RETURN_VAL(dbus_error_is_set(&err), EINA_FALSE);

   for (read = va_arg(ap, char *); read; read = va_arg(ap, char *))
     {
        Signal_Argument *arg;

        if (!key)
          {
             key = read;
             continue;
          }
        arg = calloc(1, sizeof(Signal_Argument));
        EINA_SAFETY_ON_NULL_GOTO(arg, error);
        if (!strncmp(key, ARGX, strlen(ARGX)))
          {
             int id = atoi(key + strlen(ARGX));
             arg->index = (unsigned short) id;
             arg->value = eina_stringshare_add(read);
             sh->args = eina_inlist_sorted_state_insert(sh->args,
                                                        EINA_INLIST_GET(arg),
                                                        _sort_arg,
                                                        sh->state_args);
             _match_append(sh->match, key, read);
          }
        else
          {
             ERR("%s not supported", key);
             free(arg);
          }
        key = NULL;
     }

   dbus_error_init(&err);
   dbus_bus_add_match(sh->conn->dbus_conn,
                      eina_strbuf_string_get(sh->match), &err);
   if (!dbus_error_is_set(&err))
     return EINA_TRUE;

   ERR("Error setting new match.");
   return EINA_FALSE;

error:
   dbus_error_init(&err);
   dbus_bus_add_match(sh->conn->dbus_conn,
                      eina_strbuf_string_get(sh->match), &err);
   if (dbus_error_is_set(&err))
     ERR("Error setting partial extra arguments.");
   return EINA_FALSE;
}
Esempio n. 26
0
void
_eina_simple_xml_node_tag_free(Eina_Simple_XML_Node_Tag *tag)
{
   while (tag->children)
     {
        Eina_Simple_XML_Node *n = EINA_INLIST_CONTAINER_GET
          (tag->children, Eina_Simple_XML_Node);
        if (n->type == EINA_SIMPLE_XML_NODE_TAG)
          _eina_simple_xml_node_tag_free((Eina_Simple_XML_Node_Tag *)n);
        else
          _eina_simple_xml_node_data_free((Eina_Simple_XML_Node_Data *)n);
     }

   while (tag->attributes)
     {
        Eina_Simple_XML_Attribute *a = EINA_INLIST_CONTAINER_GET
          (tag->attributes, Eina_Simple_XML_Attribute);
        eina_simple_xml_attribute_free(a);
     }

   if (tag->base.parent)
     tag->base.parent->children = eina_inlist_remove
          (tag->base.parent->children, EINA_INLIST_GET(&tag->base));

   eina_stringshare_del(tag->name);
   EINA_MAGIC_SET(&tag->base, EINA_MAGIC_NONE);
   eina_mempool_free(_eina_simple_xml_tag_mp, tag);
}
Esempio n. 27
0
EAPI Eina_Simple_XML_Node_Tag *
eina_simple_xml_node_tag_new(Eina_Simple_XML_Node_Tag *parent, const char *name)
{
   Eina_Simple_XML_Node_Tag *n;

   if (!name) return NULL;

   n = eina_mempool_malloc(_eina_simple_xml_tag_mp, sizeof(*n));
   if (!n)
     {
        ERR("could not allocate memory for node from mempool");
        return NULL;
     }

   memset(n, 0, sizeof(*n));

   EINA_MAGIC_SET(&n->base, EINA_MAGIC_SIMPLE_XML_TAG);

   n->base.type = EINA_SIMPLE_XML_NODE_TAG;
   n->base.parent = parent;
   n->name = eina_stringshare_add(name);

   if (parent)
     parent->children = eina_inlist_append
       (parent->children, EINA_INLIST_GET(&n->base));

   return n;
}
Esempio n. 28
0
EAPI Eina_Simple_XML_Attribute *
eina_simple_xml_attribute_new(Eina_Simple_XML_Node_Tag *parent, const char *key, const char *value)
{
   Eina_Simple_XML_Attribute *attr;

   if (!key) return NULL;

   attr = eina_mempool_malloc(_eina_simple_xml_attribute_mp, sizeof(*attr));
   if (!attr)
     {
        ERR("could not allocate memory for attribute from mempool");
        return NULL;
     }

   EINA_MAGIC_SET(attr, EINA_MAGIC_SIMPLE_XML_ATTRIBUTE);
   attr->parent = parent;
   attr->key = eina_stringshare_add(key);
   attr->value = eina_stringshare_add(value ? value : "");

   if (parent)
     parent->attributes = eina_inlist_append
       (parent->attributes, EINA_INLIST_GET(attr));

   return attr;
}
Esempio n. 29
0
void
_ecore_idler_shutdown(void)
{
   Ecore_Idler_Data *ie;
   while ((ie = idlers))
     {
        idlers = (Ecore_Idler_Data *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));

        eo_do(ie->obj, eo_parent_set(NULL));
        if (eo_destructed_is(ie->obj))
          eo_manual_free(ie->obj);
        else
          eo_manual_free_set(ie->obj, EINA_FALSE);
     }
   idlers_delete_me = 0;
   idler_current = NULL;
}
Esempio n. 30
0
static Ecore_Animator *
_ecore_animator_add(Ecore_Task_Cb func,
                    const void   *data)
{
   Ecore_Animator *animator = NULL;

   if (!func) return animator;
   animator = ecore_animator_calloc(1);
   if (!animator) return animator;
   ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR);
   animator->func = func;
   animator->data = (void *)data;
   animator->just_added = EINA_TRUE;
   animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
   _begin_tick();
   return animator;
}