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: Fri, 08 Jun 2007 18:37:43 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Ben Levitt <benjie>     07/06/08 18:37:43

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

Log message:
        make FKEY2 commands work immediately if there are no conflicting 
commands that we need to wait for

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.cpp?cvsroot=traverso&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.h?cvsroot=traverso&r1=1.26&r2=1.27

Patches:
Index: InputEngine.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- InputEngine.cpp     4 Jun 2007 17:09:40 -0000       1.62
+++ InputEngine.cpp     8 Jun 2007 18:37:42 -0000       1.63
@@ -660,7 +660,7 @@
        
        if (isFirstFact && !isHolding) {
                cpointer().inputengine_first_input_event();
-               
+               if (eventStack[0] == 0) {
                // 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) {
@@ -668,6 +668,17 @@
                        broadcast_action(action, isAutoRepeat);
                        return;
                }
+               } else {
+                       // Here we jump straight to the <KL> command if "KL" is 
unambiguously an FKEY2
+                       int fkey2_index = 
find_index_for_instant_fkey2(eventcode, eventStack[0]);
+                       if (fkey2_index >= 0) {
+                               printf("instant fkey2!\n");
+                               IEAction* action = m_ieActions.at(fkey2_index);
+                               broadcast_action(action, isAutoRepeat);
+                               reset();
+                               return;
+                       }
+               }
        }
        
        if (isHolding) {
@@ -980,6 +991,30 @@
 }
 
 
+// Only return a valid index if there is an FKEY2 defined for key1, key2, and 
there are no
+// other conflicting keyfacts (HOLDKEY2, etc)
+int InputEngine::find_index_for_instant_fkey2( int key1, int key2 )
+{
+       printf("fkey2 ??  %d, %d\n", key1, key2);
+       int fkey2_index = find_index_for_single_fact(FKEY2, key1, key2);
+       if (fkey2_index < 0) {
+               return -1;
+       }
+
+       foreach(IEAction* action, m_ieActions) {
+                       
+               if (action->type == D_FKEY2 || action->type == HKEY2) {
+                       if ( (action->fact1_key1==key1 && 
action->fact1_key2==key2) ||
+                       (action->fact1_key1==key2 && action->fact1_key2==key1) 
) {
+                               PMESG3("Found a conflict (%s) for instantaneous 
keyfact keys=%d,%d", action->keySequence.data(), key1, key2);
+                               return -1;
+                       }
+               }
+       }
+       return fkey2_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.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- InputEngine.h       4 Jun 2007 17:09:40 -0000       1.26
+++ InputEngine.h       8 Jun 2007 18:37:42 -0000       1.27
@@ -240,6 +240,7 @@
        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_instant_fkey2( int key1, int key2 );
         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]