[client] app: always track the mouse button state

This change fixes a bug on re-grab of the cursor if window focus was
lost while a mouse button was held.
This commit is contained in:
Geoffrey McRae 2021-02-02 09:36:01 +11:00
parent 06f6a96b56
commit c6af5be1dc

View File

@ -163,22 +163,22 @@ void spiceClipboardNotice(const SpiceDataType type)
void app_handleButtonPress(int button) void app_handleButtonPress(int button)
{ {
g_cursor.buttons |= (1U << button);
if (!core_inputEnabled() || !g_cursor.inView) if (!core_inputEnabled() || !g_cursor.inView)
return; return;
g_cursor.buttons |= (1U << button);
if (!spice_mouse_press(button)) if (!spice_mouse_press(button))
DEBUG_ERROR("app_handleButtonPress: failed to send message"); DEBUG_ERROR("app_handleButtonPress: failed to send message");
} }
void app_handleButtonRelease(int button) void app_handleButtonRelease(int button)
{ {
g_cursor.buttons &= ~(1U << button);
if (!core_inputEnabled()) if (!core_inputEnabled())
return; return;
g_cursor.buttons &= ~(1U << button);
if (!spice_mouse_release(button)) if (!spice_mouse_release(button))
DEBUG_ERROR("app_handleButtonRelease: failed to send message"); DEBUG_ERROR("app_handleButtonRelease: failed to send message");
} }