From bd87a620c3ed5d93d91aecb24e440e7dc5ad4864 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 27 Mar 2010 23:50:07 +0000 Subject: [PATCH] Fix issue 333: Text window which never closes when opened by 'T' git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1425 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/Makefile | 2 +- src/input.c | 16 ++++++++-------- src/input.h | 2 +- src/keyboard.c | 40 ++++++++++++++++++++-------------------- src/keyboard.h | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Makefile b/src/Makefile index 71a7e08e..56ab985a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -377,7 +377,7 @@ testsed : $(BIN) : $(OBJ) test -d ../bin || $(MKDIR) ../bin - $(CC) $(OBJ) -o $(BIN) $(LOPT) $(LFLAGS) + $(CC) $(OBJ) -o $(BIN) $(COPT) $(LOPT) $(LFLAGS) # SVN revision number version.c : diff --git a/src/input.c b/src/input.c index 20ae1bc1..f9875245 100644 --- a/src/input.c +++ b/src/input.c @@ -86,30 +86,30 @@ short Joybutton_left_click=0; // Button number that serves as left click short Joybutton_right_click=0; // Button number that serves as right-click #endif -int Is_shortcut(word Key, word function) +int Is_shortcut(word key, word function) { - if (Key == 0 || function == 0xFFFF) + if (key == 0 || function == 0xFFFF) return 0; if (function & 0x100) { - if (Buttons_Pool[function&0xFF].Left_shortcut[0]==Key) + if (Buttons_Pool[function&0xFF].Left_shortcut[0]==key) return 1; - if (Buttons_Pool[function&0xFF].Left_shortcut[1]==Key) + if (Buttons_Pool[function&0xFF].Left_shortcut[1]==key) return 1; return 0; } if (function & 0x200) { - if (Buttons_Pool[function&0xFF].Right_shortcut[0]==Key) + if (Buttons_Pool[function&0xFF].Right_shortcut[0]==key) return 1; - if (Buttons_Pool[function&0xFF].Right_shortcut[1]==Key) + if (Buttons_Pool[function&0xFF].Right_shortcut[1]==key) return 1; return 0; } - if(Key == Config_Key[function][0]) + if(key == Config_Key[function][0]) return 1; - if(Key == Config_Key[function][1]) + if(key == Config_Key[function][1]) return 1; return 0; } diff --git a/src/input.h b/src/input.h index e4564942..dee65dd7 100644 --- a/src/input.h +++ b/src/input.h @@ -36,7 +36,7 @@ int Get_input(void); /// Returns true if the keycode has been set as a keyboard shortcut for the function. -int Is_shortcut(word Key, word function); +int Is_shortcut(word key, word function); /// Adjust mouse sensitivity (and actual mouse input mode) void Adjust_mouse_sensitivity(word fullscreen); diff --git a/src/keyboard.c b/src/keyboard.c index db96567c..01071125 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -358,7 +358,7 @@ word Keysym_to_keycode(SDL_keysym keysym) return key_code; } -const char * Key_name(word Key) +const char * Key_name(word key) { typedef struct { @@ -447,30 +447,30 @@ const char * Key_name(word Key) static char buffer[41]; buffer[0] = '\0'; - if (Key == SDLK_UNKNOWN) + if (key == SDLK_UNKNOWN) return "None"; - if (Key & MOD_CTRL) + if (key & MOD_CTRL) strcat(buffer, "Ctrl+"); - if (Key & MOD_ALT) + if (key & MOD_ALT) strcat(buffer, "Alt+"); - if (Key & MOD_SHIFT) + if (key & MOD_SHIFT) strcat(buffer, "Shift+"); - if (Key & MOD_META) + if (key & MOD_META) strcat(buffer, "\201"); // Note: Apple's "command" character is not present in the ANSI table, so we // recycled an ANSI value that doesn't have any displayable character // associated. - Key=Key & ~(MOD_CTRL|MOD_ALT|MOD_SHIFT); + key=key & ~(MOD_CTRL|MOD_ALT|MOD_SHIFT); - if (Key>=KEY_JOYBUTTON && Key<=KEY_JOYBUTTON+18) + if (key>=KEY_JOYBUTTON && key<=KEY_JOYBUTTON+18) { #ifdef __GP2X__ char *button_name; - switch(Key-KEY_JOYBUTTON) + switch(key-KEY_JOYBUTTON) { case GP2X_BUTTON_UP: button_name="[UP]"; break; case GP2X_BUTTON_DOWN: button_name="[DOWN]"; break; @@ -491,45 +491,45 @@ const char * Key_name(word Key) case GP2X_BUTTON_SELECT: button_name="[SELECT]"; break; case GP2X_BUTTON_VOLUP: button_name="[VOL UP]"; break; case GP2X_BUTTON_VOLDOWN: button_name="[VOL DOWN]"; break; - default: sprintf(buffer+strlen(buffer), "[B%d]", Key);return buffer; + default: sprintf(buffer+strlen(buffer), "[B%d]", key);return buffer; } strcat(buffer,button_name); #else - sprintf(buffer+strlen(buffer), "[B%d]", Key-KEY_JOYBUTTON); + sprintf(buffer+strlen(buffer), "[B%d]", key-KEY_JOYBUTTON); #endif return buffer; } - if (Key & 0x800) + if (key & 0x800) { - sprintf(buffer+strlen(buffer), "[%d]", Key & 0x7FF); + sprintf(buffer+strlen(buffer), "[%d]", key & 0x7FF); return buffer; } - Key = Key & 0x7FF; + key = key & 0x7FF; // Touches ASCII - if (Key>=' ' && Key < 127) + if (key>=' ' && key < 127) { - sprintf(buffer+strlen(buffer), "'%c'", toupper(Key)); + sprintf(buffer+strlen(buffer), "'%c'", toupper(key)); return buffer; } // Touches 'World' - if (Key>=SDLK_WORLD_0 && Key <= SDLK_WORLD_95) + if (key>=SDLK_WORLD_0 && key <= SDLK_WORLD_95) { - sprintf(buffer+strlen(buffer), "w%d", Key - SDLK_WORLD_0); + sprintf(buffer+strlen(buffer), "w%d", key - SDLK_WORLD_0); return buffer; } // Touches au libellé connu for (index=0; index < (long)sizeof(key_labels)/(long)sizeof(T_key_label);index++) { - if (Key == key_labels[index].keysym) + if (key == key_labels[index].keysym) { sprintf(buffer+strlen(buffer), "%s", key_labels[index].Key_name); return buffer; } } // Autres touches inconnues - sprintf(buffer+strlen(buffer), "0x%X", Key & 0x7FF); + sprintf(buffer+strlen(buffer), "0x%X", key & 0x7FF); return buffer; } diff --git a/src/keyboard.h b/src/keyboard.h index 08787c0e..c2dec3f5 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -66,7 +66,7 @@ word Key_for_scancode(word scancode); Returns key name in a string. Used to display them in the helpscreens and in the keymapper window. @param Key keycode of the key to translate, including modifiers */ -const char * Key_name(word Key); +const char * Key_name(word key); /*! Gets the modifiers in our format from the SDL_Mod information.