From 158cd7ff45442fb9cb58e916cdadd5a1a8fc368e Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Thu, 2 Jul 2009 22:09:57 +0000 Subject: [PATCH] Fixed an old (pre v2.0) control bug where releasing shift key had the extra effect of releasing the left mouse button. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@896 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- input.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/input.c b/input.c index 8fcf8a4d..f3130336 100644 --- a/input.c +++ b/input.c @@ -39,6 +39,8 @@ byte Directional_down; byte Directional_down_left; byte Directional_left; byte Directional_up_left; +byte Directional_click; + long Directional_delay; long Directional_last_move; long Directional_step; @@ -330,11 +332,13 @@ int Handle_key_press(SDL_KeyboardEvent event) else if(Is_shortcut(Key,SPECIAL_CLICK_LEFT)) { Input_new_mouse_K=1; + Directional_click=1; return Move_cursor_with_constraints(); } else if(Is_shortcut(Key,SPECIAL_CLICK_RIGHT)) { Input_new_mouse_K=2; + Directional_click=2; return Move_cursor_with_constraints(); } @@ -368,14 +372,22 @@ int Release_control(int key_code, int modifier) if((key_code && key_code == (Config_Key[SPECIAL_CLICK_LEFT][0]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_LEFT][0]&modifier) || (key_code && key_code == (Config_Key[SPECIAL_CLICK_LEFT][1]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_LEFT][1]&modifier)) { - Input_new_mouse_K &= ~1; - return Move_cursor_with_constraints(); + if (Directional_click & 1) + { + Directional_click &= ~1; + Input_new_mouse_K &= ~1; + return Move_cursor_with_constraints(); + } } if((key_code && key_code == (Config_Key[SPECIAL_CLICK_RIGHT][0]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_RIGHT][0]&modifier) || (key_code && key_code == (Config_Key[SPECIAL_CLICK_RIGHT][1]&0x0FFF)) || (Config_Key[SPECIAL_CLICK_RIGHT][1]&modifier)) { - Input_new_mouse_K &= ~2; - return Move_cursor_with_constraints(); + if (Directional_click & 2) + { + Directional_click &= ~2; + Input_new_mouse_K &= ~2; + return Move_cursor_with_constraints(); + } } // Other keys don't need to be released : they are handled as "events" and procesed only once.