formatting and clippy fixes

macos-click-through
Keith Simmons 3 years ago committed by Keith Simmons
parent 46845b86b4
commit 8bade3667d

@ -121,7 +121,11 @@ impl GlutinWindowWrapper {
pub fn handle_event(&mut self, event: Event<()>, running: &Arc<AtomicBool>) { pub fn handle_event(&mut self, event: Event<()>, running: &Arc<AtomicBool>) {
self.keyboard_manager.handle_event(&event); self.keyboard_manager.handle_event(&event);
self.mouse_manager.handle_event( self.mouse_manager.handle_event(
&event, &self.keyboard_manager, &self.renderer, &self.windowed_context); &event,
&self.keyboard_manager,
&self.renderer,
&self.windowed_context,
);
match event { match event {
Event::LoopDestroyed => { Event::LoopDestroyed => {
self.handle_quit(running); self.handle_quit(running);

@ -8,10 +8,10 @@ use glutin::{
}; };
use skia_safe::Rect; use skia_safe::Rect;
use super::keyboard_manager::KeyboardManager;
use crate::bridge::UiCommand; use crate::bridge::UiCommand;
use crate::channel_utils::LoggingTx; use crate::channel_utils::LoggingTx;
use crate::renderer::{Renderer, WindowDrawDetails}; use crate::renderer::{Renderer, WindowDrawDetails};
use super::keyboard_manager::KeyboardManager;
fn clamp_position( fn clamp_position(
position: PhysicalPosition<f32>, position: PhysicalPosition<f32>,
@ -178,7 +178,12 @@ impl MouseManager {
} }
} }
fn handle_pointer_transition(&mut self, mouse_button: &MouseButton, down: bool, keyboard_manager: &KeyboardManager) { fn handle_pointer_transition(
&mut self,
mouse_button: &MouseButton,
down: bool,
keyboard_manager: &KeyboardManager,
) {
// For some reason pointer down is handled differently from pointer up and drag. // For some reason pointer down is handled differently from pointer up and drag.
// Floating windows: relative coordinates are great. // Floating windows: relative coordinates are great.
// Non floating windows: rather than global coordinates, relative are needed // Non floating windows: rather than global coordinates, relative are needed
@ -210,7 +215,7 @@ impl MouseManager {
self.dragging = Some(button_text); self.dragging = Some(button_text);
if !self.dragging.is_some() { if self.dragging.is_none() {
self.has_moved = false; self.has_moved = false;
} }
} }
@ -282,9 +287,10 @@ impl MouseManager {
keyboard_manager: &KeyboardManager, keyboard_manager: &KeyboardManager,
) { ) {
self.handle_line_scroll( self.handle_line_scroll(
pixel_x / font_width as f32, pixel_x / font_width as f32,
pixel_y / font_height as f32, pixel_y / font_height as f32,
keyboard_manager); keyboard_manager,
);
} }
pub fn handle_event( pub fn handle_event(
@ -329,9 +335,10 @@ impl MouseManager {
event: WindowEvent::MouseInput { button, state, .. }, event: WindowEvent::MouseInput { button, state, .. },
.. ..
} => self.handle_pointer_transition( } => self.handle_pointer_transition(
button, button,
state == &ElementState::Pressed, state == &ElementState::Pressed,
keyboard_manager), keyboard_manager,
),
_ => {} _ => {}
} }
} }

Loading…
Cancel
Save