Disabled touch input: always active gestures (#10624)

reviewable/pr10637/r1
hius07 10 months ago committed by GitHub
parent 08dd97384c
commit adfbbd9903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -72,6 +72,8 @@ local settingsList = {
poweroff = {category="none", event="RequestPowerOff", title=_("Power off"), device=true, condition=Device:canPowerOff(), separator=true},
toggle_hold_corners = {category="none", event="IgnoreHoldCorners", title=_("Toggle hold corners"), device=true},
touch_input_on = {category="none", event="IgnoreTouchInput", arg=false, title=_("Enable touch input"), device=true},
touch_input_off = {category="none", event="IgnoreTouchInput", arg=true, title=_("Disable touch input"), device=true},
toggle_touch_input = {category="none", event="IgnoreTouchInput", title=_("Toggle touch input"), device=true, separator=true},
toggle_gsensor = {category="none", event="ToggleGSensor", title=_("Toggle accelerometer"), device=true, condition=Device:hasGSensor()},
toggle_rotation = {category="none", event="SwapRotation", title=_("Toggle orientation"), device=true},
@ -264,6 +266,8 @@ local dispatcher_menu_order = {
"poweroff",
"toggle_hold_corners",
"touch_input_on",
"touch_input_off",
"toggle_touch_input",
"toggle_gsensor",
"rotation_mode",
@ -949,6 +953,31 @@ function Dispatcher:addSubMenu(caller, menu, location, settings)
end
end,
})
table.insert(menu, {
text = _("Always active"),
checked_func = function()
return location[settings] ~= nil
and location[settings].settings ~= nil
and location[settings].settings.always_active
end,
callback = function()
if location[settings] then
if location[settings].settings then
if location[settings].settings.always_active then
location[settings].settings.always_active = nil
if next(location[settings].settings) == nil then
location[settings].settings = nil
end
else
location[settings].settings.always_active = true
end
else
location[settings].settings = {["always_active"] = true}
end
caller.updated = true
end
end,
})
table.insert(menu, {
text = _("Sort"),
checked_func = function()

@ -121,7 +121,7 @@ Multiswipes allow you to perform complex gestures built up out of multiple swipe
These advanced gestures consist of either straight swipes or diagonal swipes. To ensure accuracy, they can't be mixed.]])
-- If the gesture contains the "toggle_touch_input" action,
-- If the gesture contains "toggle_touch_input" or "touch_input_on" actions, or is set "Always active" manually,
-- mark it "always active" to make sure that InputContainer won't block it after the IgnoreTouchInput Event.
function Gestures:isGestureAlwaysActive(ges, multiswipe_directions)
-- Handle multiswipes properly
@ -134,7 +134,8 @@ function Gestures:isGestureAlwaysActive(ges, multiswipe_directions)
end
end
return self.gestures[ges] and self.gestures[ges].toggle_touch_input
local gest = self.gestures[ges]
return gest and (gest.toggle_touch_input or gest.touch_input_on or (gest.settings and gest.settings.always_active))
end
function Gestures:init()

Loading…
Cancel
Save