App-Chart
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/Chart/Glib/Ex/ChildPid.pm view on Meta::CPAN
$! = POSIX::ECHILD();
return -1;
}
if (! defined $sig) { $sig = 'TERM'; }
$self->{'terminate_sig'} = $sig;
if ($self->kill($sig) != 1) {
return -1;
}
$self->{'terminate_ids'} = Glib::Ex::SourceIds->new
(Glib::Timeout->add ($self->get('terminate-timeout'),
\&_terminate_timeout,
App::Chart::Glib::Ex::MoreUtils::ref_weak($self)));
return 1;
}
sub _terminate_timeout {
my ($ref_weak_self) = @_;
my $self = $$ref_weak_self || return;
my $sig = $self->{'terminate_sig'};
if ($sig eq 'KILL' || $sig eq POSIX::SIGKILL()) {
lib/App/Chart/Gtk2/Subprocess.pm view on Meta::CPAN
}
return Glib::SOURCE_CONTINUE;
}
sub _update_idle_timer {
my ($self) = @_;
my $want_timer = ($self->pid && ! $self->{'job'});
if ($want_timer) {
$self->{'timer_ids'} ||= Glib::Ex::SourceIds->new
(Glib::Timeout->add (IDLE_TIMEOUT_SECONDS * 1000,
\&_do_idle_timeout,
App::Chart::Glib::Ex::MoreUtils::ref_weak($self)));
} else {
$self->{'timer_ids'} = undef;
}
}
sub _do_idle_timeout {
my ($ref_weak_self) = @_;
my $self = $$ref_weak_self || return Glib::SOURCE_REMOVE;
maybe/TimerObject.pm view on Meta::CPAN
sub _establish {
my ($self) = @_;
if (my $id = delete $self->{'source_id'}) {
Glib::Source->remove ($id);
}
if (my $period = $self->{'period'}) {
my $weak_self = $self;
Scalar::Util::weaken ($weak_self);
$self->{'source_id'} = Glib::Timeout->add
($period,
\&Gtk2::Ex::SourceObject::_source_callback, \$weak_self,
$self->{'priority'} || Glib::G_PRIORITY_DEFAULT);
### timer id: "$self $self->{'source_id'}"
}
}
sub set_period {
my ($self, $period) = @_;
my $old_period = $self->{'period'};
maybe/TimerObject.t view on Meta::CPAN
$SIG{ALRM} = sub {
die "main loop hung: $main_where";
};
my $attempts = 0;
sub attempts {
if (--$attempts < 0) { Gtk2->main_quit; }
return 1;
}
sub main {
$attempts = 10;
my $id = Glib::Timeout->add (1, \&attempts);
alarm(5);
Gtk2->main;
alarm(0);
($main_where) = 'nowhere';
Glib::Source->remove ($id);
}
skip ($if_no_display, sub {
my $timer = Gtk2::Ex::TimerObject->new (1000, \&noop);
misc/t-button-sens.pl view on Meta::CPAN
my $toplevel = Gtk2::Window->new('toplevel');
$toplevel->signal_connect (destroy => sub { Gtk2->main_quit });
my $button = Gtk2::Button->new_with_label ('Press');
$toplevel->add ($button);
$button->signal_connect
(clicked => sub {
print "insensitive\n";
$button->set_sensitive (0);
Glib::Timeout->add (1000, sub {
print "sensitive again\n";
$button->set_sensitive (1);
return 1; # Glib::SOURCE_CONTINUE
});
});
$toplevel->show_all;
Gtk2->main;
exit 0;
misc/t-entry.pl view on Meta::CPAN
print "$progname: entry activate\n";
});
$vbox->pack_start ($entry, 0,0,0);
my $keyval_left = Gtk2::Gdk->keyval_from_name('Left');
{
my $button = Gtk2::Button->new_with_label ("keyval left");
$button->signal_connect
(clicked => sub {
Glib::Timeout->add
(3000, sub {
print "$progname: keyval left\n";
$entry->bindings_activate ($keyval_left, []);
return 0;
});
});
$vbox->pack_start ($button, 0,0,0);
}
{
my $button = Gtk2::Button->new_with_label ("event left");
$button->signal_connect
(clicked => sub {
my $event = Gtk2::Gdk::Event->new ('key-press');
$event->window ($entry->window);
# $event->hardware_keycode (100); # Left
$event->hardware_keycode (36); # Return
$event->group (0);
$event->keyval ($keyval_left);
$event->set_state ([]);
Glib::Timeout->add
(3000, sub {
print "$progname: event left\n";
print " dispatch ",($entry->bindings_activate_event($event)
? "yes" : "no"), "\n";
return 0;
});
});
$vbox->pack_start ($button, 0,0,0);
}
misc/t-timer-object.pl view on Meta::CPAN
weak => 1);
}
Gtk2->main;
exit 0;
}
{
my $widget = Gtk2::Label->new;
my $weak_widget = $widget;
Scalar::Util::weaken ($weak_widget);
my $id = Glib::Timeout->add (1000, \&timer, $weak_widget);
Gtk2->main;
exit 0;
}
__END__
{
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.489 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )