| 1 |
root |
1.1 |
NAME |
| 2 |
|
|
Glib::Event - Coerce Glib into using the Event module as event loop. |
| 3 |
|
|
|
| 4 |
|
|
SYNOPSIS |
| 5 |
|
|
use Glib::Event; |
| 6 |
|
|
|
| 7 |
|
|
# example with Gtk2: |
| 8 |
|
|
use Gtk2 -init; |
| 9 |
|
|
use Glib::Event; |
| 10 |
|
|
use Event; # any order |
| 11 |
|
|
Event->timer (after => 1, interval => 1, cb => sub { print "I am here!\n" }); |
| 12 |
|
|
main Gtk2; |
| 13 |
|
|
# etc., it just works |
| 14 |
|
|
|
| 15 |
|
|
# You can even move the glib mainloop into a coroutine: |
| 16 |
|
|
use Gtk2 -init; |
| 17 |
|
|
use Coro; |
| 18 |
|
|
use Coro::Event; |
| 19 |
|
|
use Glib::Event; |
| 20 |
|
|
async { main Gtk2 }; |
| 21 |
|
|
# ... do other things |
| 22 |
|
|
|
| 23 |
|
|
DESCRIPTION |
| 24 |
|
|
This module coerces the Glib event loop to use the Event module as |
| 25 |
|
|
underlying event loop, i.e. Event will be used by Glib for all events. |
| 26 |
|
|
|
| 27 |
|
|
This makes Glib compatible to Event. Calls into the Glib main loop are |
| 28 |
|
|
more or less equivalent to calls to "Event::loop". |
| 29 |
|
|
|
| 30 |
|
|
* The Glib perl module is not used. |
| 31 |
|
|
This module has no dependency on the existing Glib perl interface, |
| 32 |
|
|
as it uses glib directly. The Glib module can, however, be used |
| 33 |
|
|
without any problems. |
| 34 |
|
|
|
| 35 |
|
|
* The default context will be changed when the module is loaded. |
| 36 |
|
|
Loading this module will automatically "patch" the default context |
| 37 |
|
|
of libglib, so normally nothing more is required. |
| 38 |
|
|
|
| 39 |
|
|
* Glib does not allow recursive invocations. |
| 40 |
|
|
This means that none of your event watchers might call into Glib |
| 41 |
|
|
functions or functions that might call glib functions (basically all |
| 42 |
|
|
Gtk2 functions). It might work, but that's your problem.... |
| 43 |
|
|
|
| 44 |
|
|
BUGS |
| 45 |
|
|
* No documented API to patch other main contexts. |
| 46 |
|
|
* Uses one_event, which is inefficient. |
| 47 |
|
|
|
| 48 |
|
|
SEE ALSO |
| 49 |
|
|
Event, Glib, Glib::MainLoop. |
| 50 |
|
|
|
| 51 |
|
|
AUTHOR |
| 52 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 53 |
|
|
http://home.schmorp.de/ |
| 54 |
|
|
|