… | |
… | |
16 | |
16 | |
17 | if ($row == $self->{hover}) { |
17 | if ($row == $self->{hover}) { |
18 | $rend = $self->{press} ? "\x1b[m" : "\x1b[30;46m"; |
18 | $rend = $self->{press} ? "\x1b[m" : "\x1b[30;46m"; |
19 | } |
19 | } |
20 | |
20 | |
21 | $cmd .= "$rend\x1b[K" . $self->locale_encode ($item->{text}) . "\015\012"; |
21 | $cmd .= "$rend\x1b[K"; |
|
|
22 | $cmd .= $self->locale_encode ($item->{render}->($item)); |
|
|
23 | $cmd .= "\015\012"; |
22 | |
24 | |
23 | $row++; |
25 | $row++; |
24 | } |
26 | } |
25 | |
27 | |
26 | $self->cmd_parse (substr $cmd, 0, -2); |
28 | $self->cmd_parse (substr $cmd, 0, -2); |
… | |
… | |
53 | if ($event->{button} == $self->{data}{event}{button}) { |
55 | if ($event->{button} == $self->{data}{event}{button}) { |
54 | $self->ungrab; |
56 | $self->ungrab; |
55 | $self->destroy; |
57 | $self->destroy; |
56 | } |
58 | } |
57 | |
59 | |
|
|
60 | $self->{press}[$event->{button}] = 0; |
|
|
61 | |
58 | if ($event->{button} == 1) { |
62 | if ($event->{button} == 1) { |
59 | $self->{press}[$event->{button}] = 0; |
|
|
60 | refresh $self; |
63 | refresh $self; |
61 | |
64 | |
62 | warn "$event->{row} $event->{col}\n";#d# |
65 | warn "$event->{row} $event->{col}\n";#d# |
63 | |
66 | |
64 | if ($col >= 0 && $col < $self->ncol |
67 | if ($col >= 0 && $col < $self->ncol |
… | |
… | |
111 | sub on_start { |
114 | sub on_start { |
112 | my ($self) = @_; |
115 | my ($self) = @_; |
113 | |
116 | |
114 | # might fail, but try anyways |
117 | # might fail, but try anyways |
115 | $self->grab ($self->{data}{event}{time}, 1) |
118 | $self->grab ($self->{data}{event}{time}, 1) |
116 | and $self->allow_events_sync; |
119 | and $self->allow_events_async; |
117 | |
120 | |
118 | on_button_press $self, $self->{data}{event} if $self->{data}{event}{button}; |
121 | on_button_press $self, $self->{data}{event} if $self->{data}{event}{button}; |
119 | |
122 | |
120 | $self->cmd_parse ("\x1b[?25l\x1b[?7l"); |
123 | $self->cmd_parse ("\x1b[?25l\x1b[?7l"); |
121 | refresh $self; |
124 | refresh $self; |
… | |
… | |
126 | sub on_map_notify { |
129 | sub on_map_notify { |
127 | my ($self, $event) = @_; |
130 | my ($self, $event) = @_; |
128 | |
131 | |
129 | # should definitely not fail |
132 | # should definitely not fail |
130 | $self->grab ($self->{data}{event}{time}, 1) |
133 | $self->grab ($self->{data}{event}{time}, 1) |
131 | and $self->allow_events_sync; |
134 | and $self->allow_events_async; |
132 | } |
|
|
133 | |
|
|
134 | sub on_destroy { |
|
|
135 | } |
135 | } |
136 | |
136 | |
137 | |
137 | |
138 | |
138 | |
139 | |
139 | |
140 | |
140 | |
|
|
141 | |