From 13f55011c0bb726092ec8d78557432bc4adfe37f Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 11 Jan 2020 12:56:46 +1100 Subject: [PATCH] [client] don't draw the cursor if it leaves the frame --- VERSION | 2 +- client/src/main.c | 13 ++++++++++++- client/src/main.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 7c99d9d1..f2fb620c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-77-g80f3c7934a+1 \ No newline at end of file +B1-78-g05dc713dac+1 \ No newline at end of file diff --git a/client/src/main.c b/client/src/main.c index a0177ac5..87f71452 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -277,7 +277,7 @@ static int cursorThread(void * unused) state.lgr->on_mouse_event ( state.lgrData, - state.cursorVisible && state.drawCursor, + state.cursorVisible && state.drawCursor && state.cursorInView, state.cursor.x, state.cursor.y ); @@ -686,7 +686,17 @@ static void handleMouseMoveEvent(int ex, int ey) ex > state.dstRect.x + state.dstRect.w || ey < state.dstRect.y || ey > state.dstRect.y + state.dstRect.h) + { + state.cursorInView = false; + state.updateCursor = true; return; + } + } + + if (!state.cursorInView) + { + state.cursorInView = true; + state.updateCursor = true; } int rx = ex - state.curLastX; @@ -760,6 +770,7 @@ static void handleWindowLeave() return; state.drawCursor = false; + state.cursorInView = false; state.updateCursor = true; } diff --git a/client/src/main.h b/client/src/main.h index c2c0c1d1..34037afd 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -47,6 +47,7 @@ struct AppState bool serverMode; bool haveCursorPos; bool drawCursor; + bool cursorInView; bool updateCursor; float scaleX, scaleY; float accX, accY;