Debian Codegraph @

demo/keypad

raw
1 #!/usr/bin/perl -w
2
3 # This is a port of the keypad.c demo.
4 # $Id: keypad,v 1.2 1999/09/01 18:04:46 daniel Exp $
5
6 use strict;
7 use ExtUtils::testlib;
8 use Term::Slang qw(:common :keys);
9
10 SLang_init_tty(-1,0,1);
11 SLsig_block_signals();
12 SLsig_unblock_signals();
13 SLkp_init();
14
15 my $timeout = 2;
16
17 print "This program illustrates the slkeypad facility.\n";
18 print "Press any key ('q' quits).\n";
19
20 while(SLang_input_pending(1000)) {
21
22 my $ch = SLang_getkey();
23
24 if ($ch == 033) {
25 last if SLang_input_pending($timeout) == 0;
26 }
27
28 SLang_ungetkey($ch);
29 $ch = SLkp_getkey;
30
31 last if $ch == 113;
32 printf "Keysym: %d\r\n", $ch;
33 }
34
35 SLang_reset_tty();
36
37 __END__