5 |
## $Id$ |
## $Id$ |
6 |
## |
## |
7 |
## $Log$ |
## $Log$ |
8 |
|
## Revision 1.5 2002/06/15 05:19:36 cvsjoko |
9 |
|
## + modified order/way of key-handling-logic |
10 |
|
## |
11 |
|
## Revision 1.4 2002/06/15 04:28:10 cvsjoko |
12 |
|
## immediate polling, no delay |
13 |
|
## |
14 |
## Revision 1.3 2002/06/15 04:24:15 cvsjoko |
## Revision 1.3 2002/06/15 04:24:15 cvsjoko |
15 |
## + added modifier for running in linux or win32 |
## + added modifier for running in linux or win32 |
16 |
## + modified order of some commands in core key-polling |
## + modified order of some commands in core key-polling |
197 |
} |
} |
198 |
|
|
199 |
my $key = ReadKey(-1); |
my $key = ReadKey(-1); |
200 |
if ($key) { |
if ( defined $key ) { |
201 |
|
|
|
# normal key? |
|
|
if ($key =~ m/[a-zA-Z? ]/) { |
|
|
$heap->{state}{InputBuffer} .= $key; |
|
|
#print $key; |
|
|
} |
|
|
|
|
202 |
# enter pressed? |
# enter pressed? |
203 |
if ($key eq $self->{conf}{EnterKey}) { |
if ($key eq $self->{conf}{EnterKey}) { |
204 |
# send command |
# send command |
219 |
} |
} |
220 |
|
|
221 |
# backspace pressed? |
# backspace pressed? |
222 |
if (ord($key) == 8) { |
elsif (ord($key) == 8) { |
223 |
$heap->{state}{InputBuffer} = substr($heap->{state}{InputBuffer}, 0, -1); |
$heap->{state}{InputBuffer} = substr($heap->{state}{InputBuffer}, 0, -1); |
224 |
} |
} |
225 |
|
|
226 |
|
# normal key? |
227 |
|
#elsif ($key =~ m/[a-zA-Z? ]/) { |
228 |
|
else { |
229 |
|
$heap->{state}{InputBuffer} .= $key; |
230 |
|
#print $key; |
231 |
|
} |
232 |
|
|
233 |
# mark "KeyPressed" for next poll |
# mark "KeyPressed" for next poll |
234 |
$heap->{state}{KeyPressed} = 1; |
$heap->{state}{KeyPressed} = 1; |
235 |
|
|
236 |
} |
} |
237 |
|
|
238 |
#$kernel->post($session, "pollForKey"); |
$kernel->post($session, "pollForKey"); |
239 |
#$kernel->delay("pollForKey", 0.1); |
#$kernel->delay("pollForKey", 0.1); |
240 |
$kernel->delay("pollForKey", 0.01); |
#$kernel->delay("pollForKey", 0.01); |
241 |
|
|
242 |
} |
} |
243 |
|
|