[client] opengl: mouse shape updates bypass the draw timeout

This commit is contained in:
Geoffrey McRae 2017-12-15 16:53:26 +11:00
parent c1379a45d2
commit f7420317f1

View File

@ -82,6 +82,7 @@ struct LGR_OpenGL
SDL_Rect fpsRect;
bool mouseUpdate;
bool newShape;
uint64_t lastMouseDraw;
LG_RendererCursor mouseType;
bool mouseVisible;
@ -493,6 +494,7 @@ bool lgr_opengl_on_mouse_shape(void * opaque, const LG_RendererCursor cursor, co
}
this->mouseUpdate = true;
this->newShape = true;
return true;
}
@ -702,11 +704,15 @@ bool lgr_opengl_render(void * opaque)
if (!this->mouseUpdate)
return true;
if (!this->newShape)
{
// don't update the mouse too fast
const uint64_t delta = nanotime() - this->lastMouseDraw;
if (delta < 5e6)
return true;
}
this->newShape = false;
}
glDisable(GL_SCISSOR_TEST);
glClear(GL_COLOR_BUFFER_BIT);