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

Fixes #4754: report other mouse buttons #7773

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

VishnuSanal
Copy link

Supersedes #6957

@@ -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,
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL :)

Copy link
Member

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?

Copy link
Author

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! :)

Copy link
Member

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.

@@ -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,
Copy link
Member

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?

Comment on lines +600 to +602
MouseButton::Other(x) => match x {
6 | 7 => (x + 64) as u8,
10 | 11 => (x + 128) as u8,
Copy link
Member

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?

Copy link
Author

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)

Copy link
Member

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.

Copy link
Author

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.

alright, I will look into this & update the PR soon.

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

Successfully merging this pull request may close these issues.

None yet

3 participants