2016-06-28 19:49:24 -07:00
|
|
|
import efl_types;
|
2017-08-08 14:10:36 -07:00
|
|
|
import eina_types;
|
2016-06-28 19:49:24 -07:00
|
|
|
|
2016-06-22 14:36:39 -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
|
|
|
}
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
class Efl.Loop (Efl.Object)
|
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
|
|
|
|
and powerful multi-cpu workstations. The main loop has a number of primitives you can use.
|
|
|
|
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 {
|
2016-06-28 19:15:06 -07:00
|
|
|
@property main @class {
|
|
|
|
[[Points to the main loop instance of the application.]]
|
|
|
|
get {}
|
|
|
|
values {
|
2016-11-11 01:58:22 -08:00
|
|
|
main_loop: Efl.Loop; [[Application main loop]]
|
2016-06-28 19:15:06 -07:00
|
|
|
}
|
|
|
|
}
|
2016-06-28 19:49:24 -07:00
|
|
|
@property app_efl_version {
|
|
|
|
[[Indicates the version of EFL with which this application was compiled.
|
|
|
|
|
|
|
|
This might differ from @.efl_version.
|
|
|
|
]]
|
|
|
|
get {}
|
|
|
|
values {
|
2017-11-02 08:40:42 -07:00
|
|
|
@cref version: Efl.Version; [[Efl version]]
|
2016-06-28 19:49:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@property efl_version {
|
|
|
|
[[Indicates the currently running version of EFL.
|
|
|
|
|
|
|
|
This might differ from @.app_efl_version.
|
|
|
|
]]
|
|
|
|
get {}
|
|
|
|
values {
|
2017-11-02 08:40:42 -07:00
|
|
|
@cref version: Efl.Version; [[Efl version]]
|
2016-06-28 19:49:24 -07:00
|
|
|
}
|
|
|
|
}
|
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
|
|
|
]]
|
2017-11-08 22:59:04 -08:00
|
|
|
return: ptr(Eina.Future) @owned /* TODO: future<void> */; [[The future handle.]]
|
|
|
|
}
|
|
|
|
@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 {
|
|
|
|
timepoint: double; [[Time in seconds since process specfic start point]]
|
|
|
|
}
|
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
|
|
|
]]
|
2017-11-08 22:59:04 -08:00
|
|
|
return: ptr(Eina.Future) @owned /* TODO: future<void> */; [[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.]]
|
|
|
|
}
|
2017-09-15 07:51:37 -07:00
|
|
|
return: ptr(Eina.Future) @owned /* future<void> */; [[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
|
|
|
}
|
2017-12-15 18:55:43 -08: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 {
|
2016-04-20 15:54:18 -07:00
|
|
|
idle,enter @restart; [[Event occurs once the main loop enters the idle state.]]
|
|
|
|
idle,exit @restart; [[Event occurs once the main loop exits the idle state.]]
|
2017-12-20 01:41:41 -08:00
|
|
|
idle @restart; [[Event occurs once the main loop is idle. If you keep listening on this event it may increase the burden on your CPU.]]
|
2016-06-22 14:36:39 -07:00
|
|
|
arguments: Efl.Loop.Arguments; [[Event happens when args are provided to the loop by args_add().]]
|
2017-12-20 01:41:41 -08:00
|
|
|
poll,high; [[Event occurs multiple times per second. The exact tick is undefined and can be adjusted system wide.]]
|
|
|
|
poll,medium; [[Event occurs multiple times per minute. The exact tick is undefined and can be adjusted system wide.]]
|
|
|
|
poll,low; [[Event occurs multiple times every 15 minutes. The exact tick is undefined and can be adjusted system wide.]]
|
|
|
|
pause; [[Called when the window is not going be displayed for some time]]
|
|
|
|
resume; [[Called before a window is rendered after a pause event]]
|
|
|
|
terminate; [[Called before starting the shutdown of Elementary]]
|
2018-01-06 01:49:07 -08:00
|
|
|
signal,usr1; [[System specific, but on unix maps to SIGUSR1 signal to the process - only called on main loop object]]
|
|
|
|
signal,usr2; [[System specific, but on unix maps to SIGUSR2 signal to the process - only called on main loop object]]
|
|
|
|
signal,hup; [[System specific, but on unix maps to SIGHUP signal to the process - only called on main loop object]]
|
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;
|
|
|
|
Efl.Object.destructor;
|
|
|
|
Efl.Object.provider_find;
|
2016-04-21 11:57:14 -07:00
|
|
|
}
|
2014-06-16 06:24:45 -07:00
|
|
|
}
|