ocarina: Find keypad numbers

I needed to strip out the "KP_" at the beginning.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-04-09 08:07:35 -04:00
parent 6f69392e5f
commit 4c33ba82ec
2 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,9 @@ gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
ocarina::Playlist *plist = (ocarina::Playlist *)data;
println("Treeview handling key press");
if (key.substr(0, 3) == "KP_")
key = key.substr(3);
if (key == "s" || key == "S")
new_playlist(plist, PLIST_SET);
else if (key == "q" || key == "Q")

View File

@ -99,6 +99,9 @@ static gboolean key_pressed_after(GtkWidget *widget, GdkEvent *event, gpointer d
string key = gdk_keyval_name(event->key.keyval);
println("Window handling key press (2): " + key);
if (key.substr(0, 3) == "KP_")
key = key.substr(3);
if (key >= "0" && key <= "9") {
unsigned int k;
stringstream s(key);