[AD] Keyboard patch: make the callback be called

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


This patch will make keyboard_callback be called by EVERY key press (isn't that the intention ?) On keys that used not to make it call, the ascii code is 0, and the scan code is sent in the upper 8-bit (scancode << 8...hope it's correct).
You can now detect keys like Alt, etc.
I've tried it will all of the examples, and keyconf, and they work alright. I don't think it would break anything though.
Tell me what you think guys !

Apply this patch over src/keyboard.c

--- keyboard.c	Mon Nov 22 02:31:34 1999
+++ keyboard.c	Sun Nov 28 11:10:08 1999
@@ -368,6 +368,11 @@
 
       if (keycode >= 0)
 	 add_key(&key_buffer, keycode, scancode);
+      else if (keyboard_callback) {
+           int c;
+           c = scancode << 8;
+           keyboard_callback(c);
+      }
 
       update_shifts();
    }
@@ -382,6 +387,11 @@
 
       if (keycode >= 0)
 	 add_key(&_key_buffer, keycode, scancode);
+      else if (keyboard_callback) {
+           int c;
+           c = scancode << 8;
+           keyboard_callback(c);
+      }
    }
 
    /* autorepeat? */

 - GodOfWar

There is always one more bug.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/