Revision: 679
http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=679&view=rev
Author: fredm
Date: 2011-11-19 11:19:30 +0000 (Sat, 19 Nov 2011)
Log Message:
-----------
Track multiple symbol and shift presses arising from mutiple extended keys being
pressed at once so that symbol and shift are only released when the last shifted
key is released (fixes bug #3435102, thanks, Simon Owen).
Modified Paths:
--------------
trunk/fuse/input.c
Modified: trunk/fuse/input.c
===================================================================
--- trunk/fuse/input.c 2011-11-05 05:34:36 UTC (rev 678)
+++ trunk/fuse/input.c 2011-11-19 11:19:30 UTC (rev 679)
@@ -61,6 +61,9 @@
}
+static int key_symbol_count = 0;
+static int key_caps_count = 0;
+
static int
keypress( const input_event_key_t *event )
{
@@ -101,6 +104,22 @@
ptr = keyboard_get_spectrum_keys( event->spectrum_key );
if( ptr ) {
+ if ( ptr->key1 == KEYBOARD_Symbol ) {
+ key_symbol_count++;
+ }
+
+ if ( ptr->key2 == KEYBOARD_Symbol ) {
+ key_symbol_count++;
+ }
+
+ if ( ptr->key1 == KEYBOARD_Caps ) {
+ key_caps_count++;
+ }
+
+ if ( ptr->key2 == KEYBOARD_Caps ) {
+ key_caps_count++;
+ }
+
keyboard_press( ptr->key1 );
keyboard_press( ptr->key2 );
}
@@ -110,6 +129,24 @@
return 0;
}
+static void
+keydorelease( const keyboard_key_name key )
+{
+ if ( key == KEYBOARD_Symbol ) {
+ key_symbol_count--;
+ if( key_symbol_count == 0 ) {
+ keyboard_release( key );
+ }
+ } else if ( key == KEYBOARD_Caps ) {
+ key_caps_count--;
+ if( key_caps_count == 0 ) {
+ keyboard_release( key );
+ }
+ } else {
+ keyboard_release( key );
+ }
+}
+
static int
keyrelease( const input_event_key_t *event )
{
@@ -118,8 +155,8 @@
ptr = keyboard_get_spectrum_keys( event->spectrum_key );
if( ptr ) {
- keyboard_release( ptr->key1 );
- keyboard_release( ptr->key2 );
+ keydorelease( ptr->key1 );
+ keydorelease( ptr->key2 );
}
/* Joystick emulation via keyboard keys */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|