1 |
NAME |
2 |
Glib::EV - Coerce Glib into using the EV module as event loop. |
3 |
|
4 |
SYNOPSIS |
5 |
use Glib::EV; |
6 |
|
7 |
# example with Gtk2: |
8 |
use Gtk2 -init; |
9 |
use Glib::EV; |
10 |
use EV; # any order |
11 |
my $timer = EV::timer 1, 1, 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::EV; |
19 |
use Glib::EV; |
20 |
async { main Gtk2 }; |
21 |
# ... do other things |
22 |
|
23 |
DESCRIPTION |
24 |
If you want to use glib/gtk+ in an EV program, then you need to look at |
25 |
the EV::Glib module, not this one, as this module requires you to run a |
26 |
Glib or Gtk+ main loop in your program. |
27 |
|
28 |
If you want to use EV in an Glib/Gtk+ program, you are at the right |
29 |
place here. |
30 |
|
31 |
This module coerces the Glib event loop to use the EV high performance |
32 |
event loop as underlying event loop, i.e. EV will be used by Glib for |
33 |
all events. |
34 |
|
35 |
This makes Glib compatible to EV. Calls into the Glib main loop are more |
36 |
or less equivalent to calls to "EV::loop" (but not vice versa, you |
37 |
*have* to use the Glib mainloop functions). |
38 |
|
39 |
* The Glib perl module is not used. |
40 |
|
41 |
This module has no dependency on the existing Glib perl interface, |
42 |
as it uses glib directly. The Glib module can, however, be used |
43 |
without any problems (as long as everybody uses shared libraries to |
44 |
keep everybody else happy). |
45 |
|
46 |
* The default context will be changed when the module is loaded. |
47 |
|
48 |
Loading this module will automatically "patch" the default context |
49 |
of libglib, so normally nothing more is required. |
50 |
|
51 |
* Glib does not allow recursive invocations. |
52 |
|
53 |
This means that none of your event watchers might call into Glib |
54 |
functions or functions that might call glib functions (basically all |
55 |
Gtk2 functions). It might work, but that's your problem.... |
56 |
|
57 |
BUGS |
58 |
* No documented API to patch other main contexts. |
59 |
|
60 |
SEE ALSO |
61 |
EV, Glib, Glib::MainLoop. |
62 |
|
63 |
AUTHOR |
64 |
Marc Lehmann <schmorp@schmorp.de> |
65 |
http://home.schmorp.de/ |
66 |
|