resize/tiling: Fix location for tablet tools
This commit is contained in:
parent
b8824128a0
commit
f00ff834c9
2 changed files with 5 additions and 14 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::render::cursor::CursorState,
|
backend::render::cursor::CursorState,
|
||||||
shell::{
|
shell::{
|
||||||
|
|
@ -52,7 +50,6 @@ pub struct ResizeForkTarget {
|
||||||
pub output: WeakOutput,
|
pub output: WeakOutput,
|
||||||
pub left_up_idx: usize,
|
pub left_up_idx: usize,
|
||||||
pub orientation: Orientation,
|
pub orientation: Orientation,
|
||||||
pub last_tablet_location: Cell<Option<Point<f64, Global>>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IsAlive for ResizeForkTarget {
|
impl IsAlive for ResizeForkTarget {
|
||||||
|
|
@ -193,10 +190,9 @@ impl TabletToolTarget<State> for ResizeForkTarget {
|
||||||
let serial = event.serial;
|
let serial = event.serial;
|
||||||
let time = event.time;
|
let time = event.time;
|
||||||
let tool = tool_descriptor.clone();
|
let tool = tool_descriptor.clone();
|
||||||
let Some(location) = self.last_tablet_location.take() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
data.common.event_loop_handle.insert_idle(move |state| {
|
data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
|
let pointer = seat.get_pointer().unwrap();
|
||||||
|
let location = pointer.current_location();
|
||||||
let tablet = seat.tablet_seat().get_tool(&tool).unwrap();
|
let tablet = seat.tablet_seat().get_tool(&tool).unwrap();
|
||||||
tablet.set_grab(
|
tablet.set_grab(
|
||||||
state,
|
state,
|
||||||
|
|
@ -205,11 +201,11 @@ impl TabletToolTarget<State> for ResizeForkTarget {
|
||||||
tool,
|
tool,
|
||||||
data: TabletToolGrabStartData {
|
data: TabletToolGrabStartData {
|
||||||
focus: None,
|
focus: None,
|
||||||
location: location.as_logical(),
|
location: location,
|
||||||
trigger: TabletToolGrabTrigger::Tip,
|
trigger: TabletToolGrabTrigger::Tip,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
location,
|
location.as_global(),
|
||||||
node,
|
node,
|
||||||
left_up_idx,
|
left_up_idx,
|
||||||
orientation,
|
orientation,
|
||||||
|
|
@ -227,10 +223,8 @@ impl TabletToolTarget<State> for ResizeForkTarget {
|
||||||
_seat: &Seat<State>,
|
_seat: &Seat<State>,
|
||||||
_data: &mut State,
|
_data: &mut State,
|
||||||
_tool_descriptor: &TabletToolDescriptor,
|
_tool_descriptor: &TabletToolDescriptor,
|
||||||
event: &TabletMotionEvent,
|
_event: &TabletMotionEvent,
|
||||||
) {
|
) {
|
||||||
self.last_tablet_location
|
|
||||||
.set(Some(event.location.as_global()))
|
|
||||||
}
|
}
|
||||||
fn proximity_out(
|
fn proximity_out(
|
||||||
&self,
|
&self,
|
||||||
|
|
@ -238,7 +232,6 @@ impl TabletToolTarget<State> for ResizeForkTarget {
|
||||||
_data: &mut State,
|
_data: &mut State,
|
||||||
_tool_descriptor: &TabletToolDescriptor,
|
_tool_descriptor: &TabletToolDescriptor,
|
||||||
) {
|
) {
|
||||||
self.last_tablet_location.set(None);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn proximity_in(
|
fn proximity_in(
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ use smithay::{
|
||||||
wayland::{compositor::add_blocker, seat::WaylandFocus},
|
wayland::{compositor::add_blocker, seat::WaylandFocus},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
cell::Cell,
|
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
sync::{Arc, Weak},
|
sync::{Arc, Weak},
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
|
|
@ -3349,7 +3348,6 @@ impl TilingLayout {
|
||||||
output: self.output.downgrade(),
|
output: self.output.downgrade(),
|
||||||
left_up_idx: idx,
|
left_up_idx: idx,
|
||||||
orientation,
|
orientation,
|
||||||
last_tablet_location: Cell::new(None),
|
|
||||||
}
|
}
|
||||||
.into(),
|
.into(),
|
||||||
(last_geometry.loc
|
(last_geometry.loc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue