Fix compilation warinings

This commit is contained in:
daa 2017-04-15 20:12:40 +03:00
parent 2443c7d705
commit b2ee054d6d

View File

@ -199,14 +199,9 @@ impl Shell {
.connect_key_press_event(move |_, ev| gtk_key_press(&mut *ref_state.borrow_mut(), ev)); .connect_key_press_event(move |_, ev| gtk_key_press(&mut *ref_state.borrow_mut(), ev));
let ref_state = self.state.clone(); let ref_state = self.state.clone();
let ref_ui_state = self.ui_state.clone();
state state
.drawing_area .drawing_area
.connect_scroll_event(move |_, ev| { .connect_scroll_event(move |_, ev| gtk_scroll_event(&mut *ref_state.borrow_mut(), ev));
gtk_scroll_event(&mut *ref_state.borrow_mut(),
&mut *ref_ui_state.borrow_mut(),
ev)
});
let ref_state = self.state.clone(); let ref_state = self.state.clone();
state state
@ -301,7 +296,7 @@ fn gtk_focus_out(state: &mut State) -> Inhibit {
Inhibit(false) Inhibit(false)
} }
fn gtk_scroll_event(state: &mut State, ui_state: &mut UiState, ev: &EventScroll) -> Inhibit { fn gtk_scroll_event(state: &mut State, ev: &EventScroll) -> Inhibit {
if !state.mouse_enabled { if !state.mouse_enabled {
return Inhibit(false); return Inhibit(false);
} }
@ -309,28 +304,24 @@ fn gtk_scroll_event(state: &mut State, ui_state: &mut UiState, ev: &EventScroll)
match ev.as_ref().direction { match ev.as_ref().direction {
ScrollDirection::Right => { ScrollDirection::Right => {
mouse_input(state, mouse_input(state,
ui_state,
"ScrollWheelRight", "ScrollWheelRight",
ev.get_state(), ev.get_state(),
ev.get_position()) ev.get_position())
} }
ScrollDirection::Left => { ScrollDirection::Left => {
mouse_input(state, mouse_input(state,
ui_state,
"ScrollWheelLeft", "ScrollWheelLeft",
ev.get_state(), ev.get_state(),
ev.get_position()) ev.get_position())
} }
ScrollDirection::Up => { ScrollDirection::Up => {
mouse_input(state, mouse_input(state,
ui_state,
"ScrollWheelUp", "ScrollWheelUp",
ev.get_state(), ev.get_state(),
ev.get_position()) ev.get_position())
} }
ScrollDirection::Down => { ScrollDirection::Down => {
mouse_input(state, mouse_input(state,
ui_state,
"ScrollWheelDown", "ScrollWheelDown",
ev.get_state(), ev.get_state(),
ev.get_position()) ev.get_position())
@ -349,7 +340,6 @@ fn gtk_button_press(shell: &mut State, ui_state: &mut UiState, ev: &EventButton)
ui_state.mouse_pressed = true; ui_state.mouse_pressed = true;
mouse_input(shell, mouse_input(shell,
ui_state,
"LeftMouse", "LeftMouse",
ev.get_state(), ev.get_state(),
ev.get_position()); ev.get_position());
@ -358,7 +348,6 @@ fn gtk_button_press(shell: &mut State, ui_state: &mut UiState, ev: &EventButton)
} }
fn mouse_input(shell: &mut State, fn mouse_input(shell: &mut State,
ui_state: &mut UiState,
input: &str, input: &str,
state: ModifierType, state: ModifierType,
position: (f64, f64)) { position: (f64, f64)) {
@ -384,7 +373,6 @@ fn gtk_button_release(ui_state: &mut UiState) -> Inhibit {
fn gtk_motion_notify(shell: &mut State, ui_state: &mut UiState, ev: &EventMotion) -> Inhibit { fn gtk_motion_notify(shell: &mut State, ui_state: &mut UiState, ev: &EventMotion) -> Inhibit {
if shell.mouse_enabled && ui_state.mouse_pressed { if shell.mouse_enabled && ui_state.mouse_pressed {
mouse_input(shell, mouse_input(shell,
ui_state,
"LeftDrag", "LeftDrag",
ev.get_state(), ev.get_state(),
ev.get_position()); ev.get_position());