diff options
-rw-r--r-- | src/key.c | 24 | ||||
-rw-r--r-- | src/key.h | 2 | ||||
-rw-r--r-- | src/menu.c | 12 |
3 files changed, 33 insertions, 5 deletions
@@ -485,6 +485,30 @@ ValidateKeys() } +/** Return true if arrow keys are defined. */ +int +HasArrowKeys() +{ + KeyNode *kp; + static int r = -1; + + if(r != -1) { + return r; + } + + for(kp = bindings; kp; kp = kp->next) { + if((kp->key & 0xFF) == KEY_UP + || (kp->key & 0xFF) == KEY_DOWN + || (kp->key & 0xFF) == KEY_RIGHT + || (kp->key & 0xFF) == KEY_LEFT) { + r = 1; + return 1; + } + } + r = 0; + return 0; +} + /** Return true if the key event matches any switching key or its modifiers. */ int Switching(const XKeyEvent *event) @@ -58,6 +58,8 @@ void ShowKeyMenu(const XKeyEvent *event); void ValidateKeys(); +int HasArrowKeys(); + int Switching(const XKeyEvent *event); #endif @@ -281,13 +281,15 @@ MenuLoop(Menu *menu) if(event.xbutton.button == Button5) { break; } - if(!hadMotion) { - break; - } - if(abs(event.xbutton.x_root - pressx) < doubleClickDelta) { - if(abs(event.xbutton.y_root - pressy) < doubleClickDelta) { + if(HasArrowKeys()) { + if(!hadMotion) { break; } + if(abs(event.xbutton.x_root - pressx) < doubleClickDelta) { + if(abs(event.xbutton.y_root - pressy) < doubleClickDelta) { + break; + } + } } if(menu->currentIndex >= 0) { |