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?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,8 +595,13 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { | |
MouseButton::Left => 0, | ||
MouseButton::Middle => 1, | ||
MouseButton::Right => 2, | ||
// Can't properly report more than three buttons.. | ||
MouseButton::Back | MouseButton::Forward | MouseButton::Other(_) => return, | ||
MouseButton::Back => 8, | ||
MouseButton::Forward => 9, | ||
MouseButton::Other(x) => match x { | ||
6 | 7 => (x + 64) as u8, | ||
10 | 11 => (x + 128) as u8, | ||
_ => return, | ||
}, | ||
}; | ||
|
||
self.mouse_report(code, ElementState::Pressed); | ||
|
@@ -670,8 +675,13 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { | |
MouseButton::Left => 0, | ||
MouseButton::Middle => 1, | ||
MouseButton::Right => 2, | ||
// Can't properly report more than three buttons. | ||
MouseButton::Back | MouseButton::Forward | MouseButton::Other(_) => return, | ||
MouseButton::Back => 8, | ||
MouseButton::Forward => 9, | ||
MouseButton::Other(x) => match x { | ||
6 | 7 => (x + 64) as u8, | ||
10 | 11 => (x + 128) as u8, | ||
_ => return, | ||
}, | ||
}; | ||
self.mouse_report(code, ElementState::Released); | ||
return; | ||
|
@@ -946,7 +956,9 @@ 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, | ||
_ => (), | ||
MouseButton::Back => self.ctx.mouse_mut().back_button_state = state, | ||
MouseButton::Forward => self.ctx.mouse_mut().forward_button_state = state, | ||
_ => self.ctx.mouse_mut().other_button_state = state, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. hi, it was specified here to only map this was why only hence, we check for the buttons pressed on please correct me if I am missing something here, thanks! :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That is not what your code does. |
||
} | ||
|
||
// Skip normal mouse events if the message bar has been clicked. | ||
|
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
it is based on XTerm control sequences (as mentioned here: #6957 (comment)).
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.
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.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.
alright, I will look into this & update the PR soon.