Skip to content

Commit c09c7ac

Browse files
author
okay
committed
[remux] better flood event selection
1 parent 0bb771b commit c09c7ac

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/remux/launcher.cpy

+19-9
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,17 @@
2222
#include "config.h"
2323

2424
#ifdef REMARKABLE
25-
#define TOUCH_FLOOD_EVENT ABS_DISTANCE
2625
#define DRAW_APP_BEHIND_MODAL
2726
#define READ_XOCHITL_DATA
2827
#define GRAB_INPUT
2928
#define SUSPENDABLE
3029
#elif KOBO
31-
#define TOUCH_FLOOD_EVENT ABS_MT_DISTANCE
3230
#define DYNAMIC_BPP
3331
#define HAS_ROTATION
3432
#define PORTRAIT_ONLY
3533
#define USE_GRAYSCALE_32BIT
36-
#else
37-
#define TOUCH_FLOOD_EVENT ABS_DISTANCE
3834
#endif
3935

40-
#ifdef RMKIT_FBINK
41-
#define TOUCH_FLOOD_EVENT ABS_DISTANCE
42-
#endif
4336

4437
TIMEOUT := 1
4538
// all time is in seconds
@@ -775,18 +768,35 @@ class App: public IApp:
775768
if write(fd, &ev, sizeof(ev)) != sizeof(ev):
776769
debug "COULDNT WRITE EV", errno
777770

771+
// Figures out what event is supported for flooding
772+
uint16_t get_flood_event():
773+
vector<uint16_t> features = { ABS_DISTANCE, ABS_MT_DISTANCE, ABS_PRESSURE }
774+
vector<string> names = { "ABS_DISTANCE", "ABS_MT_DISTANCE", "ABS_PRESSURE" }
775+
776+
unsigned long bit[EV_MAX]
777+
fd := ui::MainLoop::in.touch.fd
778+
ioctl(fd, EVIOCGBIT(0, EV_MAX), bit)
779+
for i := 0; i < len(features); i++:
780+
if input::check_bit_set(fd, EV_ABS, features[i]):
781+
debug "SETTING FLOOD EVENT TO", names[i], features[i]
782+
return features[i]
783+
784+
// return ABS_DISTANCE by default
785+
return ABS_DISTANCE
786+
778787

779788
input_event* build_touch_flood():
780789
n := 512 * 8
781790
num_inst := 4
782791
input_event *ev = (input_event*) malloc(sizeof(struct input_event) * n * num_inst)
783792
memset(ev, 0, sizeof(input_event) * n * num_inst)
793+
flood_event := get_flood_event()
784794

785795
i := 0
786796
while i < n:
787-
ev[i++] = input_event{ type:EV_ABS, code:TOUCH_FLOOD_EVENT, value:1 }
797+
ev[i++] = input_event{ type:EV_ABS, code:flood_event, value:1 }
788798
ev[i++] = input_event{ type:EV_SYN, code:0, value:0 }
789-
ev[i++] = input_event{ type:EV_ABS, code:TOUCH_FLOOD_EVENT, value:2 }
799+
ev[i++] = input_event{ type:EV_ABS, code:flood_event, value:2 }
790800
ev[i++] = input_event{ type:EV_SYN, code:0, value:0 }
791801

792802
return ev

0 commit comments

Comments
 (0)