[client] don't draw the cursor if it leaves the frame

This commit is contained in:
Geoffrey McRae 2020-01-11 12:56:46 +11:00
parent 05dc713dac
commit 13f55011c0
3 changed files with 14 additions and 2 deletions

View File

@ -1 +1 @@
B1-77-g80f3c7934a+1
B1-78-g05dc713dac+1

View File

@ -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,8 +686,18 @@ 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;
int ry = ey - state.curLastY;
@ -760,6 +770,7 @@ static void handleWindowLeave()
return;
state.drawCursor = false;
state.cursorInView = false;
state.updateCursor = true;
}

View File

@ -47,6 +47,7 @@ struct AppState
bool serverMode;
bool haveCursorPos;
bool drawCursor;
bool cursorInView;
bool updateCursor;
float scaleX, scaleY;
float accX, accY;