ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Glib-Event/Event.pm
Revision: 1.4
Committed: Tue Nov 29 16:03:24 2005 UTC (18 years, 5 months ago) by root
Branch: MAIN
CVS Tags: rel-0_2, HEAD
Changes since 1.3: +11 -3 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 =head1 NAME
2
3 Glib::Event - Coerce Glib into using the Event module as event loop.
4
5 =head1 SYNOPSIS
6
7 use Glib::Event;
8
9 # example with Gtk2:
10 use Gtk2 -init;
11 use Glib::Event;
12 use Event; # any order
13 Event->timer (after => 1, interval => 1, cb => sub { print "I am here!\n" });
14 main Gtk2;
15 # etc., it just works
16
17 # You can even move the glib mainloop into a coroutine:
18 use Gtk2 -init;
19 use Coro;
20 use Coro::Event;
21 use Glib::Event;
22 async { main Gtk2 };
23 # ... do other things
24
25 =head1 DESCRIPTION
26
27 This module coerces the Glib event loop to use the Event module as
28 underlying event loop, i.e. Event will be used by Glib for all events.
29
30 This makes Glib compatible to Event. Calls into the Glib main loop
31 are more or less equivalent to calls to C<Event::loop>.
32
33 =over 4
34
35 =item * The Glib perl module is not used.
36
37 This module has no dependency on the existing Glib perl interface, as it
38 uses glib directly. The Glib module can, however, be used without any
39 problems.
40
41 =item * The default context will be changed when the module is loaded.
42
43 Loading this module will automatically "patch" the default context of
44 libglib, so normally nothing more is required.
45
46 =item * Glib does not allow recursive invocations.
47
48 This means that none of your event watchers might call into Glib
49 functions or functions that might call glib functions (basically all Gtk2
50 functions). It might work, but that's your problem....
51
52 =cut
53
54 package Glib::Event;
55
56 use Carp ();
57 use Event ();
58
59 our $default_poll_func;
60
61 BEGIN {
62 $VERSION = 0.2;
63
64 require XSLoader;
65 XSLoader::load (Glib::Event, $VERSION);
66
67 $default_poll_func = install (undef);
68 }
69
70 =back
71
72 =cut
73
74 =head1 BUGS
75
76 * No documented API to patch other main contexts.
77 * Uses one_event, which is inefficient.
78
79 =head1 SEE ALSO
80
81 L<Event>, L<Glib>, L<Glib::MainLoop>.
82
83 =head1 AUTHOR
84
85 Marc Lehmann <schmorp@schmorp.de>
86 http://home.schmorp.de/
87
88 =cut
89
90 1
91