traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src/core InputEngine.cpp InputEngine.h


From: Ben Levitt
Subject: [Traverso-commit] traverso/src/core InputEngine.cpp InputEngine.h
Date: Sun, 03 Jun 2007 20:32:45 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Ben Levitt <benjie>     07/06/03 20:32:45

Modified files:
        src/core       : InputEngine.cpp InputEngine.h 

Log message:
        allow FKEY commands for happen instantly if there are no other commands 
that use that key, eg SPACE, M, F5, etc

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.cpp?cvsroot=traverso&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.h?cvsroot=traverso&r1=1.24&r2=1.25

Patches:
Index: InputEngine.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- InputEngine.cpp     3 Jun 2007 12:59:35 -0000       1.57
+++ InputEngine.cpp     3 Jun 2007 20:32:45 -0000       1.58
@@ -654,6 +654,15 @@
        }
        
        if (isFirstFact) {
+               // Here we jump straight to the <K> command if "K" is 
unambiguously an FKEY
+               int fkey_index = find_index_for_instant_fkey(eventcode);
+               if (fkey_index >= 0) {
+                       IEAction* action = m_ieActions.at(fkey_index);
+                       broadcast_action(action, isAutoRepeat);
+                       return;
+               }
+               
+               // Else, tell the cpointer that an event is starting
                cpointer().inputengine_first_input_event();
        }
        
@@ -944,6 +953,29 @@
 }
 
 
+// Only return a valid index if there is an FKEY defined for key, and there 
are no
+// other conflicting keyfacts (HOLDKEY, FKEY2, etc)
+int InputEngine::find_index_for_instant_fkey( int key )
+{
+       int fkey_index = find_index_for_single_fact(FKEY, key, 0);
+       if (fkey_index < 0) {
+               return -1;
+       }
+
+       foreach(IEAction* action, m_ieActions) {
+                       
+               if (action->type == FKEY)
+                       continue;
+               if (action->fact1_key1==key || action->fact1_key2==key) {
+                       PMESG3("Found a conflict (%s) for instantaneous keyfact 
key=%d", action->keySequence.data(), key);
+                       return -1;
+               }
+       }
+
+       return fkey_index;
+}
+
+
 int InputEngine::find_index_for_single_fact( int type, int key1, int key2 )
 {
        foreach(IEAction* action, m_ieActions) {

Index: InputEngine.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- InputEngine.h       7 May 2007 18:15:30 -0000       1.24
+++ InputEngine.h       3 Jun 2007 20:32:45 -0000       1.25
@@ -240,6 +240,7 @@
        void reset();
        void process_press_event(int eventcode, bool isAutoRepeat=false);
         void process_release_event(int eventcode);
+       int find_index_for_instant_fkey( int key );
         int find_index_for_single_fact(int type, int key1, int key2);
        bool is_modifier_keyfact(int eventcode);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]