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