mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-01 04:39:27 +00:00
[client] core: set the correct cursor when exiting overlay
This commit is contained in:
parent
bbd9c84896
commit
95987a9c91
3 changed files with 28 additions and 23 deletions
|
@ -907,7 +907,7 @@ void app_setOverlay(bool enable)
|
||||||
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
|
g_state.io->ConfigFlags |= ImGuiConfigFlags_NoMouse;
|
||||||
core_resetOverlayInputState();
|
core_resetOverlayInputState();
|
||||||
core_setGrabQuiet(wasGrabbed);
|
core_setGrabQuiet(wasGrabbed);
|
||||||
core_invalidatePointer();
|
core_invalidatePointer(true);
|
||||||
app_invalidateWindow(false);
|
app_invalidateWindow(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,21 +31,44 @@
|
||||||
|
|
||||||
#define RESIZE_TIMEOUT (10 * 1000) // 10ms
|
#define RESIZE_TIMEOUT (10 * 1000) // 10ms
|
||||||
|
|
||||||
|
static bool isInView(void)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
g_cursor.pos.x >= g_state.dstRect.x &&
|
||||||
|
g_cursor.pos.x < g_state.dstRect.x + g_state.dstRect.w &&
|
||||||
|
g_cursor.pos.y >= g_state.dstRect.y &&
|
||||||
|
g_cursor.pos.y < g_state.dstRect.y + g_state.dstRect.h;
|
||||||
|
}
|
||||||
|
|
||||||
bool core_inputEnabled(void)
|
bool core_inputEnabled(void)
|
||||||
{
|
{
|
||||||
return g_params.useSpiceInput && !g_state.ignoreInput &&
|
return g_params.useSpiceInput && !g_state.ignoreInput &&
|
||||||
((g_cursor.grab && g_params.captureInputOnly) || !g_params.captureInputOnly);
|
((g_cursor.grab && g_params.captureInputOnly) || !g_params.captureInputOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void core_invalidatePointer(void)
|
void core_invalidatePointer(bool detectInView)
|
||||||
{
|
{
|
||||||
/* if the display server does not support warp, then we can not operate in
|
/* if the display server does not support warp, then we can not operate in
|
||||||
* always relative mode and we should not grab the pointer */
|
* always relative mode and we should not grab the pointer */
|
||||||
enum LG_DSWarpSupport warpSupport = LG_DS_WARP_NONE;
|
enum LG_DSWarpSupport warpSupport = LG_DS_WARP_NONE;
|
||||||
app_getProp(LG_DS_WARP_SUPPORT, &warpSupport);
|
app_getProp(LG_DS_WARP_SUPPORT, &warpSupport);
|
||||||
|
|
||||||
g_cursor.warpState = g_cursor.inView ? WARP_STATE_ON : WARP_STATE_OFF;
|
if (detectInView)
|
||||||
|
{
|
||||||
|
bool inView = isInView();
|
||||||
|
// do not allow the view to become active if any mouse buttons are being held,
|
||||||
|
// this fixes issues with meta window resizing.
|
||||||
|
if (inView && g_cursor.buttons)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_cursor.inView = inView;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_cursor.draw = (g_params.alwaysShowCursor || g_params.captureInputOnly)
|
||||||
|
? true : g_cursor.inView;
|
||||||
|
g_cursor.redraw = true;
|
||||||
|
|
||||||
|
g_cursor.warpState = g_cursor.inView ? WARP_STATE_ON : WARP_STATE_OFF;
|
||||||
if (g_cursor.inView)
|
if (g_cursor.inView)
|
||||||
{
|
{
|
||||||
if (g_params.hideMouse)
|
if (g_params.hideMouse)
|
||||||
|
@ -80,17 +103,8 @@ void core_setCursorInView(bool enable)
|
||||||
if (enable && !g_state.focused)
|
if (enable && !g_state.focused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// do not allow the view to become active if any mouse buttons are being held,
|
|
||||||
// this fixes issues with meta window resizing.
|
|
||||||
if (enable && g_cursor.buttons)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_cursor.inView = enable;
|
g_cursor.inView = enable;
|
||||||
g_cursor.draw = (g_params.alwaysShowCursor || g_params.captureInputOnly)
|
core_invalidatePointer(false);
|
||||||
? true : enable;
|
|
||||||
g_cursor.redraw = true;
|
|
||||||
|
|
||||||
core_invalidatePointer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void core_setGrab(bool enable)
|
void core_setGrab(bool enable)
|
||||||
|
@ -401,15 +415,6 @@ void core_handleMouseGrabbed(double ex, double ey)
|
||||||
DEBUG_ERROR("failed to send mouse motion message");
|
DEBUG_ERROR("failed to send mouse motion message");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isInView(void)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
g_cursor.pos.x >= g_state.dstRect.x &&
|
|
||||||
g_cursor.pos.x < g_state.dstRect.x + g_state.dstRect.w &&
|
|
||||||
g_cursor.pos.y >= g_state.dstRect.y &&
|
|
||||||
g_cursor.pos.y < g_state.dstRect.y + g_state.dstRect.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_handleMouseNormal(double ex, double ey)
|
void core_handleMouseNormal(double ex, double ey)
|
||||||
{
|
{
|
||||||
// prevent cursor handling outside of capture if the position is not known
|
// prevent cursor handling outside of capture if the position is not known
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
bool core_inputEnabled(void);
|
bool core_inputEnabled(void);
|
||||||
void core_invalidatePointer(void);
|
void core_invalidatePointer(bool detectInView);
|
||||||
void core_setCursorInView(bool enable);
|
void core_setCursorInView(bool enable);
|
||||||
void core_setGrab(bool enable);
|
void core_setGrab(bool enable);
|
||||||
void core_setGrabQuiet(bool enable);
|
void core_setGrabQuiet(bool enable);
|
||||||
|
|
Loading…
Add table
Reference in a new issue