aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2017-12-29 18:48:37 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2018-01-03 11:15:57 -0800
commit04bfda943a2411e4c1585af3ff68d82ed4589929 (patch)
tree4e10e32bd85f0c9cd2a9c6efd4c6a68861edbd4e
parentb83a26ffe097ba9bf80b2801ba27737f6ccd90be (diff)
downloadalacritty-04bfda943a2411e4c1585af3ff68d82ed4589929.tar.gz
alacritty-04bfda943a2411e4c1585af3ff68d82ed4589929.zip
Update mouse modifiers to only pass shift
The only mouse modifier required right now is the shift key, to prevent passing around unnecessary state, only the shift state is passed to the mouse processors now.
-rw-r--r--src/event.rs4
-rw-r--r--src/input.rs18
2 files changed, 11 insertions, 11 deletions
diff --git a/src/event.rs b/src/event.rs
index 3dce4d66..c43ba2b3 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -300,7 +300,7 @@ impl<N: Notify> Processor<N> {
},
MouseInput { state, button, modifiers, .. } => {
*hide_cursor = false;
- processor.mouse_input(state, button, modifiers);
+ processor.mouse_input(state, button, modifiers.shift);
processor.ctx.terminal.dirty = true;
},
CursorMoved { position: (x, y), modifiers, .. } => {
@@ -310,7 +310,7 @@ impl<N: Notify> Processor<N> {
let y = limit(y, 0, processor.ctx.size_info.height as i32);
*hide_cursor = false;
- processor.mouse_moved(x as u32, y as u32, modifiers);
+ processor.mouse_moved(x as u32, y as u32, modifiers.shift);
if !processor.ctx.selection.is_none() {
processor.ctx.terminal.dirty = true;
diff --git a/src/input.rs b/src/input.rs
index 586a664c..604ea06b 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -253,7 +253,7 @@ impl From<&'static str> for Action {
impl<'a, A: ActionContext + 'a> Processor<'a, A> {
#[inline]
- pub fn mouse_moved(&mut self, x: u32, y: u32, modifiers: ModifiersState) {
+ pub fn mouse_moved(&mut self, x: u32, y: u32, shift: bool) {
self.ctx.mouse_mut().x = x;
self.ctx.mouse_mut().y = y;
@@ -274,7 +274,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
if self.ctx.mouse_mut().left_button_state == ElementState::Pressed {
let report_mode = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION;
- if modifiers.shift || !self.ctx.terminal_mode().intersects(report_mode) {
+ if shift || !self.ctx.terminal_mode().intersects(report_mode) {
self.ctx.update_selection(Point {
line: point.line,
col: point.col
@@ -337,7 +337,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
}
}
- pub fn on_mouse_press(&mut self, modifiers: ModifiersState) {
+ pub fn on_mouse_press(&mut self, shift: bool) {
let now = Instant::now();
let elapsed = self.ctx.mouse_mut().last_click_timestamp.elapsed();
self.ctx.mouse_mut().last_click_timestamp = now;
@@ -353,7 +353,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
},
_ => {
let report_modes = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION;
- if !modifiers.shift && self.ctx.terminal_mode().intersects(report_modes) {
+ if !shift && self.ctx.terminal_mode().intersects(report_modes) {
self.mouse_report(0);
return;
}
@@ -364,9 +364,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
};
}
- pub fn on_mouse_release(&mut self, modifiers: ModifiersState) {
+ pub fn on_mouse_release(&mut self, shift: bool) {
let report_modes = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION;
- if !modifiers.shift && self.ctx.terminal_mode().intersects(report_modes)
+ if !shift && self.ctx.terminal_mode().intersects(report_modes)
{
self.mouse_report(3);
return;
@@ -456,16 +456,16 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
}
}
- pub fn mouse_input(&mut self, state: ElementState, button: MouseButton, modifiers: ModifiersState) {
+ pub fn mouse_input(&mut self, state: ElementState, button: MouseButton, shift: bool) {
if let MouseButton::Left = button {
let state = mem::replace(&mut self.ctx.mouse_mut().left_button_state, state);
if self.ctx.mouse_mut().left_button_state != state {
match self.ctx.mouse_mut().left_button_state {
ElementState::Pressed => {
- self.on_mouse_press(modifiers);
+ self.on_mouse_press(shift);
},
ElementState::Released => {
- self.on_mouse_release(modifiers);
+ self.on_mouse_release(shift);
}
}
}