mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] only send one in every 100 key down messages
This commit is contained in:
parent
e71f2274e4
commit
ee0b086927
@ -384,6 +384,7 @@ int eventThread(void * arg)
|
|||||||
{
|
{
|
||||||
int mouseX = 0;
|
int mouseX = 0;
|
||||||
int mouseY = 0;
|
int mouseY = 0;
|
||||||
|
int repeatCount = 0;
|
||||||
|
|
||||||
// ensure mouse acceleration is identical in server mode
|
// ensure mouse acceleration is identical in server mode
|
||||||
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE);
|
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1", SDL_HINT_OVERRIDE);
|
||||||
@ -407,8 +408,16 @@ int eventThread(void * arg)
|
|||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
{
|
{
|
||||||
SDL_Scancode sc = event.key.keysym.scancode;
|
SDL_Scancode sc = event.key.keysym.scancode;
|
||||||
|
if (event.key.repeat)
|
||||||
|
++repeatCount;
|
||||||
|
else
|
||||||
|
repeatCount = 0;
|
||||||
|
|
||||||
if (sc == SDL_SCANCODE_SCROLLLOCK)
|
if (sc == SDL_SCANCODE_SCROLLLOCK)
|
||||||
{
|
{
|
||||||
|
if (event.key.repeat)
|
||||||
|
break;
|
||||||
|
|
||||||
serverMode = !serverMode;
|
serverMode = !serverMode;
|
||||||
spice_mouse_mode(serverMode);
|
spice_mouse_mode(serverMode);
|
||||||
SDL_SetRelativeMouseMode(serverMode);
|
SDL_SetRelativeMouseMode(serverMode);
|
||||||
@ -432,6 +441,10 @@ int eventThread(void * arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (repeatCount != 0 && repeatCount != 100)
|
||||||
|
break;
|
||||||
|
|
||||||
|
repeatCount = 0;
|
||||||
uint32_t scancode = mapScancode(sc);
|
uint32_t scancode = mapScancode(sc);
|
||||||
if (scancode == 0)
|
if (scancode == 0)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user