ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/option-popup
Revision: 1.10
Committed: Mon Feb 6 06:14:08 2006 UTC (18 years, 3 months ago) by root
Branch: MAIN
CVS Tags: rel-7_6, rel-7_8, rel-7_9, rel-7_7
Changes since 1.9: +8 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl
2
3 sub on_start {
4 my ($self) = @_;
5
6 $self->grab_button (2, urxvt::ControlMask);
7
8 ()
9 }
10
11 sub on_button_press {
12 my ($self, $event) = @_;
13
14 if ($event->{button} == 2 && $event->{state} & urxvt::ControlMask) {
15 my $popup = $self->popup ($event)
16 or return 1;
17
18 $popup->add_title ("Options");
19 $popup->add_separator;
20
21 my %unsafe = map +($_ => 1),
22 qw(borderLess console iconic loginShell reverseVideo
23 scrollBar scrollBar_floating scrollBar_right
24 secondaryScreen transparent utmpInhibit meta8
25 override_redirect);
26
27 for my $name (sort keys %urxvt::OPTION) {
28 next if $unsafe{$name};
29
30 my $optval = $urxvt::OPTION{$name};
31
32 $popup->add_toggle ($name => $self->option ($optval),
33 sub { $self->option ($optval, $_[0]) });
34 }
35
36 for my $hook (@{ $self->{term}{option_popup_hook} || [] }) {
37 if (my ($name, $value, $cb) = $hook->($popup)) {
38 $popup->add_toggle ($name => $value, sub { $cb->($_[0]) });
39 }
40 }
41
42 $popup->show;
43
44 return 1;
45 }
46
47 ()
48 }
49