Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Bug] MouseMoved event doesn't get triggered if the ALT key was pressed once  (Read 5130 times)

0 Members and 1 Guest are viewing this topic.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
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 to a code example that shows how to disable the ALT key interaction with window menu.
« Last Edit: July 24, 2012, 03:20:39 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
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.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
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?
« Last Edit: July 24, 2012, 08:54:37 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

edumoette

  • Newbie
  • *
  • Posts: 23
    • View Profile
Oh my...im sensing some hostility here....  :-X >__<

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Although you probably don't care much, I've created an issue on the tracker: #261 :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
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 :)
Laurent Gomila - SFML developer