]> git.zerfleddert.de Git - snom-frontend/commitdiff
P-Keys are F-Keys+ALT
authorsimigern <simigern>
Sun, 21 May 2006 13:07:24 +0000 (13:07 +0000)
committersimigern <simigern>
Sun, 21 May 2006 13:07:24 +0000 (13:07 +0000)
snom.pl

diff --git a/snom.pl b/snom.pl
index be082e51dee35b8c3848768d1b9714583ab3098c..43ea498e5cdccb75bf8be864a29c69a03213b68e 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.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
Impressum, Datenschutz