Skip to content

Commit

Permalink
remove grab cursor on macos and place default instead
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Aug 29, 2024
1 parent 8655c11 commit 7809761
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
3 changes: 0 additions & 3 deletions frontends/rioterm/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ pub const DEADZONE_START_Y: f64 = 30.;
#[cfg(target_os = "macos")]
pub const DEADZONE_END_Y: f64 = -2.0;

#[cfg(target_os = "macos")]
pub const DEADZONE_START_X: f64 = 80.;

pub const PADDING_X_COLLAPSED_TABS: f32 = 30.;
pub const PADDING_Y_BOTTOM_TABS: f32 = 22.0;
11 changes: 2 additions & 9 deletions frontends/rioterm/src/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::bindings::{
ViAction,
};
#[cfg(target_os = "macos")]
use crate::constants::{DEADZONE_END_Y, DEADZONE_START_X, DEADZONE_START_Y};
use crate::constants::{DEADZONE_END_Y, DEADZONE_START_Y};
use crate::context::{self, process_open_url, ContextManager};
use crate::crosswords::{
grid::{Dimensions, Scroll},
Expand Down Expand Up @@ -280,6 +280,7 @@ impl Screen<'_> {
)
}

#[inline]
pub fn touch_purpose(&mut self) -> &mut TouchPurpose {
&mut self.touchpurpose
}
Expand All @@ -292,14 +293,6 @@ impl Screen<'_> {
pos_y <= DEADZONE_START_Y * scale_f64 && pos_y >= DEADZONE_END_Y * scale_f64
}

#[inline]
#[cfg(target_os = "macos")]
pub fn is_macos_deadzone_draggable(&self, pos_x: f64) -> bool {
let layout = self.sugarloaf.layout();
let scale_f64 = layout.dimensions.scale as f64;
pos_x >= DEADZONE_START_X * scale_f64
}

/// update_config is triggered in any configuration file update
#[inline]
pub fn update_config(
Expand Down
24 changes: 4 additions & 20 deletions frontends/rioterm/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,26 +870,10 @@ impl Sequencer {
.is_native
&& route.window.screen.is_macos_deadzone(y)
{
if route.window.screen.is_macos_deadzone_draggable(x)
{
if lmb_pressed || rmb_pressed {
route.window.screen.clear_selection();
route
.window
.winit_window
.set_cursor(CursorIcon::Grabbing);
} else {
route
.window
.winit_window
.set_cursor(CursorIcon::Grab);
}
} else {
route
.window
.winit_window
.set_cursor(CursorIcon::Default);
}
route
.window
.winit_window
.set_cursor(CursorIcon::Default);

route.window.is_macos_deadzone = true;
return;
Expand Down

0 comments on commit 7809761

Please sign in to comment.