mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] spice: fix loss of click/focus on resize
This commit is contained in:
parent
c9f41ea69e
commit
21ba14f629
@ -84,6 +84,9 @@ struct CursorState g_cursor;
|
|||||||
// this structure is initialized in config.c
|
// this structure is initialized in config.c
|
||||||
struct AppParams params = { 0 };
|
struct AppParams params = { 0 };
|
||||||
|
|
||||||
|
static void setGrab(bool enable);
|
||||||
|
static void setGrabQuiet(bool enable);
|
||||||
|
|
||||||
static void handleMouseGrabbed(double ex, double ey);
|
static void handleMouseGrabbed(double ex, double ey);
|
||||||
static void handleMouseNormal(double ex, double ey);
|
static void handleMouseNormal(double ex, double ey);
|
||||||
|
|
||||||
@ -1093,7 +1096,17 @@ static void handleResizeEvent(unsigned int w, unsigned int h)
|
|||||||
updatePositionInfo();
|
updatePositionInfo();
|
||||||
|
|
||||||
if (inputEnabled())
|
if (inputEnabled())
|
||||||
|
{
|
||||||
|
/* if the window is moved/resized causing a loss of focus while grabbed, it
|
||||||
|
* makes it impossible to re-focus the window, so we quietly re-enter
|
||||||
|
* capture if we were already in it */
|
||||||
|
if (g_cursor.grab)
|
||||||
|
{
|
||||||
|
setGrabQuiet(false);
|
||||||
|
setGrabQuiet(true);
|
||||||
|
}
|
||||||
alignToGuest();
|
alignToGuest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleWindowLeave()
|
static void handleWindowLeave()
|
||||||
@ -1151,6 +1164,16 @@ static void keyboardUngrab()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void setGrab(bool enable)
|
static void setGrab(bool enable)
|
||||||
|
{
|
||||||
|
setGrabQuiet(enable);
|
||||||
|
|
||||||
|
app_alert(
|
||||||
|
g_cursor.grab ? LG_ALERT_SUCCESS : LG_ALERT_WARNING,
|
||||||
|
g_cursor.grab ? "Capture Enabled" : "Capture Disabled"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setGrabQuiet(bool enable)
|
||||||
{
|
{
|
||||||
/* we always do this so that at init the cursor is in the right state */
|
/* we always do this so that at init the cursor is in the right state */
|
||||||
if (params.captureInputOnly && params.hideMouse)
|
if (params.captureInputOnly && params.hideMouse)
|
||||||
@ -1205,11 +1228,6 @@ static void setGrab(bool enable)
|
|||||||
|
|
||||||
if (g_cursor.grab)
|
if (g_cursor.grab)
|
||||||
g_cursor.inView = true;
|
g_cursor.inView = true;
|
||||||
|
|
||||||
app_alert(
|
|
||||||
g_cursor.grab ? LG_ALERT_SUCCESS : LG_ALERT_WARNING,
|
|
||||||
g_cursor.grab ? "Capture Enabled" : "Capture Disabled"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int eventFilter(void * userdata, SDL_Event * event)
|
int eventFilter(void * userdata, SDL_Event * event)
|
||||||
|
Loading…
Reference in New Issue
Block a user