Use mouse capture for Win32 instead of our global mouse state hack
This commit is contained in:
parent
b4edde6f90
commit
36dc0f3e3c
4 changed files with 16 additions and 33 deletions
|
|
@ -30,7 +30,6 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||
m_StreamHeight(streamHeight),
|
||||
m_AbsoluteMouseMode(prefs.absoluteMouseMode),
|
||||
m_AbsoluteTouchMode(prefs.absoluteTouchMode),
|
||||
m_PendingMouseLeaveButtonUp(0),
|
||||
m_LeftButtonReleaseTimer(0),
|
||||
m_RightButtonReleaseTimer(0),
|
||||
m_DragTimer(0),
|
||||
|
|
@ -270,13 +269,14 @@ void SdlInputHandler::notifyMouseLeave()
|
|||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
// SDL on Windows doesn't send the mouse button up until the mouse re-enters the window
|
||||
// after leaving it. This breaks some of the Aero snap gestures, so we'll fake it here.
|
||||
// after leaving it. This breaks some of the Aero snap gestures, so we'll capture it to
|
||||
// allow us to receive the mouse button up events later.
|
||||
if (m_AbsoluteMouseMode && isCaptureActive()) {
|
||||
// NB: Not using SDL_GetGlobalMouseState() because we want our state not the system's
|
||||
Uint32 mouseState = SDL_GetMouseState(nullptr, nullptr);
|
||||
for (Uint32 button = SDL_BUTTON_LEFT; button <= SDL_BUTTON_X2; button++) {
|
||||
if (mouseState & SDL_BUTTON(button)) {
|
||||
m_PendingMouseLeaveButtonUp = button;
|
||||
SDL_CaptureMouse(SDL_TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue