[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] Too many Ecore events stop the Ecore's main loop?

Hi everyone,

In Etk, in order to update the widgets when the window is resized, I
use an ecore job: in the Ecore_Evas's resize_cb, I just create an
"update job" with ecore_job_add() if there is no "update job" created
yet. This job will resize the widgets.

My problem is that if the window is resized too often (i.e. if I drag
the bottom-right corner of the window, and draw small circles with the
mouse to resize the window), the "update job" is not called anymore.
When I stop resizing, the job is called again.

I wrote a small code (attached to this mail) to illustrate the problem.
Just try to resize the window of the test prog (by "drawing small
circles" witht the mouse), and you'll see that sooner or later, the job
won't be called anymore (no more output in the terminal and the purple
rectangle is no longer resized). Jobs are not the only ones affected by
this problem, I tried with timers and animators, they are also not
called. Ecore's main loop just seems to be stopped when the window is

For info, my CPU is an Athlon XP 2700+

Could you explain me why this happens?

Simon TRENY <MoOm>
#include <stdlib.h>
#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Job.h>
#include <Ecore_Evas.h>

static void _resize_cb(Ecore_Evas *ee);
static void _job_cb(void *data);

static Evas_Object *_rect = NULL;
static Ecore_Job *_job = NULL;
static int _count = 0;

int main(int argc, char *argv[])
   Ecore_Evas *ee;
   ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 300, 300);
   ecore_evas_callback_resize_set(ee, _resize_cb);
   _rect = evas_object_rectangle_add(ecore_evas_get(ee));
   evas_object_resize(_rect, 300, 300);
   evas_object_color_set(_rect, 0, 128, 128, 255);
   return 0;

/* Called when the window is resized */
static void _resize_cb(Ecore_Evas *ee)
   if (!_job)
      _job = ecore_job_add(_job_cb, ee);

/* Executes the job queued by _resize_cb() */
static void _job_cb(void *data)
   Ecore_Evas *ee;
   int w, h;
   if (!(ee = data))
   printf("Job: Iteration %d\n", _count++);
   ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
   evas_object_resize(_rect, w, h);
   _job = NULL;