Input Events Freezing Functions

Functions that deal with the freezing of input event processing of an Evas canvas. More...

Functions

void evas_event_default_flags_set (Evas *e, Evas_Event_Flags flags)
 Set the default set of flags an event begins with. More...
 
Evas_Event_Flags evas_event_default_flags_get (const Evas *e)
 Get the defaulty set of flags an event begins with. More...
 
void evas_event_freeze (Evas *e)
 Freeze all input events processing. More...
 
void evas_event_thaw (Evas *e)
 Thaw a canvas out after freezing (for input events). More...
 
int evas_event_freeze_get (const Evas *e)
 Return the freeze count on input events of a given canvas. More...
 
void evas_event_thaw_eval (Evas *e)
 After thaw of a canvas, re-evaluate the state of objects and call callbacks. More...
 

Detailed Description

Functions that deal with the freezing of input event processing of an Evas canvas.

There might be scenarios during a graphical user interface program's use when the developer wishes the users wouldn't be able to deliver input events to this application. It may, for example, be the time for it to populate a view or to change some layout. Assuming proper behavior with user interaction during this exact time would be hard, as things are in a changing state. The programmer can then tell the canvas to ignore input events, bringing it back to normal behavior when he/she wants.

Most of the time use of freezing events is done like this:

evas_event_freeze(my_evas_canvas);
function_that_does_work_which_cant_be_interrupted_by_events();
evas_event_thaw(my_evas_canvas);

Some of the functions in this group are exemplified here.

Function Documentation

Evas_Event_Flags evas_event_default_flags_get ( const Evas e)

Get the defaulty set of flags an event begins with.

Parameters
eThe canvas to get the default event flags from
Returns
The default event flags for that canvas

This gets the default event flags events are produced with when fed in.

See Also
evas_event_default_flags_set()
Since
1.2

References EVAS_EVENT_FLAG_ON_HOLD.

void evas_event_default_flags_set ( Evas e,
Evas_Event_Flags  flags 
)

Set the default set of flags an event begins with.

Parameters
eThe canvas to set the default event flags of
flagsThe default flags to use

Events in evas can have an event_flags member. This starts out with and initial value (no flags). this lets you set the default flags that an event begins with to be flags

Since
1.2
void evas_event_freeze ( Evas e)

Freeze all input events processing.

Parameters
eThe canvas to freeze input events processing on.

This function will indicate to Evas that the canvas e is to have all input event processing frozen until a matching evas_event_thaw() function is called on the same canvas. All events of this kind during the freeze will get discarded. Every freeze call must be matched by a thaw call in order to completely thaw out a canvas (i.e. these calls may be nested). The most common use is when you don't want the user to interact with your user interface when you're populating a view or changing the layout.

Example:

"\tf - freeze input for 3 seconds\n"
"\tp - toggle precise point collision detection on image\n"
"\tControl + o - add an obscured rectangle\n"
"\th - print help\n";
struct test_data
{
Ecore_Evas *ee;
Evas *canvas;
Evas_Object *img, *bg;
Ecore_Timer *resize_timer, *freeze_timer;
Eina_Bool obscured, focus;
};
/* let's have our events back */
static Eina_Bool
_thaw_cb(void *data __UNUSED__)
{
fprintf(stdout, "Canvas was frozen %d times, now thawing.\n",
evas_event_thaw(d.canvas);
return EINA_FALSE; /* do not re-issue the timer */
}

See the full example.

If you run that example, you'll see the canvas ignoring all input events for 3 seconds, when the "f" key is pressed. In a more realistic code we would be freezing while a toolkit or Edje was doing some UI changes, thawing it back afterwards.

int evas_event_freeze_get ( const Evas e)

Return the freeze count on input events of a given canvas.

Parameters
eThe canvas to fetch the freeze count from.

This returns the number of times the canvas has been told to freeze input events. It is possible to call evas_event_freeze() multiple times, and these must be matched by evas_event_thaw() calls. This call allows the program to discover just how many times things have been frozen in case it may want to break out of a deep freeze state where the count is high.

Example:

extern Evas *evas;
while (evas_event_freeze_get(evas) > 0) evas_event_thaw(evas);
void evas_event_thaw ( Evas e)

Thaw a canvas out after freezing (for input events).

Parameters
eThe canvas to thaw out.

This will thaw out a canvas after a matching evas_event_freeze() call. If this call completely thaws out a canvas, i.e., there's no other unbalanced call to evas_event_freeze(), events will start to be processed again, but any "missed" events will not be evaluated.

See evas_event_freeze() for an example.

void evas_event_thaw_eval ( Evas e)

After thaw of a canvas, re-evaluate the state of objects and call callbacks.

Parameters
eThe canvas to evaluate after a thaw

This is normally called after evas_event_thaw() to re-evaluate mouse containment and other states and thus also call callbacks for mouse in and out on new objects if the state change demands it.

References evas_event_feed_mouse_move().