From b5ff3556fe67a85edc99885cd2613695e2b54422 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Fri, 1 Oct 2021 01:41:20 -0700 Subject: [PATCH] fix minor remaining bugs --- src/bridge/ui_commands.rs | 10 ++----- src/window/window_wrapper/mouse_manager.rs | 32 ++-------------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/src/bridge/ui_commands.rs b/src/bridge/ui_commands.rs index a5ca55f..05d7a4b 100644 --- a/src/bridge/ui_commands.rs +++ b/src/bridge/ui_commands.rs @@ -91,12 +91,8 @@ impl SerialCommand { .await .expect("Mouse Scroll Failed"); } -<<<<<<< Updated upstream - UiCommand::Drag { - button, -======= SerialCommand::Drag { ->>>>>>> Stashed changes + button, grid_id, position: (grid_x, grid_y), modifier_string, @@ -203,7 +199,7 @@ impl From for UiCommand { } pub fn start_ui_command_handler(running: Arc, mut ui_command_receiver: UnboundedReceiver, nvim: Arc>) { - let serial_tx = start_serial_command_handler(running, nvim); + let serial_tx = start_serial_command_handler(running.clone(), nvim.clone()); tokio::spawn(async move { loop { @@ -230,7 +226,7 @@ pub fn start_ui_command_handler(running: Arc, mut ui_command_receive } pub fn start_serial_command_handler(running: Arc, nvim: Arc>) -> UnboundedSender { - let (serial_tx, serial_rx) = unbounded_channel::(); + let (serial_tx, mut serial_rx) = unbounded_channel::(); tokio::spawn(async move { loop { if !running.load(Ordering::Relaxed) { diff --git a/src/window/window_wrapper/mouse_manager.rs b/src/window/window_wrapper/mouse_manager.rs index 332e10e..33f0643 100644 --- a/src/window/window_wrapper/mouse_manager.rs +++ b/src/window/window_wrapper/mouse_manager.rs @@ -8,12 +8,8 @@ use glutin::{ }; use skia_safe::Rect; -<<<<<<< Updated upstream use super::keyboard_manager::KeyboardManager; -use crate::bridge::UiCommand; -======= use crate::bridge::{SerialCommand, UiCommand}; ->>>>>>> Stashed changes use crate::channel_utils::LoggingTx; use crate::renderer::{Renderer, WindowDrawDetails}; @@ -166,19 +162,12 @@ impl MouseManager { // If dragging and we haven't already sent a position, send a drag command if self.dragging.is_some() && has_moved { self.command_sender -<<<<<<< Updated upstream - .send(UiCommand::Drag { + .send(SerialCommand::Drag { button: self.dragging.as_ref().unwrap().to_owned(), grid_id: relevant_window_details.id, position: self.drag_position.into(), modifier_string: keyboard_manager.format_modifier_string(true), - }) -======= - .send(SerialCommand::Drag { - grid_id: relevant_window_details.id, - position: self.drag_position.into(), }.into()) ->>>>>>> Stashed changes .ok(); } else { // otherwise, update the window_id_under_mouse to match the one selected @@ -214,22 +203,13 @@ impl MouseManager { }; self.command_sender -<<<<<<< Updated upstream - .send(UiCommand::MouseButton { + .send(SerialCommand::MouseButton { button: button_text.clone(), action, grid_id: details.id, position: position.into(), modifier_string: keyboard_manager.format_modifier_string(true), - }) -======= - .send(SerialCommand::MouseButton { - button: button_text.to_string(), - action, - grid_id: details.id, - position: position.into(), }.into()) ->>>>>>> Stashed changes .ok(); } @@ -266,12 +246,8 @@ impl MouseManager { .map(|details| details.id) .unwrap_or(0), position: self.drag_position.into(), -<<<<<<< Updated upstream modifier_string: keyboard_manager.format_modifier_string(true), - }; -======= }.into(); ->>>>>>> Stashed changes for _ in 0..(new_y - previous_y).abs() { self.command_sender.send(scroll_command.clone()).ok(); } @@ -296,12 +272,8 @@ impl MouseManager { .map(|details| details.id) .unwrap_or(0), position: self.drag_position.into(), -<<<<<<< Updated upstream modifier_string: keyboard_manager.format_modifier_string(true), - }; -======= }.into(); ->>>>>>> Stashed changes for _ in 0..(new_x - previous_x).abs() { self.command_sender.send(scroll_command.clone()).ok(); }