File: keypad

package info (click to toggle)
libterm-slang-perl 0.07-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 100 kB
  • ctags: 39
  • sloc: perl: 614; makefile: 42
file content (37 lines) | stat: -rwxr-xr-x 648 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl -w

# This is a port of the keypad.c demo.
# $Id: keypad,v 1.4 2000/03/20 19:58:22 joey Rel $

use strict;
use ExtUtils::testlib;
use Term::Slang qw(:common :keys);

SLang_init_tty(-1,0,1);
SLsig_block_signals();
SLsig_unblock_signals();
SLkp_init();

my $timeout = 2;

print "This program illustrates the slkeypad facility.\n";
print "Press any key ('q' quits).\n";

while(SLang_input_pending(1000)) {

	my $ch = SLang_getkey();

	if ($ch == 033) {
		last if SLang_input_pending($timeout) == 0;
	}
   
	SLang_ungetkey($ch);
	$ch = SLkp_getkey;

	last if $ch == 113;
	printf "Keysym: %d\r\n", $ch;
}
   
SLang_reset_tty();

__END__