From: simigern Date: Sun, 21 May 2006 13:07:24 +0000 (+0000) Subject: P-Keys are F-Keys+ALT X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/snom-frontend/commitdiff_plain/190de48acc3e09cba1d39042031fb7c7318687c7?hp=824f34a515b11406e826ffa05754610e9df94da3 P-Keys are F-Keys+ALT --- diff --git a/snom.pl b/snom.pl index be082e5..43ea498 100755 --- a/snom.pl +++ b/snom.pl @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: snom.pl,v 1.5 2006-05-21 12:42:40 simigern Exp $ +#$Id: snom.pl,v 1.6 2006-05-21 13:07:24 simigern Exp $ PATH=/opt/csw/bin:/opt/local/bin:/usr/bin:/bin exec perl -w -x "$0" "$@" @@ -272,20 +272,17 @@ sub KBDInput my ($widget, $event) = @_; my $keyval = $event->keyval; - foreach my $i (1, 2, 3, 4, 5, 6, 7, 8, 9, 0) { - if ($keyval == $Gtk2::Gdk::Keysyms{$i} || $keyval == $Gtk2::Gdk::Keysyms{"KP_${i}"}) { - snom_key($i); - return TRUE; - } - } - foreach my $i ('F1', 'F2', 'F3', 'F4') { - if ($keyval == $Gtk2::Gdk::Keysyms{$i}) { + for (my $i=1; $i<10; $i++) { + if ($keyval == $Gtk2::Gdk::Keysyms{$i} || $keyval == $Gtk2::Gdk::Keysyms{"KP_${i}"}) { snom_key($i); return TRUE; } } + if ($keyval == $Gtk2::Gdk::Keysyms{asterisk}) {snom_key('*'); return TRUE;} + if ($keyval == $Gtk2::Gdk::Keysyms{KP_Multiply}) {snom_key('*'); return TRUE;} + if ($keyval == $Gtk2::Gdk::Keysyms{numbersign}) {snom_key('#'); return TRUE;} if ($keyval == $Gtk2::Gdk::Keysyms{Return}) {snom_key("ENTER"); return TRUE;} if ($keyval == $Gtk2::Gdk::Keysyms{KP_Enter}) {snom_key("ENTER"); return TRUE;} if ($keyval == $Gtk2::Gdk::Keysyms{Escape}) {snom_key("CANCEL"); return TRUE;} @@ -297,7 +294,34 @@ sub KBDInput if ($keyval == $Gtk2::Gdk::Keysyms{KP_Up}) {snom_key("UP"); return TRUE;} if ($keyval == $Gtk2::Gdk::Keysyms{Down}) {snom_key("DOWN"); return TRUE;} if ($keyval == $Gtk2::Gdk::Keysyms{KP_Down}) {snom_key("DOWN"); return TRUE;} - return TRUE; + + if (!$event->state) { + for (my $i=1; $i<5; $i++) { + if ($keyval == $Gtk2::Gdk::Keysyms{"F${i}"}) { + snom_key("F${i}"); + return TRUE; + } + } + } else { + if ($event->state eq 'mod1-mask') { + for (my $i=1; $i<13; $i++) { + if ($keyval == $Gtk2::Gdk::Keysyms{"F${i}"}) { + snom_key("P${i}"); + return TRUE; + } + } + } + } + + print "Unhandled: Modifier: ".$event->state.", Key: "; + foreach my $key (keys(%Gtk2::Gdk::Keysyms)) { + if ($keyval == $Gtk2::Gdk::Keysyms{$key}) { + print "${key}\n"; + return TRUE; + } + } + print "ERR\n"; + return FALSE; } ### Callback function to close the window