chore: update smithay

This commit is contained in:
Victoria Brekenfeld 2026-06-29 17:20:02 +02:00 committed by Victoria Brekenfeld
parent 650768211f
commit ccc4f36065
16 changed files with 513 additions and 552 deletions

View file

@ -51,13 +51,12 @@ use smithay::{
PointerTarget, RelativeMotionEvent,
},
touch::{
DownEvent, MotionEvent as TouchMotionEvent, OrientationEvent, ShapeEvent, TouchTarget,
UpEvent,
DownEvent, FrameMarker, MotionEvent as TouchMotionEvent, OrientationEvent, ShapeEvent,
TouchTarget, UpEvent,
},
},
output::Output,
reexports::calloop::RegistrationToken,
reexports::calloop::{self, LoopHandle, futures::Scheduler},
reexports::calloop::{self, LoopHandle, RegistrationToken, futures::Scheduler},
utils::{
Buffer as BufferCoords, IsAlive, Logical, Physical, Point, Rectangle, Scale, Serial, Size,
Transform,
@ -180,6 +179,8 @@ pub(crate) struct IcedElementInternal<P: Program + Send + 'static> {
last_seat: Arc<Mutex<Option<(Seat<crate::state::State>, Serial)>>>,
cursor_pos: Option<Point<f64, Logical>>,
touch_map: HashMap<Finger, IcedPoint>,
last_touch_frame: Option<FrameMarker>,
last_touch_serial: Option<Serial>,
// iced
theme: Theme,
@ -228,6 +229,8 @@ impl<P: Program + Send + Clone + 'static> Clone for IcedElementInternal<P> {
last_seat: self.last_seat.clone(),
cursor_pos: self.cursor_pos,
touch_map: self.touch_map.clone(),
last_touch_frame: None,
last_touch_serial: None,
theme: self.theme.clone(),
renderer,
state,
@ -253,6 +256,8 @@ impl<P: Program + Send + 'static> fmt::Debug for IcedElementInternal<P> {
.field("last_seat", &self.last_seat)
.field("cursor_pos", &self.cursor_pos)
.field("touch_map", &self.touch_map)
.field("last_touch_frame", &self.last_touch_frame)
.field("last_touch_serial", &self.last_touch_serial)
.field("theme", &"...")
.field("renderer", &"...")
.field("state", &"...")
@ -309,6 +314,8 @@ impl<P: Program + Send + 'static> IcedElement<P> {
cursor_pos: None,
last_seat,
touch_map: HashMap::new(),
last_touch_frame: None,
last_touch_serial: None,
theme,
renderer,
state,
@ -633,7 +640,6 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
event: &DownEvent,
seq: Serial,
) {
let mut internal = self.0.lock().unwrap();
let id = Finger(i32::from(event.slot) as u64);
@ -644,7 +650,8 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
.queue_event(Event::Touch(TouchEvent::FingerPressed { id, position }));
internal.touch_map.insert(id, position);
internal.cursor_pos = Some(event_location);
*internal.last_seat.lock().unwrap() = Some((seat.clone(), seq));
internal.last_touch_serial = Some(event.serial);
*internal.last_seat.lock().unwrap() = Some((seat.clone(), event.serial));
internal.update(false);
}
@ -653,12 +660,12 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
event: &UpEvent,
seq: Serial,
) {
let mut internal = self.0.lock().unwrap();
let id = Finger(i32::from(event.slot) as u64);
if let Some(position) = internal.touch_map.remove(&id) {
*internal.last_seat.lock().unwrap() = Some((seat.clone(), seq));
*internal.last_seat.lock().unwrap() =
Some((seat.clone(), internal.last_touch_serial.unwrap()));
internal
.state
.queue_event(Event::Touch(TouchEvent::FingerLifted { id, position }));
@ -671,13 +678,13 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
event: &TouchMotionEvent,
seq: Serial,
) {
let mut internal = self.0.lock().unwrap();
let id = Finger(i32::from(event.slot) as u64);
let event_location = event.location.downscale(internal.additional_scale);
let position = IcedPoint::new(event_location.x as f32, event_location.y as f32);
*internal.last_seat.lock().unwrap() = Some((seat.clone(), seq));
*internal.last_seat.lock().unwrap() =
Some((seat.clone(), internal.last_touch_serial.unwrap()));
internal
.state
.queue_event(Event::Touch(TouchEvent::FingerMoved { id, position }));
@ -690,17 +697,19 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
&self,
_seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
_seq: Serial,
frame: FrameMarker,
) {
self.0.lock().unwrap().last_touch_frame = Some(frame);
}
fn cancel(
&self,
_seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
_seq: Serial,
frame: FrameMarker,
) {
let mut internal = self.0.lock().unwrap();
internal.last_touch_frame = Some(frame);
for (id, position) in std::mem::take(&mut internal.touch_map) {
internal
.state
@ -714,7 +723,6 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
_seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
_event: &ShapeEvent,
_seq: Serial,
) {
}
@ -723,9 +731,16 @@ impl<P: Program + Send + 'static> TouchTarget<crate::state::State> for IcedEleme
_seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
_event: &OrientationEvent,
_seq: Serial,
) {
}
fn last_frame(
&self,
_seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
) -> Option<FrameMarker> {
self.0.lock().unwrap().last_touch_frame
}
}
impl<P: Program + Send + 'static> KeyboardTarget<crate::state::State> for IcedElement<P> {