Skip to content

Commit ae10c36

Browse files
Revert "Supress touch events after swipe"
This reverts commit 9267705.
1 parent 9267705 commit ae10c36

File tree

2 files changed

+17
-30
lines changed

2 files changed

+17
-30
lines changed

internal_filesystem/apps/com.lightningpiggy.displaywallet/assets/displaywallet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
import mpos.config
44
import mpos.ui
5+
import mpos.apps
56

67
# screens:
78
main_screen = None
89
settings_screen = None
910

11+
1012
# Settings screen implementation
1113
class SettingsScreen():
1214
def __init__(self):
15+
#super().__init__(None)
1316
self.prefs = mpos.config.SharedPreferences("com.lightningpiggy.displaywallet")
1417
self.settings = [
1518
{"title": "Wallet Type", "key": "wallet_type", "value_label": None},

internal_filesystem/boot_unix.py

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
#keyboard.add_event_cb(keyboard_cb, lv.EVENT.ALL, None)
3434

3535

36+
# Swipe detection state
3637
# Swipe detection state
3738
start_y = None # Store the starting Y-coordinate of the mouse press
3839
start_x = None # Store the starting X-coordinate for left-edge swipe
39-
swipe_detected = False # Track if a swipe was detected to suppress widget events
4040

4141
def swipe_read_cb(indev_drv, data):
42-
global start_y, start_x, swipe_detected
42+
global start_y, start_x
4343

4444
pressed = mouse.get_state() # Get mouse/touch pressed state
4545
point = lv.point_t()
@@ -50,59 +50,43 @@ def swipe_read_cb(indev_drv, data):
5050
# Mouse/touch pressed (start of potential swipe)
5151
start_y = y # Store Y for vertical swipe detection
5252
start_x = x # Store X for horizontal swipe detection
53-
swipe_detected = False # Reset swipe flag
5453
print(f"Mouse press at X={start_x}, Y={start_y}")
55-
54+
5655
# Check if press is in notification bar (for swipe down)
5756
if y <= mpos.ui.NOTIFICATION_BAR_HEIGHT:
5857
print(f"Press in notification bar at Y={start_y}")
5958
# Check if press is near left edge (for swipe right)
6059
if x <= 20: # Adjust threshold for left edge (e.g., 20 pixels)
6160
print(f"Press near left edge at X={start_x}")
62-
6361
elif pressed and (start_y is not None or start_x is not None):
6462
# Mouse/touch dragged while pressed (potential swipe in progress)
65-
63+
6664
# Check for downward swipe (y increased significantly)
6765
if start_y is not None and y > start_y + 50: # Threshold for swipe down
6866
print("Long swipe down")
6967
if start_y <= mpos.ui.NOTIFICATION_BAR_HEIGHT:
7068
print("Swipe Down Detected from Notification Bar")
7169
mpos.ui.open_drawer()
72-
swipe_detected = True # Mark swipe detected
73-
start_y = None # Reset Y after swipe
74-
start_x = None # Reset X to avoid conflicts
75-
70+
start_y = None # Reset Y after swipe
71+
start_x = None # Reset X to avoid conflicts
7672
# Check for rightward swipe from left edge (x increased significantly)
7773
if start_x is not None and x > start_x + 50: # Threshold for swipe right
7874
print("Long swipe right")
7975
if start_x <= 20: # Confirm swipe started near left edge
8076
print("Swipe Right Detected from Left Edge")
81-
mpos.ui.back_screen() # Navigate to previous screen
82-
swipe_detected = True # Mark swipe detected
83-
start_y = None # Reset Y after swipe
84-
start_x = None # Reset X after swipe
85-
77+
mpos.ui.back_screen() # Call custom method for left menu
78+
start_y = None # Reset Y after swipe
79+
start_x = None # Reset X after swipe
8680
else:
8781
# Mouse/touch released
88-
if start_y is not None:
89-
if y < start_y - 50: # Threshold for swipe-up
90-
print("Swipe Up Detected")
91-
mpos.ui.close_drawer()
92-
swipe_detected = True # Mark swipe detected
93-
94-
# Reset coordinates
82+
if start_y is not None and y < start_y - 50: # Threshold for swipe-up
83+
print("Swipe Up Detected")
84+
mpos.ui.close_drawer()
85+
86+
# Reset both coordinates on release
9587
start_y = None
9688
start_x = None
9789

98-
# Suppress widget events if any swipe was detected
99-
if swipe_detected:
100-
data.state = lv.INDEV_STATE.RELEASED # Ensure release state
101-
data.point.x = -1 # Move point off-screen to prevent widget interaction
102-
data.point.y = -1
103-
swipe_detected = False # Reset flag after suppression
104-
print("Suppressing widget events after swipe")
105-
10690
# Register the custom read callback with the input device
10791
indev = lv.indev_create()
10892
indev.set_type(lv.INDEV_TYPE.POINTER)

0 commit comments

Comments
 (0)