Summary: Accept keypress in addition to left mouse to some of
the main functions of sdl2-client
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Wed 09 Jul 2014 01:29:02 AM EEST
                Category: client-sdl2
                Priority: 5 - Normal
                  Status: Ready For Test
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 2.6.0



It's quite surprising that the current code works on sdl-client, but as that
seems to be the case, I'm not changing it along the sdl2-client.
Problem with almost all the keys being unfunctional is that the action code
checks the original SDL event that lead to widget action callback firing (or
even to change its state to 'pressed'). They consistently check that "button
in question is SDL_BUTTON_LEFT". The "button in question" makes no sense at
all when the firing event is keypress. While in sdl-client button number seems
to be consistently SDL_BUTTON_LEFT for keypress events, that's not the case in
sdl2-client. So, in *many* places code:

if (Main.event.button.button == SDL_BUTTON_LEFT)

needs to be replaced with:

if (Main.event.type == SDL_KEYDOWN
    || (Main.event.type == SDL_MOUSEBUTTONDOWN
        && Main.event.button.button == SDL_BUTTON_LEFT))

Attached pacth is just the beginning (until full review of the sdl2-client
code), but it does handle the most important ones (unit actions, turn done) so
that one can play a bit with sdl2-client.


File Attachments:

Date: Wed 09 Jul 2014 01:29:02 AM EEST  Name: MainKeysFix.patch  Size: 8kB  
By: cazfi



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to