input: Fix handle_mouse_event function

Ignore all keys that aren't prefixed with KS_EXTRA.
This commit is contained in:
Thiago de Arruda
2015-02-13 12:05:51 -03:00
parent 2b6ffa61bf
commit e17f92eb29

View File

@@ -215,15 +215,19 @@ static unsigned int handle_mouse_event(char **ptr, uint8_t *buf,
unsigned int bufsize) unsigned int bufsize)
{ {
int mouse_code = 0; int mouse_code = 0;
int type = 0;
if (bufsize == 3) { if (bufsize == 3) {
mouse_code = buf[2]; mouse_code = buf[2];
type = buf[1];
} else if (bufsize == 6) { } else if (bufsize == 6) {
// prefixed with K_SPECIAL KS_MODIFIER mod // prefixed with K_SPECIAL KS_MODIFIER mod
mouse_code = buf[5]; mouse_code = buf[5];
type = buf[4];
} }
if (!((mouse_code >= KE_LEFTMOUSE && mouse_code <= KE_RIGHTRELEASE) if (type != KS_EXTRA
|| !((mouse_code >= KE_LEFTMOUSE && mouse_code <= KE_RIGHTRELEASE)
|| (mouse_code >= KE_MOUSEDOWN && mouse_code <= KE_MOUSERIGHT))) { || (mouse_code >= KE_MOUSEDOWN && mouse_code <= KE_MOUSERIGHT))) {
return bufsize; return bufsize;
} }