[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#527942: Keys stop working when a key is pressed out of the displayed piano



Package: vkeybd
Version: 1:0.1.17b-2
Severity: important
Tags: patch

*** Please type your report below this line ***

If your keymap is designed for keys that are not displayed in the piano keyboard, pressing the corresponding keys of your computer keyboard will raise an error with the key note number. Moreover the same error keeps raising afterwards for any other key pressed because the unexpected key note number stays in the key stack. Error message looks like this:

----------------------------------------------------
can't read "keyitem(36)": no such element in array
can't read "keyitem(36)": no such element in array
    while executing
"$keywin itemconfigure $keyitem($key) -fill blue"
    (procedure "KeyStart" line 8)
    invoked from within
[…]
----------------------------------------------------

To get this message you may use the french layout on a 3 octaves piano:

$ vkeybd --keymap /usr/share/vkeybd/vkeybdmap-french

Then press the “!” key.

Using a “catch” instruction in both KeyStart and KeyStop procedures of the file “/usr/share/vkeybd/vkeybd.tcl” make it possible to avoid error raising whatever the key pressed and the piano octaves displayed. Here is the small patch:

--- /usr/share/vkeybd/vkeybd.tcl.orig    2009-05-08 22:09:03.000000000
+0200
+++ /usr/share/vkeybd/vkeybd.tcl    2009-05-08 22:21:58.000000000
+0200
@@ -170,10 +170,12 @@
 proc KeyStart {key button} {
     global keybase keywin keyitem keyvel activekey
     SeqOn
-    if {$button == 1} {
-    set activekey $keyitem($key)
+    catch {
+        if {$button == 1} {
+        set activekey $keyitem($key)
+        }
+        $keywin itemconfigure $keyitem($key) -fill blue
     }
-    $keywin itemconfigure $keyitem($key) -fill blue
     set key [expr $key + $keybase]
     SeqStartNote $key $keyvel
 }
@@ -181,11 +183,13 @@
 proc KeyStop {key button} {
     global keybase keywin keyitem keyindex keycolor activekey
     SeqOn
-    if {$button == 1 && $activekey != ""} {
-    set key $keyindex($activekey)
-    set activekey ""
+    catch {
+        if {$button == 1 && $activekey != ""} {
+        set key $keyindex($activekey)
+        set activekey ""
+        }
+        $keywin itemconfigure $keyitem($key) -fill $keycolor($key)
     }
-    $keywin itemconfigure $keyitem($key) -fill $keycolor($key)
     set key [expr $key + $keybase]
     SeqStopNote $key 0
 }

Regards,

JM. Philippe

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages vkeybd depends on:
ii  libasound2                    1.0.16-2   ALSA library
ii  libc6                         2.7-18     GNU C Library: Shared libraries
ii  libx11-6                      2:1.1.5-2  X11 client-side library
ii  tcl8.4                        8.4.19-2   Tcl (the Tool Command Language) v8
ii  tk8.4                         8.4.19-2   Tk toolkit for Tcl and X11, v8.4 -

vkeybd recommends no packages.

vkeybd suggests no packages.

-- no debconf information


Reply to: