2018-04-12 04:56:02 -07:00
struct Efl.Loop_Arguments {
2016-10-27 07:43:11 -07:00
[[EFL loop arguments data structure]]
argv: const(array<const(stringshare)>); [[Array with loop arguments]]
2016-10-24 08:21:48 -07:00
initialization: bool; [[Set to $true when the program should initialize its internal state. This happen once per process instance.]]
2016-06-22 14:36:39 -07:00
}
2018-11-22 08:17:29 -08:00
class Efl.Loop extends Efl.Task
2014-06-16 06:24:45 -07:00
{
2016-04-21 15:11:32 -07:00
[[The Efl Main Loop
2016-04-15 06:45:15 -07:00
2017-12-20 01:41:41 -08:00
The Efl main loop provides a clean and tiny event loop library with many modules to
do lots of convenient things for a programmer, saving time and effort. It's
lean and designed to work on anything from embedded systems all the way up to large
2018-12-19 11:02:08 -08:00
and powerful multi-cpu workstations. The main loop has a number of primitives you can use.
2017-12-20 01:41:41 -08:00
It serializes these and allows for
greater responsiveness without the need for threads (or any other concurrency). However
you can provide these if you need to.
2016-04-15 06:45:15 -07:00
]]
2015-05-07 08:36:45 -07:00
methods {
2014-06-16 06:24:45 -07:00
iterate {
2016-04-15 06:45:15 -07:00
[[Runs a single iteration of the main loop to process everything on the
queue.]]
2014-06-16 06:24:45 -07:00
}
iterate_may_block {
2016-06-27 01:26:32 -07:00
[[Runs a single iteration of the main loop to process everything on the
queue with block/non-blocking status.]]
2016-11-11 01:58:22 -08:00
return: int; [[Return from single iteration run]]
2014-06-16 06:24:45 -07:00
params {
2016-04-15 06:45:15 -07:00
may_block: int; [[A flag if the main loop has a possibility of blocking.]]
2014-06-16 06:24:45 -07:00
}
}
begin {
2016-04-15 06:45:15 -07:00
[[Runs the application main loop.]]
2017-10-27 15:31:57 -07:00
return: any_value_ptr; [[Value set by quit()]]
2014-06-16 06:24:45 -07:00
}
quit {
2016-04-15 06:45:15 -07:00
[[Quits the main loop once all the events currently on the queue have
been processed.]]
2016-06-27 01:26:32 -07:00
params {
2017-10-27 15:31:57 -07:00
@in exit_code: any_value; [[Returned value by begin()]]
2016-06-27 01:26:32 -07:00
}
2014-06-16 06:24:45 -07:00
}
2017-12-11 13:51:52 -08:00
job {
2017-08-26 15:59:39 -07:00
[[A future promise that will be resolved from a clean main
loop context as soon as possible.
This has higher priority, for low priority use
2017-12-11 13:57:40 -08:00
@.idle
2017-08-26 15:59:39 -07:00
]]
2018-05-03 08:13:28 -07:00
return: future<void> @owned; [[The future handle.]]
2017-11-08 22:59:04 -08:00
}
@property throttle {
2017-12-20 01:41:41 -08:00
[[Slow down the loop execution by forcing sleep for a small
2017-11-08 22:59:04 -08:00
period of time every time the loop iterates/loops.]]
set {}
get {}
values {
amount : double; [[Time to sleep for each "loop iteration"]]
}
}
@property time {
2017-12-20 01:41:41 -08:00
[[The time point when the loop was logically woken.]]
2017-11-08 22:59:04 -08:00
set {}
get {}
values {
2018-08-29 22:01:21 -07:00
timepoint: double; [[Time in seconds since process specific start point]]
2017-11-08 22:59:04 -08:00
}
2017-08-26 15:59:39 -07:00
}
2017-12-11 13:57:40 -08:00
idle {
2017-08-26 15:59:39 -07:00
[[A future promise that will be resolved from a clean main
loop context as soon as the main loop is idle.
2017-12-11 13:51:52 -08:00
This is a low priority version of @.job
2017-08-26 15:59:39 -07:00
]]
2018-05-03 08:13:28 -07:00
return: future<void> @owned; [[The future handle.]]
2017-08-26 15:59:39 -07:00
}
2017-12-03 16:30:53 -08:00
timeout {
2017-08-26 15:59:39 -07:00
[[A future promise that will be resolved from a clean main
loop context after $time seconds.]]
params {
@in time: double; [[The time from now in second that the main loop will wait before triggering it.]]
}
2018-05-03 08:13:28 -07:00
return: future<void> @owned; [[The future handle.]]
2017-08-26 15:59:39 -07:00
}
2016-06-16 11:38:47 -07:00
register {
[[Will register a manager of a specific class to be answered by eo.provider_find.]]
2016-06-27 01:26:32 -07:00
params {
2016-08-10 07:23:04 -07:00
@in klass: const(Efl.Class); [[The class provided by the registered provider.]]
@in provider: const(Efl.Object); [[The provider for the newly registered class that has to provide that said Efl.Class.]]
2016-06-27 01:26:32 -07:00
}
2016-10-24 08:21:48 -07:00
return: bool; [[$true if successfully register, $false otherwise.]]
2016-06-16 11:38:47 -07:00
}
unregister {
[[Will unregister a manager of a specific class that was previously registered and answered by eo.provider_find.]]
2016-06-27 01:26:32 -07:00
params {
2016-08-10 07:23:04 -07:00
@in klass: const(Efl.Class); [[The class provided by the provider to unregister for.]]
@in provider: const(Efl.Object); [[The provider for the registered class to unregister.]]
2016-06-27 01:26:32 -07:00
}
2016-10-24 08:21:48 -07:00
return: bool; [[$true if successfully unregistered, $false otherwise.]]
2016-06-16 11:38:47 -07:00
}
2017-11-08 22:59:04 -08:00
message_handler_get @class {
2017-12-15 18:55:43 -08:00
[[Get a message handler object that is created by and owned by
the Efl.Loop object, so you can listen to this message type by
listening to message events on the handler as well as send
objects as events.]]
2017-11-08 22:59:04 -08:00
params {
2017-12-15 18:55:43 -08:00
@in loop: Efl.Loop; [[The loop to get the object from.]]
@in klass: const(Efl.Class); [[The class of the message object.]]
2017-11-08 22:59:04 -08:00
}
2018-04-12 04:56:02 -07:00
return: Efl.Loop_Message_Handler; [[The message handler to use.]]
2017-11-08 22:59:04 -08:00
}
2014-06-16 06:24:45 -07:00
}
2014-07-31 22:38:40 -07:00
events {
efl: Add missing event types
Summary:
All events must have a type now, otherwise bindings don't know how to handle
the event_info field.
Most of the missing event types were actually "void" (no event_info present).
Some struct definitions had to be moved to eo instead of h files, so they
are available to bindings. Some have not, and are marked with FIXME.
Some namespaces have been fixed (like Efl_Event_Cb -> Efl.Event_Cb).
In general, there are hundreds of changed files, but mostly to add a type which
was not present before, so there's no harm done.
Also, A lot of FIXMEs have been added which should be, like, fixed.
For example, some events can send different types of event_info, which is
very inconvenient (and error prone).
Test Plan: make with c# bindings works, make check and make examples work too.
Reviewers: cedric, q66, lauromoura
Subscribers: zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6169
2018-05-11 08:20:40 -07:00
idle,enter @restart: void; [[Event occurs once the main loop enters the idle state.]]
idle,exit @restart: void; [[Event occurs once the main loop exits the idle state.]]
idle @restart: void; [[Event occurs once the main loop is idle. If you keep listening on this event it may increase the burden on your CPU.]]
2018-04-12 04:56:02 -07:00
arguments: Efl.Loop_Arguments; [[Event happens when args are provided to the loop by args_add().]]
efl: Add missing event types
Summary:
All events must have a type now, otherwise bindings don't know how to handle
the event_info field.
Most of the missing event types were actually "void" (no event_info present).
Some struct definitions had to be moved to eo instead of h files, so they
are available to bindings. Some have not, and are marked with FIXME.
Some namespaces have been fixed (like Efl_Event_Cb -> Efl.Event_Cb).
In general, there are hundreds of changed files, but mostly to add a type which
was not present before, so there's no harm done.
Also, A lot of FIXMEs have been added which should be, like, fixed.
For example, some events can send different types of event_info, which is
very inconvenient (and error prone).
Test Plan: make with c# bindings works, make check and make examples work too.
Reviewers: cedric, q66, lauromoura
Subscribers: zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6169
2018-05-11 08:20:40 -07:00
poll,high: void; [[Event occurs multiple times per second. The exact tick is undefined and can be adjusted system wide.]]
poll,medium: void; [[Event occurs multiple times per minute. The exact tick is undefined and can be adjusted system wide.]]
poll,low: void; [[Event occurs multiple times every 15 minutes. The exact tick is undefined and can be adjusted system wide.]]
quit: void; [[Event occurs when the loop was requested to quit externally e.g. by a ctrl+c signal or a request from a parent loop/thread to have the child exit.]]
2014-07-31 22:38:40 -07:00
}
2016-04-21 11:57:14 -07:00
implements {
2016-08-10 07:23:04 -07:00
Efl.Object.constructor;
2018-05-01 14:21:49 -07:00
Efl.Object.invalidate;
2016-08-10 07:23:04 -07:00
Efl.Object.destructor;
Efl.Object.provider_find;
2018-02-27 04:19:17 -08:00
Efl.Task.run;
Efl.Task.end;
2016-04-21 11:57:14 -07:00
}
2014-06-16 06:24:45 -07:00
}