mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Enable Alt+Shift+G for screenshots on all devices with a keyboard (#11888)
This commit is contained in:
@@ -15,22 +15,9 @@ local Screenshoter = InputContainer:extend{
|
||||
}
|
||||
|
||||
function Screenshoter:init()
|
||||
if not Device:isTouchDevice() then
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events.KeyPressShoot = {
|
||||
{ "Alt", "Shift", "G" }, -- same as stock firmware
|
||||
event = "KeyPressShoot",
|
||||
}
|
||||
elseif Device:hasFiveWay() then
|
||||
-- kindle 4 case: same as stock firmware.
|
||||
self.key_events.KeyPressShoot = {
|
||||
{ "ScreenKB", "Menu" },
|
||||
event = "KeyPressShoot",
|
||||
}
|
||||
-- unable to add other non-touch devices as simultaneous key presses won't work without modifiers
|
||||
end
|
||||
return
|
||||
end
|
||||
self:registerKeyEvents()
|
||||
if not Device:isTouchDevice() then return end
|
||||
|
||||
local diagonal = math.sqrt(Screen:getWidth()^2 + Screen:getHeight()^2)
|
||||
self.ges_events = {
|
||||
TapDiagonal = {
|
||||
@@ -146,4 +133,22 @@ function Screenshoter:onSwipeDiagonal()
|
||||
return self:onScreenshot()
|
||||
end
|
||||
|
||||
function Screenshoter:registerKeyEvents()
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events.KeyPressShoot = {
|
||||
{ "Alt", "Shift", "G" }, -- same as stock Kindle firmware
|
||||
event = "KeyPressShoot",
|
||||
}
|
||||
elseif Device:hasFiveWay() then
|
||||
-- kindle 4 case: same as stock firmware.
|
||||
self.key_events.KeyPressShoot = {
|
||||
{ "ScreenKB", "Menu" },
|
||||
event = "KeyPressShoot",
|
||||
}
|
||||
-- unable to add other non-touch devices as simultaneous key presses won't work without modifiers
|
||||
end
|
||||
end
|
||||
|
||||
Screenshoter.onPhysicalKeyboardConnected = Screenshoter.registerKeyEvents
|
||||
|
||||
return Screenshoter
|
||||
|
||||
Reference in New Issue
Block a user