try to fix the coordinates returned by touch events
This commit is contained in:
parent
46213020dd
commit
a62364082a
|
@ -11,6 +11,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "msg_queue.h"
|
#include "msg_queue.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
#include "fbinit.h"
|
||||||
#include "time_func.h"
|
#include "time_func.h"
|
||||||
|
|
||||||
#define INPUT_EVENT_BATCH 16 /* number of events to retrieve from touchscreen at once */
|
#define INPUT_EVENT_BATCH 16 /* number of events to retrieve from touchscreen at once */
|
||||||
|
@ -130,10 +131,12 @@ static BOOL poll_touchscreen(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_ABS:
|
case EV_ABS:
|
||||||
|
/* Note that the touchscreen driver assumes the screen is "vertical," so swap the x and y axes */
|
||||||
|
/* Also it thinks origin is lower left with up = +y */
|
||||||
if (buffer[i].code == ABS_X)
|
if (buffer[i].code == ABS_X)
|
||||||
touch_x = buffer[i].value;
|
touch_y = Fb_Info->height - buffer[i].value;
|
||||||
else if (buffer[i].code == ABS_Y)
|
else if (buffer[i].code == ABS_Y)
|
||||||
touch_y = buffer[i].value;
|
touch_x = buffer[i].value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_KEY:
|
case EV_KEY:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user