From ec90ae6139fd7cff9ce4e09a6707ebe0e2a94cde Mon Sep 17 00:00:00 2001 From: okay Date: Sat, 2 Mar 2024 20:24:12 -0800 Subject: [PATCH] [kobo] update sharenote and drawing_demo to accept touch as stylus --- src/drawing_demo/main.cpy | 12 +++++++++--- src/sharenote/main.cpy | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/drawing_demo/main.cpy b/src/drawing_demo/main.cpy index 07e6614..4cb0d0b 100644 --- a/src/drawing_demo/main.cpy +++ b/src/drawing_demo/main.cpy @@ -13,10 +13,16 @@ class Note: public ui::Widget: void on_mouse_up(input::SynMotionEvent &ev): prevx = prevy = -1 - void on_mouse_move(input::SynMotionEvent &ev): - if input::is_touch_event(ev): - return + bool ignore_event(input::SynMotionEvent &ev): + if not ui::MainLoop::in.has_stylus: + ev.pressure = 0.5 + ev.tilt_x = 0.5 + ev.tilt_y = 0.5 + return false + return input::is_touch_event(ev) != NULL + + void on_mouse_move(input::SynMotionEvent &ev): if not mouse_down: return diff --git a/src/sharenote/main.cpy b/src/sharenote/main.cpy index cee25a3..2250b5d 100644 --- a/src/sharenote/main.cpy +++ b/src/sharenote/main.cpy @@ -204,6 +204,12 @@ class Note: public ui::Widget: prevx = prevy = -1 bool ignore_event(input::SynMotionEvent &ev): + if not ui::MainLoop::in.has_stylus: + ev.pressure = 0.5 + ev.tilt_x = 0.5 + ev.tilt_y = 0.5 + return false + return input::is_touch_event(ev) != NULL void on_mouse_move(input::SynMotionEvent &ev):