fix 0 again
[snom-frontend] / snom.pl
diff --git a/snom.pl b/snom.pl
index be082e5..d74e11b 100755 (executable)
--- 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.8 2006-05-21 13:09:23 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=0; $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,15 +294,38 @@ 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
 sub CloseAppWindow
 {
        $window->destroy;
        return TRUE;
 }
-
-
-# END EXAMPLE PROGRAM
Impressum, Datenschutz