1
0
Fork 0
forked from wry/wry

tree: use trunc instead of round when scrolling containers

This commit is contained in:
Julian Orth 2022-05-07 18:06:55 +02:00
parent b7831e1019
commit ec9710983c
14 changed files with 70 additions and 6 deletions

View file

@ -1159,7 +1159,7 @@ impl Node for ContainerNode {
d
} else if let Some(scroll) = event.axis[VERTICAL_SCROLL as usize].get() {
let mut scroll = self.scroll.get() + scroll.to_f64();
let discrete = (scroll / PX_PER_SCROLL).round();
let discrete = (scroll / PX_PER_SCROLL).trunc();
scroll -= discrete * PX_PER_SCROLL;
self.scroll.set(scroll);
discrete as i32
@ -1191,6 +1191,7 @@ impl Node for ContainerNode {
}
fn node_on_pointer_unfocus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("unfocus");
let mut seats = self.seats.borrow_mut();
if let Some(seat_state) = seats.get_mut(&seat.id()) {
seat_state.target = false;
@ -1198,6 +1199,7 @@ impl Node for ContainerNode {
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("container focus");
let mut seats = self.seats.borrow_mut();
if let Some(seat_state) = seats.get_mut(&seat.id()) {
seat_state.target = true;

View file

@ -115,6 +115,7 @@ impl Node for DisplayNode {
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("display focus");
seat.set_known_cursor(KnownCursor::Default);
}
}

View file

@ -467,6 +467,7 @@ impl Node for FloatNode {
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("float focus");
let mut seats = self.seats.borrow_mut();
if let Some(seat_state) = seats.get_mut(&seat.id()) {
seat_state.target = true;

View file

@ -382,7 +382,7 @@ impl Node for OutputNode {
}
}
let bar_height = self.state.theme.title_height.get() + 1;
if y > bar_height {
if y >= bar_height {
y -= bar_height;
let len = tree.len();
if let Some(ws) = self.workspace.get() {
@ -405,6 +405,7 @@ impl Node for OutputNode {
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("output focus");
seat.set_known_cursor(KnownCursor::Default);
}

View file

@ -130,6 +130,7 @@ impl Node for WorkspaceNode {
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("workspace focus");
seat.set_known_cursor(KnownCursor::Default);
}