The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Key press blocks mouse motion event in windows
Avenger


Joined: 17 Jul 2014
Posts: 1
Hello.

I'm having an issue with the SDL_MOUSEMOTION event when running on Windows with SDL 2.0.3. The mouse motion event works great on its own, but if I hold a key down on the keyboard the mouse motion event is not sent.

This is my event handling loop, inside my render loop:
Code:

    while(!done) {
        while(SDL_PollEvent(&event)) {
            switch(event.type) {
            case SDL_WINDOWEVENT:
                if(event.window.event == SDL_WINDOWEVENT_CLOSE) {
                    done = true;
                }
                break;

            case SDL_KEYDOWN:
            case SDL_KEYUP:
                Logger::log("Key event");
                break;

            case SDL_MOUSEMOTION:
                Logger::log("mouse motion");
                break;

            case SDL_QUIT:
                done = true;
                break;
            }
        }

        render();
    }


On linux, this works great, I can see multiple mouse motion events while holding a key down, together with a repetition of the key event some times pr second.

In windows however, all I get is the key event if a key is down. I get mouse motion events up until I press a key, and after 1 second or so after the key is released, but in the middle of that I only get key events.

I can mention that I have enabled relative mouse motion with SDL_SetRelativeMouseMode(SDL_TRUE).

Does anyone know what's going on here?