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

Alt+F4 and mouse clicks are ignored when cursor is inside the window (on Windows) #437

Closed
LaurentGomila opened this Issue Jul 28, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@LaurentGomila
Member

LaurentGomila commented Jul 28, 2013

See http://en.sfml-dev.org/forums/index.php?topic=12400.msg86580#msg86580

This happens because of the SetCapture function, which was added to solve issue #225. There doesn't seem to be a workaround.

Reverting to the imperfect TrackMouseEvent (and bug #225) seems to be the only solution.

@ghost ghost assigned LaurentGomila Jul 28, 2013

@HorstWalter

This comment has been minimized.

Show comment
Hide comment
@HorstWalter

HorstWalter Aug 11, 2013

Call SetCapture when a mouse button is pressed (and none is already pressed). Call ReleaseCapture when all buttons are released.

HorstWalter commented Aug 11, 2013

Call SetCapture when a mouse button is pressed (and none is already pressed). Call ReleaseCapture when all buttons are released.

@All8Up

This comment has been minimized.

Show comment
Hide comment
@All8Up

All8Up Aug 28, 2013

Hmm, tried to post this a minute ago, seems it didn't go through. If you call this code in the various button down calls, it corrects things:

bool WindowImplWin32::testWindowActivation()
{
    if (GetActiveWindow() != m_handle)
    {
        SetActiveWindow(m_handle);
        return true;
    }
    return false;
}

The only downside is unless you ignore the click when activation is detected, it comes in before the focus event.

All8Up commented Aug 28, 2013

Hmm, tried to post this a minute ago, seems it didn't go through. If you call this code in the various button down calls, it corrects things:

bool WindowImplWin32::testWindowActivation()
{
    if (GetActiveWindow() != m_handle)
    {
        SetActiveWindow(m_handle);
        return true;
    }
    return false;
}

The only downside is unless you ignore the click when activation is detected, it comes in before the focus event.

MarioLiebisch added a commit to MarioLiebisch/SFML that referenced this issue Aug 28, 2013

Fixed mouse clicks not activating windows (Win32)
- This fixes issue SFML#437, except Alt+F4, which would be a different issue?
- This is essentially based around All8Up's suggestion.
- The new member variable m_focused is meant to be exposed later on so the
  user is able to determine whether the window is active without doing
  separate event tracking.
- Activating mouse clicks aren't passed to the event queue. This is something not really consistent across games or applications in general, but I prefer this behavior (avoids triggering anything by accident).

MarioLiebisch added a commit to MarioLiebisch/SFML that referenced this issue Aug 28, 2013

Better fix for mouse capture issues under Win32
- This fix is a lot cleaner and preventing all issues described in
  issue SFML#437 without caveats or side effects.
- This also restores system shortcuts like Alt+F4 or Alt+Space.

MarioLiebisch added a commit to MarioLiebisch/SFML that referenced this issue Sep 24, 2013

Fixed mouse clicks not activating windows (Win32)
- This fixes issue SFML#437, except Alt+F4, which would be a different issue?
- This also restores system shortcuts like Alt+F4 or Alt+Space.

MarioLiebisch added a commit to MarioLiebisch/SFML that referenced this issue Sep 24, 2013

Fixed mouse clicks not activating windows (Win32)
- This fixes issue SFML#437.
- This also restores system shortcuts like Alt+F4 or Alt+Space.
@LaurentGomila

This comment has been minimized.

Show comment
Hide comment
@LaurentGomila

LaurentGomila Sep 25, 2013

Member

Fixed by #457

Member

LaurentGomila commented Sep 25, 2013

Fixed by #457

LaurentGomila added a commit that referenced this issue Sep 25, 2013

Merge pull request #457 from MarioLiebisch/issue-437
Fixed mouse clicks not activating windows (Win32) (#437, #455)

jcowgill added a commit to jcowgill/SFML that referenced this issue Sep 22, 2014

Fixed mouse clicks not activating windows (Win32)
- This fixes issue SFML#437.
- This also restores system shortcuts like Alt+F4 or Alt+Space.

(cherry picked from commit 9d3ea93)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment