Use spare bits in code.mouse[3] to store bigger mouse positions

This commit is contained in:
Paul LeoNerd Evans
2012-04-12 17:02:45 +01:00
parent 84378bcba8
commit 8cf0858276
3 changed files with 34 additions and 21 deletions

View File

@@ -912,10 +912,10 @@ TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKe
*button = 0;
if(col)
*col = (unsigned char)key->code.mouse[1];
*col = (unsigned char)key->code.mouse[1] | ((unsigned char)key->code.mouse[3] & 0x0f) << 8;
if(line)
*line = (unsigned char)key->code.mouse[2];
*line = (unsigned char)key->code.mouse[2] | ((unsigned char)key->code.mouse[3] & 0x70) << 4;
if(!event)
return TERMKEY_RES_KEY;
@@ -954,7 +954,7 @@ TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKe
if(button)
*button = btn;
if(key->code.mouse[3])
if(key->code.mouse[3] & 0x80)
*event = TERMKEY_MOUSE_RELEASE;
return TERMKEY_RES_KEY;