Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Right Click Mouse Support #11796

Open
ryanwwest opened this issue May 10, 2024 · 6 comments
Open

FR: Right Click Mouse Support #11796

ryanwwest opened this issue May 10, 2024 · 6 comments

Comments

@ryanwwest
Copy link
Contributor

Does your feature request involve difficulty completing a task? Please describe.

KOReader on Android, macOS and Linux can be interacted with using a pointing device like a mouse cursor. It works the same way as touch currently—you left click to simulate a tap, left-click and hold to do a long press, and you can even perform gestures with it. But the right click button seems to do exactly the same thing as left click.

Describe the solution you'd like

The most straight-forward avenue to me would be that right click simulates a press-and-hold action (already a rather universal convention between touch screens and mice). In file manager that would result in context menu being shown for the clicked file, in the Reader that would allow much faster word selection (single right click) or highlight selection (right click and hold, but immediately move the cursor while holding after pressing the button instead of waiting). Right-clicking hot corners would also immediately trigger the long-press action.

The only challenge I can think of so far would be to ensure the right-click satisfies the variable-length threshold to trigger a press-and-hold action. Perhaps there are multiple of these depending on context, but all should work.

@Frenzie
Copy link
Member

Frenzie commented May 11, 2024

Note that presently pressing left and right together is equivalent to two-finger touch/swipes.

@offset-torque
Copy link

I support this proposal from the UX perspective. I have been using the desktop KOReader for testing for a long time and still reflexively right click for the long-press menu. It is generally a very strong muscle memory with desktop users so it is a good idea to make it work as expected.

Note that presently pressing left and right together is equivalent to two-finger touch/swipes.

In theory, this makes sense. But I just tried it with a mouse and it is very uncomfortable to draw a gesture while pressing both buttons (and I have experience from using this combination as an emulated middle button under Linux). I would be surprised if someone uses this feature daily. Probably "single finger swipes with mouse" are the edges of usability.

@Frenzie
Copy link
Member

Frenzie commented May 11, 2024

It's probably not very challenging btw. If you check how I implemented scrolling you can do something similar:

if ev.code == SDL_MOUSEWHEEL then
local scrolled_x = ev.value.x
local scrolled_y = ev.value.y
local up = 1
local down = -1
local pos = Geom:new{
x = 0,
y = 0,
w = 0, h = 0,
}
local fake_ges = {
ges = "pan",
distance = 200,
relative = {
x = 50*scrolled_x,
y = 100*scrolled_y,
},
pos = pos,
time = time.timeval(ev.time),
mousewheel_direction = scrolled_y,
}
local fake_ges_release = {
ges = "pan_release",
distance = fake_ges.distance,
relative = fake_ges.relative,
pos = pos,
time = time.timeval(ev.time),
from_mousewheel = true,
}
local fake_pan_ev = Event:new("Pan", nil, fake_ges)
local fake_release_ev = Event:new("Gesture", fake_ges_release)
if scrolled_y == down then
fake_ges.direction = "north"
UIManager:sendEvent(fake_pan_ev)
UIManager:sendEvent(fake_release_ev)
elseif scrolled_y == up then
fake_ges.direction = "south"
UIManager:sendEvent(fake_pan_ev)
UIManager:sendEvent(fake_release_ev)
end

@ryanwwest
Copy link
Contributor Author

ryanwwest commented May 11, 2024

Note that presently pressing left and right together is equivalent to two-finger touch/swipes.

This doesn't necessarily need to change to support the right click behavior as I describe, right? I wouldn't use left and right click together and I'm guessing very few people will use it or even know about it, but I don't think we'd need to remove it.

Gestures with mouse aren't fluid, but since I use Syncthing to mirror my settings config across all devices, I know the few gestures I use well and it's occasionally nice to use them with mouse. Plus I use KOReader on web browser with https://github.com/koreader/virdevenv https://github.com/zephyros-dev/docker-koreader and it comes in handy there, especially on mobile devices where using your finger is technically using a mouse.

@Frenzie
Copy link
Member

Frenzie commented May 11, 2024

This doesn't necessarily need to change to support the right click behavior as I describe, right?

Perhaps not necessarily but then you're talking about something that may well be difficult to do. ;-)

It was mostly just a comment saying it doesn't do the same thing as left click but the same thing as a finger. I wrote it that way so that it'd be possible to test two-finger actions on the emulator without a touch screen. It's not important to keep it.

@ryanwwest
Copy link
Contributor Author

ryanwwest commented May 11, 2024

Sounds good. I may work on this and a few other FRs I've opened after my new Linux laptop arrives and when I have some free time, if someone else doesn't beat me to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants