line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Curses::UI::AnyEvent; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.101'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
16613
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
921
|
use AnyEvent; |
|
1
|
|
|
|
|
4765
|
|
|
1
|
|
|
|
|
47
|
|
8
|
1
|
|
|
1
|
|
8
|
use base qw( Curses::UI ); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
651
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub startAsync { |
13
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
13
|
$self->do_one_event; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$self->{_async_watcher} = AE::io \*STDIN, 0, sub { |
18
|
1789
|
|
|
1789
|
|
7122
|
$self->do_one_event($self->{_modal_object}); |
19
|
|
|
|
|
|
|
|
20
|
1789
|
0
|
33
|
|
|
91225
|
if (defined $self->{_modal_object} && defined $self->{_modalfocus_cv} && !$self->{_modal_object}->{-has_modal_focus}) { |
|
|
|
33
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
$self->{_modalfocus_cv}->send(); |
22
|
|
|
|
|
|
|
} |
23
|
1
|
|
|
|
|
435
|
}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub stopAsync { |
27
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
21
|
delete $self->{_async_watcher}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub mainloop { |
33
|
1
|
|
|
1
|
1
|
5432
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
5
|
$self->startAsync(); |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
24
|
$self->{_cv} = AE::cv; |
38
|
1
|
|
|
|
|
136
|
$self->{_cv}->recv; |
39
|
1
|
|
|
|
|
17
|
delete $self->{_cv}; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
6
|
$self->stopAsync(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub mainloopExit { |
45
|
1
|
|
|
1
|
1
|
417
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
|
|
5
|
if (exists $self->{_cv}) { |
48
|
1
|
|
|
|
|
12
|
$self->{_cv}->send(); |
49
|
|
|
|
|
|
|
} else { |
50
|
0
|
|
|
|
|
0
|
warn "Called mainloopExit but mainloop wasn't running"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub char_read { |
55
|
1
|
|
|
1
|
0
|
31
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
4
|
$self->Curses::UI::Common::char_read(0); ## Ignore timeout passed in to us, hard-code to 0 |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub tempdialog() { |
62
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
my $class = shift; |
64
|
0
|
|
|
|
|
|
my %args = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
0
|
0
|
|
|
my $cb = delete $args{-cb} || sub {}; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $id = "__window_$class"; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $dialog = $self->add($id, $class, %args); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->{_modalfocus_cv} = AE::cv; |
73
|
0
|
|
|
|
|
|
$self->{_modal_object} = $dialog; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# "Fake" focus for this object. |
76
|
0
|
|
|
|
|
|
$dialog->{-has_modal_focus} = 1; |
77
|
0
|
|
|
|
|
|
$dialog->focus; |
78
|
0
|
|
|
|
|
|
$dialog->draw; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$self->{_modalfocus_cv}->cb(sub { |
81
|
0
|
|
|
0
|
|
|
delete $self->{_modalfocus_cv}; |
82
|
0
|
|
|
|
|
|
delete $self->{_modal_object}; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
$dialog->{-focus} = 0; |
85
|
0
|
|
|
|
|
|
$dialog->{-has_modal_focus} = 0; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $return = $dialog->get; |
88
|
0
|
|
|
|
|
|
$self->delete($id); |
89
|
0
|
|
|
|
|
|
$self->root->focus(undef, 1); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$cb->($return); |
92
|
0
|
|
|
|
|
|
}); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |