mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +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)
|
if (!app_inputEnabled() || !g_cursor.inView)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_cursor.buttons |= (1U << button);
|
||||||
|
|
||||||
if (!spice_mouse_press(button))
|
if (!spice_mouse_press(button))
|
||||||
DEBUG_ERROR("SDL_MOUSEBUTTONDOWN: failed to send message");
|
DEBUG_ERROR("SDL_MOUSEBUTTONDOWN: failed to send message");
|
||||||
}
|
}
|
||||||
@ -1029,6 +1031,8 @@ void app_handleButtonRelease(int button)
|
|||||||
if (!app_inputEnabled())
|
if (!app_inputEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_cursor.buttons &= ~(1U << button);
|
||||||
|
|
||||||
if (!spice_mouse_release(button))
|
if (!spice_mouse_release(button))
|
||||||
DEBUG_ERROR("SDL_MOUSEBUTTONUP: failed to send message");
|
DEBUG_ERROR("SDL_MOUSEBUTTONUP: failed to send message");
|
||||||
}
|
}
|
||||||
@ -1107,6 +1111,10 @@ void app_handleMouseNormal(double ex, double ey)
|
|||||||
struct DoublePoint local;
|
struct DoublePoint local;
|
||||||
guestCurToLocal(&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 */
|
/* check if the move would push the cursor outside the guest's viewport */
|
||||||
if (testExit && (
|
if (testExit && (
|
||||||
local.x + ex < g_state.dstRect.x ||
|
local.x + ex < g_state.dstRect.x ||
|
||||||
|
@ -226,6 +226,9 @@ struct CursorState
|
|||||||
/* the local position */
|
/* the local position */
|
||||||
struct DoublePoint pos;
|
struct DoublePoint pos;
|
||||||
|
|
||||||
|
/* the button state */
|
||||||
|
unsigned int buttons;
|
||||||
|
|
||||||
/* the delta since last warp when in auto capture mode */
|
/* the delta since last warp when in auto capture mode */
|
||||||
struct DoublePoint delta;
|
struct DoublePoint delta;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user