Ticket #3870: keyfix.patch

File keyfix.patch, 2.7 KB (added by Imarok, 8 years ago)

change SDL_HOTKEYDOWN to SDL_HOTKEYUP and move the text input part

  • binaries/data/mods/public/gui/credits/texts/programming.json

     
    8383            {"nick": "h20", "name": "Daniel Wilhelm"},
    8484            {"nick": "historic_bruno", "name": "Ben Brian"},
    8585            {"nick": "idanwin"},
     86            {"nick": "Imarok", "name": "J. S."},
    8687            {"nick": "infyquest", "name": "Vijay Kiran Kamuju"},
    8788            {"nick": "IronNerd", "name": "Matthew McMullan"},
    8889            {"nick": "Itms", "name": "Nicolas Auvray"},
  • source/gui/CGUI.cpp

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    6565{
    6666    InReaction ret = IN_PASS;
    6767
    68     if (ev->ev.type == SDL_HOTKEYDOWN)
     68    // Handle keys for input boxes
     69    if (GetFocusedObject())
    6970    {
     71        if (
     72            (ev->ev.type == SDL_KEYDOWN &&
     73            ev->ev.key.keysym.sym != SDLK_ESCAPE &&
     74            !g_keys[SDLK_LCTRL] && !g_keys[SDLK_RCTRL] &&
     75            !g_keys[SDLK_LALT] && !g_keys[SDLK_RALT])
     76            || ev->ev.type == SDL_HOTKEYDOWN
     77            || ev->ev.type == SDL_TEXTINPUT || ev->ev.type == SDL_TEXTEDITING
     78            )
     79        {
     80            ret = GetFocusedObject()->ManuallyHandleEvent(ev);
     81        }
     82        // else will return IN_PASS because we never used the button.
     83    }
     84
     85    else if (ev->ev.type == SDL_HOTKEYUP)
     86    {
    7087        const char* hotkey = static_cast<const char*>(ev->ev.user.data1);
    7188        std::map<CStr, std::vector<IGUIObject*> >::iterator it = m_HotkeyObjects.find(hotkey);
    7289        if (it != m_HotkeyObjects.end())
     
    243260        m_MousePos = oldMousePos;
    244261    }
    245262
    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     }
     263   
    262264
    263265    return ret;
    264266}