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