[client] added option to show host cursor for latency testing

This commit is contained in:
Geoffrey McRae 2017-12-03 19:53:30 +11:00
parent d408c6c5bb
commit aa191f6c90

View File

@ -75,6 +75,7 @@ struct AppParams
const char * spiceHost; const char * spiceHost;
unsigned int spicePort; unsigned int spicePort;
bool scaleMouseInput; bool scaleMouseInput;
bool hideMouse;
}; };
struct AppState state; struct AppState state;
@ -97,7 +98,8 @@ struct AppParams params =
.useSpice = true, .useSpice = true,
.spiceHost = "127.0.0.1", .spiceHost = "127.0.0.1",
.spicePort = 5900, .spicePort = 5900,
.scaleMouseInput = true .scaleMouseInput = true,
.hideMouse = true
}; };
inline void updatePositionInfo() inline void updatePositionInfo()
@ -806,12 +808,15 @@ int run()
return -1; return -1;
} }
// work around SDL_ShowCursor being non functional
SDL_Cursor *cursor = NULL; SDL_Cursor *cursor = NULL;
if (params.hideMouse)
{
// work around SDL_ShowCursor being non functional
int32_t cursorData[2] = {0, 0}; int32_t cursorData[2] = {0, 0};
cursor = SDL_CreateCursor((uint8_t*)cursorData, (uint8_t*)cursorData, 8, 8, 4, 4); cursor = SDL_CreateCursor((uint8_t*)cursorData, (uint8_t*)cursorData, 8, 8, 4, 4);
SDL_SetCursor(cursor); SDL_SetCursor(cursor);
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
}
state.renderer = SDL_CreateRenderer(state.window, -1, state.renderer = SDL_CreateRenderer(state.window, -1,
SDL_RENDERER_ACCELERATED | SDL_RENDERER_ACCELERATED |
@ -955,6 +960,7 @@ void doHelp(char * app)
" -c HOST Specify the spice host [current: %s]\n" " -c HOST Specify the spice host [current: %s]\n"
" -p PORT Specify the spice port [current: %d]\n" " -p PORT Specify the spice port [current: %d]\n"
" -j Disable cursor position scaling\n" " -j Disable cursor position scaling\n"
" -M Don't hide the host cursor\n"
"\n" "\n"
" -g Disable OpenGL 4.3 Buffer Storage (GL_ARB_buffer_storage)\n" " -g Disable OpenGL 4.3 Buffer Storage (GL_ARB_buffer_storage)\n"
" -m Disable mipmapping\n" " -m Disable mipmapping\n"
@ -1010,7 +1016,7 @@ void doLicense()
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
int c; int c;
while((c = getopt(argc, argv, "hf:sc:p:jgmvkanrdx:y:w:b:l")) != -1) while((c = getopt(argc, argv, "hf:sc:p:jMgmvkanrdx:y:w:b:l")) != -1)
switch(c) switch(c)
{ {
case '?': case '?':
@ -1039,6 +1045,10 @@ int main(int argc, char * argv[])
params.scaleMouseInput = false; params.scaleMouseInput = false;
break; break;
case 'M':
params.hideMouse = false;
break;
case 'g': case 'g':
params.useBufferStorage = false; params.useBufferStorage = false;
break; break;