• Show log

    Commit

  • Hash : 059d9e46
    Author : Sam Lantinga
    Date : 2017-08-12T17:41:59

    Fixed bug 2950 - wrong axes values are set on joystick initialization
    
    Edward Rudd
    
    Device: Logitech Rumble Gamepad F510 in Xinput mode.
    
    Upon opening the joystick the values of the axes are queried via PollAllValues are not actually set on the device all the time.
    
    This can easily be seen in the testjoystick or testgamecontroller test programs,as the testjoystick shows all axes in the center until one 'tickles' the triggers., and the testgamecontroller will show the triggers as 'on' until on 'tickles' the triggers.
    
    Upon further research the culprit is the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint. In the default value events are ignored until there is an active window, Thus in cases where the joystick system is initialized and controllers opened before the initial window is created & focuses, the initial values will be incorrect.
    
    Here is my current workaround in the game I'm working on porting..
    
    SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
    SDL_GameController* gamepad = SDL_GameControllerOpen(index);
    SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "0");
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/SDL.git
    Git SSH git@git.kmx.io:kc3-lang/SDL.git
    Public access ? public
    Description

    Fork of https://github.com/libsdl-org/SDL

    Users
    thodg_m kc3_lang_org thodg_w www_kmx_io thodg thodg_l
    Tags