-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fixes #4754: report other mouse buttons #7773
base: master
Are you sure you want to change the base?
Conversation
alacritty/src/input/mod.rs
Outdated
@@ -946,7 +956,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { | |||
MouseButton::Left => self.ctx.mouse_mut().left_button_state = state, | |||
MouseButton::Middle => self.ctx.mouse_mut().middle_button_state = state, | |||
MouseButton::Right => self.ctx.mouse_mut().right_button_state = state, | |||
_ => (), | |||
_ => self.ctx.mouse_mut().other_button_state = state, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this ever work? You're conflating all other buttons into a single state that can't possibly be accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is still exactly the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, it was specified here to only map Back
and Forward
to 8
and 9
& to report other buttons according to xterm
.
this was why only MouseButton::Back
& MouseButton::Forward
was handled in the match
statement. and the default case was to handle the other buttons as is.
hence, we check for the buttons pressed on #on_mouse_release
, add the respective values & report them as is.
please correct me if I am missing something here, thanks! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the default case was to handle the other buttons as is.
That is not what your code does.
alacritty/src/input/mod.rs
Outdated
@@ -946,7 +956,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { | |||
MouseButton::Left => self.ctx.mouse_mut().left_button_state = state, | |||
MouseButton::Middle => self.ctx.mouse_mut().middle_button_state = state, | |||
MouseButton::Right => self.ctx.mouse_mut().right_button_state = state, | |||
_ => (), | |||
_ => self.ctx.mouse_mut().other_button_state = state, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is still exactly the same?
MouseButton::Other(x) => match x { | ||
6 | 7 => (x + 64) as u8, | ||
10 | 11 => (x + 128) as u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add this? What is it based on? X11 button IDs? How about cross-platform compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi
Why did you add this? What is it based on? X11 button IDs?
it is based on XTerm control sequences (as mentioned here: #6957 (comment)).
How about cross-platform compatibility?
I think cross-platform compatibility is already being handled by winit
(ref: rust-windowing/winit#2770)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think cross-platform compatibility is already being handled by winit (ref: rust-windowing/winit#2770)
This is irrelevant here, because winit guarantee only for Named
values, but you're mapping Other
and Other
is undefined. And that's what was the question about here, why you translate 6 | 7
to x + 64
where on wayland or macOS the buttons are just completely different, thus you kind of implies X11 because xterm is X11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think cross-platform compatibility is already being handled by winit (ref: rust-windowing/winit#2770)
This is irrelevant here, because winit guarantee only for
Named
values, but you're mappingOther
andOther
is undefined. And that's what was the question about here, why you translate6 | 7
tox + 64
where on wayland or macOS the buttons are just completely different, thus you kind of implies X11 because xterm is X11.
alright, I will look into this & update the PR soon.
Supersedes #6957