mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] mouse: dont leave the window if any mouse buttons are held
This commit is contained in:
parent
bab7eba7f0
commit
d22124519e
@ -1020,6 +1020,8 @@ void app_handleButtonPress(int button)
|
||||
if (!app_inputEnabled() || !g_cursor.inView)
|
||||
return;
|
||||
|
||||
g_cursor.buttons |= (1U << button);
|
||||
|
||||
if (!spice_mouse_press(button))
|
||||
DEBUG_ERROR("SDL_MOUSEBUTTONDOWN: failed to send message");
|
||||
}
|
||||
@ -1029,6 +1031,8 @@ void app_handleButtonRelease(int button)
|
||||
if (!app_inputEnabled())
|
||||
return;
|
||||
|
||||
g_cursor.buttons &= ~(1U << button);
|
||||
|
||||
if (!spice_mouse_release(button))
|
||||
DEBUG_ERROR("SDL_MOUSEBUTTONUP: failed to send message");
|
||||
}
|
||||
@ -1107,6 +1111,10 @@ void app_handleMouseNormal(double ex, double ey)
|
||||
struct DoublePoint local;
|
||||
guestCurToLocal(&local);
|
||||
|
||||
/* if any buttons are held we should not allow exit to happen */
|
||||
if (g_cursor.buttons)
|
||||
testExit = false;
|
||||
|
||||
/* check if the move would push the cursor outside the guest's viewport */
|
||||
if (testExit && (
|
||||
local.x + ex < g_state.dstRect.x ||
|
||||
|
@ -226,6 +226,9 @@ struct CursorState
|
||||
/* the local position */
|
||||
struct DoublePoint pos;
|
||||
|
||||
/* the button state */
|
||||
unsigned int buttons;
|
||||
|
||||
/* the delta since last warp when in auto capture mode */
|
||||
struct DoublePoint delta;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user