Skip to content

Commit

Permalink
Add zero wheel_delta to all remaining instances of MouseEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
teddemunnik committed May 2, 2020
1 parent dcae42d commit 4db45bd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions druid-shell/src/platform/mac/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ fn mouse_event(nsevent: id, view: id, count: u8, button: MouseButton) -> MouseEv
mods: modifiers,
count,
button,
wheel_delta: Vec2::ZERO,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions druid-shell/src/platform/web/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ fn setup_mouse_down_callback(ws: &Rc<WindowState>) {
mods: get_modifiers!(event),
count: 1,
button,
wheel_delta: Vec2::ZERO,
};
state.handler.borrow_mut().mouse_down(&event);
}
Expand All @@ -165,6 +166,7 @@ fn setup_mouse_up_callback(ws: &Rc<WindowState>) {
mods: get_modifiers!(event),
count: 0,
button,
wheel_delta: Vec2::ZERO,
};
state.handler.borrow_mut().mouse_up(&event);
}
Expand All @@ -181,6 +183,7 @@ fn setup_mouse_move_callback(ws: &Rc<WindowState>) {
mods: get_modifiers!(event),
count: 0,
button: MouseButton::None,
wheel_delta: Vec2::ZERO,
};
state.handler.borrow_mut().mouse_move(&event);
});
Expand Down
5 changes: 4 additions & 1 deletion druid-shell/src/platform/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use xcb::ffi::XCB_COPY_FROM_PARENT;
use crate::dialog::{FileDialogOptions, FileInfo};
use crate::keyboard::{KeyEvent, KeyModifiers};
use crate::keycodes::KeyCode;
use crate::kurbo::{Point, Rect, Size};
use crate::kurbo::{Point, Rect, Size, Vec2};
use crate::mouse::{Cursor, MouseButton, MouseButtons, MouseEvent};
use crate::piet::{Piet, RenderContext};
use crate::window::{IdleToken, Text, TimerToken, WinHandler};
Expand Down Expand Up @@ -456,6 +456,7 @@ impl Window {
},
count: 1,
button: MouseButton::Left,
wheel_delta: Vec2::ZERO,
};
if let Ok(mut handler) = self.handler.try_borrow_mut() {
handler.mouse_down(&mouse_event);
Expand All @@ -480,6 +481,7 @@ impl Window {
},
count: 0,
button: MouseButton::Left,
wheel_delta: Vec2::ZERO,
};
if let Ok(mut handler) = self.handler.try_borrow_mut() {
handler.mouse_up(&mouse_event);
Expand All @@ -504,6 +506,7 @@ impl Window {
},
count: 0,
button: MouseButton::None,
wheel_delta: Vec2::ZERO,
};
if let Ok(mut handler) = self.handler.try_borrow_mut() {
handler.mouse_move(&mouse_event);
Expand Down
2 changes: 2 additions & 0 deletions druid/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::widget::*;
use crate::*;
use harness::*;
use helpers::*;
use kurbo::Vec2;

/// This function creates a temporary directory and returns a PathBuf to it.
///
Expand Down Expand Up @@ -80,6 +81,7 @@ fn propogate_hot() {
mods: KeyModifiers::default(),
count: 0,
button: MouseButton::None,
wheel_delta: Vec2::ZERO,
}
}
#[allow(clippy::cognitive_complexity)]
Expand Down

0 comments on commit 4db45bd

Please sign in to comment.