Ticket #3870: keyfixv2.patch
File keyfixv2.patch, 3.5 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/credits/texts/programming.json
83 83 {"nick": "h20", "name": "Daniel Wilhelm"}, 84 84 {"nick": "historic_bruno", "name": "Ben Brian"}, 85 85 {"nick": "idanwin"}, 86 {"nick": "Imarok", "name": "J. S."}, 86 87 {"nick": "infyquest", "name": "Vijay Kiran Kamuju"}, 87 88 {"nick": "IronNerd", "name": "Matthew McMullan"}, 88 89 {"nick": "Itms", "name": "Nicolas Auvray"}, -
source/gui/CGUI.cpp
65 65 { 66 66 InReaction ret = IN_PASS; 67 67 68 if (ev->ev.type == SDL_HOTKEYDOWN) 68 // Handle keys for input boxes 69 if ( GetFocusedObject() && 70 ((ev->ev.type == SDL_KEYDOWN && 71 ev->ev.key.keysym.sym != SDLK_ESCAPE && 72 !g_keys[SDLK_LCTRL] && !g_keys[SDLK_RCTRL] && 73 !g_keys[SDLK_LALT] && !g_keys[SDLK_RALT]) || 74 ev->ev.type == SDL_HOTKEYDOWN || 75 ev->ev.type == SDL_TEXTINPUT || 76 ev->ev.type == SDL_TEXTEDITING) ) 69 77 { 78 ret = GetFocusedObject()->ManuallyHandleEvent(ev); 79 } 80 81 else if (ev->ev.type == SDL_HOTKEYUP) 82 { 70 83 const char* hotkey = static_cast<const char*>(ev->ev.user.data1); 71 84 std::map<CStr, std::vector<IGUIObject*> >::iterator it = m_HotkeyObjects.find(hotkey); 72 85 if (it != m_HotkeyObjects.end()) … … 243 256 m_MousePos = oldMousePos; 244 257 } 245 258 246 // Handle keys for input boxes 247 if (GetFocusedObject()) 248 { 249 if ( 250 (ev->ev.type == SDL_KEYDOWN && 251 ev->ev.key.keysym.sym != SDLK_ESCAPE && 252 !g_keys[SDLK_LCTRL] && !g_keys[SDLK_RCTRL] && 253 !g_keys[SDLK_LALT] && !g_keys[SDLK_RALT]) 254 || ev->ev.type == SDL_HOTKEYDOWN 255 || ev->ev.type == SDL_TEXTINPUT || ev->ev.type == SDL_TEXTEDITING 256 ) 257 { 258 ret = GetFocusedObject()->ManuallyHandleEvent(ev); 259 } 260 // else will return IN_PASS because we never used the button. 261 } 262 259 // else will return IN_PASS because we never used the button. 263 260 return ret; 264 261 } 265 262 -
source/gui/CInput.cpp
95 95 { 96 96 ENSURE(m_iBufferPos != -1); 97 97 98 if (ev->ev.type == SDL_HOTKEY DOWN)98 if (ev->ev.type == SDL_HOTKEYUP) 99 99 { 100 100 if (m_ComposingText) 101 101 return IN_HANDLED; … … 181 181 182 182 return IN_HANDLED; 183 183 } 184 else if (ev->ev.type == SDL_KEYUP) 185 { 186 if (ev->ev.key.keysym.sym == SDLK_KP_ENTER || ev->ev.key.keysym.sym == SDLK_RETURN) 187 // 'Return' should do a Press event for single liners (e.g. submitting forms) 188 // otherwise a '\n' character will be added. 189 { 190 bool multiline; 191 GUI<bool>::GetSetting(this, "multiline", multiline); 192 if (!multiline) 193 { 194 SendEvent(GUIM_PRESSED, "press"); 195 UpdateBufferPositionSetting(); 196 return IN_HANDLED; 197 } 198 199 } 200 } 184 201 else if (ev->ev.type == SDL_KEYDOWN) 185 202 { 186 203 if (m_ComposingText) … … 474 491 { 475 492 bool multiline; 476 493 GUI<bool>::GetSetting(this, "multiline", multiline); 477 if ( !multiline)494 if (multiline) 478 495 { 479 SendEvent(GUIM_PRESSED, "press"); 480 break; 496 cooked = '\n'; // Change to '\n' and do default: 481 497 } 482 498 483 cooked = '\n'; // Change to '\n' and do default:499 484 500 // NOTE: Fall-through 485 501 } 486 502 default: // Insert a character