New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse Leave event #225

Closed
MikeAcrobat opened this Issue May 22, 2012 · 3 comments

Comments

Projects
None yet
3 participants
@MikeAcrobat

MikeAcrobat commented May 22, 2012

recently noticed that sometimes MouseLeft event is not generated when the mouse button is pressed
Windows 7, VS2010 debug/release
to reproduce :

  1. set a breakpoint
  2. press left mouse button and move the mouse out of the window (fast, cant reproduse while moving mouse slowly)
    In that case event is generated when you release the button.

code:

   sf::RenderWindow win(sf::VideoMode(1024, 768), "Show", sf::Style::Close);
   while (win.isOpen()) {
      sf::Event event;
      while (win.pollEvent(event)) {
         if (event.type == sf::Event::MouseLeft) {
            int setBreakpointHere = 0;
            setBreakpointHere ++;
         }
         if (event.type == sf::Event::Closed) {
            win.close();
         }
      }
      win.clear();
      win.display();
   }

posible workaround : http://www.gamedev.net/topic/191870-wm_mouseleave-problem/

@ghost ghost assigned LaurentGomila May 22, 2012

@minirop

This comment has been minimized.

Show comment
Hide comment
@minirop

minirop May 22, 2012

is it really a "bug" and not a "feature" ?
when a widget has a mouse press event, it grabs all the mouse move event (even if the mouse is out of the window). You can see it with scrollbar (if the mouse is not too far) or with sliders.

minirop commented May 22, 2012

is it really a "bug" and not a "feature" ?
when a widget has a mouse press event, it grabs all the mouse move event (even if the mouse is out of the window). You can see it with scrollbar (if the mouse is not too far) or with sliders.

@LaurentGomila

This comment has been minimized.

Show comment
Hide comment
@LaurentGomila

LaurentGomila May 23, 2012

Member

That's what I first thought, but if I understand correctly it's not consistent: it happens only sometimes, when the mouse is moved fast.

Member

LaurentGomila commented May 23, 2012

That's what I first thought, but if I understand correctly it's not consistent: it happens only sometimes, when the mouse is moved fast.

@minirop

This comment has been minimized.

Show comment
Hide comment
@minirop

minirop May 23, 2012

I just tested with Qt (and it's probably the same with GTK), the mouseLeaveEvent is send just after the mouseReleaseEvent (if the mouse is outside the widget). And mouseMoveEvent are send all the time.
Still digging Qt's source code to see how it's done.

edit: not sure, but probably QETWidget::translateMouseEvent in src\gui\kernel\qapplication_win.cpp:L2984

minirop commented May 23, 2012

I just tested with Qt (and it's probably the same with GTK), the mouseLeaveEvent is send just after the mouseReleaseEvent (if the mouse is outside the widget). And mouseMoveEvent are send all the time.
Still digging Qt's source code to see how it's done.

edit: not sure, but probably QETWidget::translateMouseEvent in src\gui\kernel\qapplication_win.cpp:L2984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment