wmii/liblitz/mouse.c

28 lines
584 B
C
Raw Normal View History

2005-11-18 18:54:58 +03:00
/*
* (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "blitz.h"
/* free the result manually! */
2005-12-05 01:45:59 +03:00
char *blitz_buttontostr(unsigned int button)
2005-11-18 18:54:58 +03:00
{
2005-12-05 01:45:59 +03:00
char result[8];
result[0] = 0;
2005-11-18 18:54:58 +03:00
snprintf(result, 8, "Button%ud", button - Button1);
return cext_estrdup(result);
2005-11-18 18:54:58 +03:00
}
2005-12-05 01:45:59 +03:00
unsigned int blitz_strtobutton(char *val)
2005-11-18 18:54:58 +03:00
{
2005-12-05 01:45:59 +03:00
unsigned int res = 0;
2005-11-18 18:54:58 +03:00
if (val && strlen(val) > 6 && !strncmp(val, "Button", 6))
2005-12-11 17:47:23 +03:00
res = blitz_strtonum(&val[6], 1, 5) + Button1;
2005-11-18 18:54:58 +03:00
return res;
}