SFML community forums

Help => Window => Topic started by: eXpl0it3r on July 24, 2012, 03:14:17 am

Title: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once
Post by: eXpl0it3r on July 24, 2012, 03:14:17 am
On IRC DevilWithin just pointed out a bug in SFML with the Windows implementation.
If you're checking for the MouseMoved event and then press the ALT key, the MouseMoved event will not get triggered anymore until you either press any alpha-numberic, the ALT or the ESC key or you click somewhere.

The bug probably occurs because the ALT key normally gets directed to the menu which doesn't exist in SFML. Visually you can't see a difference but from the message queuing the Window somehow loses the 'focus'.

Here's a minimal complete example that will reproduce the problem:

#include <iostream>
#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 600), "MouseMoved Bug");

        while(window.isOpen())
        {
                sf::Event event;
                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::MouseMoved)
                                std::cout << event.mouseMove.x << "," << event.mouseMove.y << std::endl;
                }
 
                window.clear();
                window.display();
        }
}

On the console you'll see the mouse position received via the event. Now as soon as you press ALT the event won't get triggered and there will be no fruther updates on the console.

I'm not quite sure if this is really related or if the bug is triggered through something completly diffrent, but here's a link (http://stackoverflow.com/questions/9627379/how-to-disable-normal-behaviour-of-alt-key) to a code example that shows how to disable the ALT key interaction with window menu.
Title: Re: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once
Post by: Laurent on July 24, 2012, 08:00:53 am
I can't believe that you posted in the wrong forum, and didn't search before posting.
http://en.sfml-dev.org/forums/index.php?topic=2910.0
http://en.sfml-dev.org/forums/index.php?topic=817.0
:'(

So yes, it's a known issue and I know what code to add if I want to get rid of it.
Title: Re: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once
Post by: eXpl0it3r on July 24, 2012, 11:00:05 am
Well it was late... ;D

Addotionally there's no issue on the tracker and since this is a bug report it doesn't seem logical to post it in the 'Help' section.
Please post in one of the "help" forums if you ask for help
I didn't need help, but I want it to be fixed. So how should one know that bug reports are help requests in your mind? ;)

Next time I'm gonna directly open an issue on the track, oh wait you don't like that either. ;D

So yes, it's a known issue and I know what code to add if I want to get rid of it.
And why haven't you done so already? ::) :P
Shall I still open a ticket, so people will find the bug on the tracker where it belongs to?
Title: Re: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once
Post by: edumoette on July 24, 2012, 08:47:04 pm
Oh my...im sensing some hostility here....  :-X >__<
Title: Re: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once
Post by: eXpl0it3r on July 25, 2012, 02:09:52 pm
Although you probably don't care much, I've created an issue on the tracker: #261 (https://github.com/SFML/SFML/issues/261) :D
Title: Re: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once
Post by: Laurent on July 25, 2012, 11:01:11 pm
Quote
I didn't need help, but I want it to be fixed. So how should one know that bug reports are help requests in your mind?
Before being a bug report it must be a help request. In 99% of cases the problem is in user code, not in SFML. And for you and the 1 other percent, there's the bug tracker. I only complain if the first 99% post there, not the remaining 1% :P

This issue is not fixed because I must first be sure that ignoring OS keys won't break anything :)