| 1 |
root |
1.1 |
=head1 NAME |
| 2 |
|
|
|
| 3 |
root |
1.2 |
Glib::Event - Coerce Glib into using the Event module as event loop. |
| 4 |
root |
1.1 |
|
| 5 |
|
|
=head1 SYNOPSIS |
| 6 |
|
|
|
| 7 |
|
|
use Glib::Event; |
| 8 |
|
|
|
| 9 |
root |
1.2 |
# example with Gtk2: |
| 10 |
|
|
use Gtk2; |
| 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 |
root |
1.1 |
=head1 DESCRIPTION |
| 18 |
|
|
|
| 19 |
|
|
This module coerces the Glib event loop to use the Event module as |
| 20 |
|
|
underlying event loop, i.e. Event will be used by Glib for all events. |
| 21 |
|
|
|
| 22 |
|
|
This makes Glib compatible to Event. Calls into the Glib main loop |
| 23 |
|
|
are more or less equivalent to calls to C<Event::loop>. |
| 24 |
|
|
|
| 25 |
|
|
=over 4 |
| 26 |
|
|
|
| 27 |
|
|
=item * The Glib perl module is not used. |
| 28 |
|
|
|
| 29 |
|
|
This module has no dependency on the existing Glib perl interface, as it |
| 30 |
|
|
uses glib directly. The Glib module can, however, be used without any |
| 31 |
|
|
problems. |
| 32 |
|
|
|
| 33 |
|
|
=item * The default context will be changed when the module is loaded. |
| 34 |
|
|
|
| 35 |
|
|
Loading this module will automatically "patch" the default context of |
| 36 |
|
|
libglib, so normally nothing more is required. |
| 37 |
|
|
|
| 38 |
|
|
=cut |
| 39 |
|
|
|
| 40 |
|
|
package Glib::Event; |
| 41 |
|
|
|
| 42 |
|
|
use Carp (); |
| 43 |
|
|
use Event (); |
| 44 |
|
|
|
| 45 |
|
|
our $default_poll_func; |
| 46 |
|
|
|
| 47 |
|
|
BEGIN { |
| 48 |
|
|
$VERSION = 0.1; |
| 49 |
|
|
|
| 50 |
|
|
require XSLoader; |
| 51 |
root |
1.2 |
XSLoader::load (Glib::Event, $VERSION); |
| 52 |
root |
1.1 |
|
| 53 |
|
|
$default_poll_func = install (undef); |
| 54 |
|
|
} |
| 55 |
|
|
|
| 56 |
|
|
=back |
| 57 |
|
|
|
| 58 |
|
|
=cut |
| 59 |
|
|
|
| 60 |
root |
1.2 |
=head1 BUGS |
| 61 |
|
|
|
| 62 |
|
|
* No documented API to patch other main contexts. |
| 63 |
|
|
* Uses one_event, which is inefficient. |
| 64 |
|
|
|
| 65 |
root |
1.1 |
=head1 SEE ALSO |
| 66 |
|
|
|
| 67 |
|
|
L<Event>, L<Glib>, L<Glib::MainLoop>. |
| 68 |
|
|
|
| 69 |
|
|
=head1 AUTHOR |
| 70 |
|
|
|
| 71 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 72 |
|
|
http://home.schmorp.de/ |
| 73 |
|
|
|
| 74 |
|
|
=cut |
| 75 |
|
|
|
| 76 |
|
|
1 |
| 77 |
|
|
|