chore: update smithay

This commit is contained in:
Victoria Brekenfeld 2026-08-19 12:40:05 +02:00 • committed by Victoria Brekenfeld
parent 31827ed240
commit 5c93094574
22 changed files with 168 additions and 165 deletions

53
Cargo.lock generated
View file

@ -1189,7 +1189,7 @@ dependencies = [
"libc", "libc",
"option-ext", "option-ext",
"redox_users", "redox_users",
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -1503,7 +1503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -2690,7 +2690,7 @@ dependencies = [
"portable-atomic", "portable-atomic",
"portable-atomic-util", "portable-atomic-util",
"serde_core", "serde_core",
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -2813,7 +2813,7 @@ version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638" checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638"
dependencies = [ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -3429,7 +3429,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -4167,20 +4167,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha 0.3.1", "rand_chacha",
"rand_core 0.6.4", "rand_core 0.6.4",
] ]
[[package]]
name = "rand"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.5",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.10.0" version = "0.10.0"
@ -4202,16 +4192,6 @@ dependencies = [
"rand_core 0.6.4", "rand_core 0.6.4",
] ]
[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core 0.9.5",
]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.6.4" version = "0.6.4"
@ -4221,15 +4201,6 @@ dependencies = [
"getrandom 0.2.17", "getrandom 0.2.17",
] ]
[[package]]
name = "rand_core"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
dependencies = [
"getrandom 0.3.4",
]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.10.0" version = "0.10.0"
@ -4525,7 +4496,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.12.1", "linux-raw-sys 0.12.1",
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -4820,7 +4791,7 @@ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
[[package]] [[package]]
name = "smithay" name = "smithay"
version = "0.7.0" version = "0.7.0"
source = "git+https://github.com/smithay/smithay.git?rev=5fb12b8#5fb12b87407b3680135c45d94214c5f1b1d0fbea" source = "git+https://github.com/smithay/smithay.git?rev=e3d461a#e3d461a057ba244d213a8498ec372b0799cca103"
dependencies = [ dependencies = [
"aliasable", "aliasable",
"appendlist", "appendlist",
@ -4849,7 +4820,7 @@ dependencies = [
"pkg-config", "pkg-config",
"portable-atomic", "portable-atomic",
"profiling", "profiling",
"rand 0.9.2", "rand 0.10.0",
"reis", "reis",
"rustix 1.1.4", "rustix 1.1.4",
"scopeguard", "scopeguard",
@ -5115,7 +5086,7 @@ dependencies = [
"getrandom 0.4.1", "getrandom 0.4.1",
"once_cell", "once_cell",
"rustix 1.1.4", "rustix 1.1.4",
"windows-sys 0.59.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@ -5414,7 +5385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf" checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf"
dependencies = [ dependencies = [
"cc", "cc",
"windows-targets 0.48.5", "windows-targets 0.52.6",
] ]
[[package]] [[package]]
@ -6134,7 +6105,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]

View file

@ -146,4 +146,4 @@ lto = "fat"
cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" } cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }
[patch.crates-io] [patch.crates-io]
smithay = { git = "https://github.com/smithay/smithay.git", rev = "5fb12b8" } smithay = { git = "https://github.com/smithay/smithay.git", rev = "e3d461a" }

View file

@ -14,8 +14,11 @@ use cosmic_config::{ConfigGet, CosmicConfigEntry};
use cosmic_settings_config::window_rules::ApplicationException; use cosmic_settings_config::window_rules::ApplicationException;
use cosmic_settings_config::{Shortcuts, shortcuts, window_rules}; use cosmic_settings_config::{Shortcuts, shortcuts, window_rules};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smithay::utils::{Clock, Monotonic};
use smithay::wayland::xdg_activation::XdgActivationState; use smithay::wayland::xdg_activation::XdgActivationState;
use smithay::{
backend::input::InputTime,
utils::{Clock, Monotonic},
};
pub use smithay::{ pub use smithay::{
backend::input::{self as smithay_input, KeyState}, backend::input::{self as smithay_input, KeyState},
input::keyboard::{Keysym, ModifiersState, keysyms as KeySyms}, input::keyboard::{Keysym, ModifiersState, keysyms as KeySyms},
@ -770,13 +773,12 @@ pub fn change_modifier_state(
const X11_KEYCODE_OFFSET: u32 = 8; const X11_KEYCODE_OFFSET: u32 = 8;
let mut input = |key_state, scan_code| { let mut input = |key_state, scan_code| {
let time = state.common.clock.now().as_millis();
let _ = keyboard.input( let _ = keyboard.input(
state, state,
smithay_input::Keycode::new(scan_code + X11_KEYCODE_OFFSET), smithay_input::Keycode::new(scan_code + X11_KEYCODE_OFFSET),
key_state, key_state,
SERIAL_COUNTER.next_serial(), SERIAL_COUNTER.next_serial(),
time, InputTime::now(),
|_, _, _| smithay::input::keyboard::FilterResult::<()>::Forward, |_, _, _| smithay::input::keyboard::FilterResult::<()>::Forward,
); );
}; };

View file

@ -18,6 +18,7 @@ use cosmic_config::ConfigSet;
use cosmic_settings_config::shortcuts; use cosmic_settings_config::shortcuts;
use cosmic_settings_config::shortcuts::action::{Direction, FocusDirection}; use cosmic_settings_config::shortcuts::action::{Direction, FocusDirection};
use smithay::{ use smithay::{
backend::input::InputTime,
input::{Seat, pointer::MotionEvent}, input::{Seat, pointer::MotionEvent},
utils::{Point, Serial}, utils::{Point, Serial},
}; };
@ -45,7 +46,7 @@ impl State {
backend_id: &InputBackendId, backend_id: &InputBackendId,
seat: &Seat<State>, seat: &Seat<State>,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
pattern: shortcuts::Binding, pattern: shortcuts::Binding,
direction: Option<Direction>, direction: Option<Direction>,
) { ) {
@ -150,7 +151,7 @@ impl State {
backend_id: &InputBackendId, backend_id: &InputBackendId,
seat: &Seat<State>, seat: &Seat<State>,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
pattern: shortcuts::Binding, pattern: shortcuts::Binding,
direction: Option<Direction>, direction: Option<Direction>,
propagate: bool, propagate: bool,

View file

@ -42,9 +42,9 @@ use smithay::{
backend::input::{ backend::input::{
AbsolutePositionEvent, Axis, AxisRelativeDirection, AxisSource, Device, DeviceCapability, AbsolutePositionEvent, Axis, AxisRelativeDirection, AxisSource, Device, DeviceCapability,
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _,
GestureSwipeUpdateEvent as _, InputBackend, InputEvent, KeyState, PointerAxisEvent, GestureSwipeUpdateEvent as _, InputBackend, InputEvent, InputTime, KeyState,
ProximityState, TabletToolButtonEvent, TabletToolEvent, TabletToolProximityEvent, PointerAxisEvent, ProximityState, TabletToolButtonEvent, TabletToolEvent,
TabletToolTipEvent, TabletToolTipState, TouchEvent, TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState, TouchEvent,
}, },
desktop::{PopupKeyboardGrab, WindowSurfaceType, utils::under_from_surface_tree}, desktop::{PopupKeyboardGrab, WindowSurfaceType, utils::under_from_surface_tree},
input::{ input::{
@ -271,7 +271,7 @@ impl State {
trace!(?keycode, ?state, "key"); trace!(?keycode, ?state, "key");
let serial = SERIAL_COUNTER.next_serial(); let serial = SERIAL_COUNTER.next_serial();
let time = Event::time_msec(&event); let time = Event::time(&event);
let keyboard = seat.get_keyboard().unwrap(); let keyboard = seat.get_keyboard().unwrap();
let previous_modifiers = keyboard.modifier_state(); let previous_modifiers = keyboard.modifier_state();
if let Some((action, pattern)) = keyboard if let Some((action, pattern)) = keyboard
@ -397,7 +397,7 @@ impl State {
&RelativeMotionEvent { &RelativeMotionEvent {
delta: event.delta(), delta: event.delta(),
delta_unaccel: event.delta_unaccel(), delta_unaccel: event.delta_unaccel(),
utime: event.time(), time: event.time(),
}, },
); );
@ -638,7 +638,7 @@ impl State {
&MotionEvent { &MotionEvent {
location: position.as_logical(), location: position.as_logical(),
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
); );
ptr.frame(self); ptr.frame(self);
@ -753,7 +753,7 @@ impl State {
&MotionEvent { &MotionEvent {
location: position.as_logical(), location: position.as_logical(),
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
); );
ptr.frame(self); ptr.frame(self);
@ -1005,7 +1005,7 @@ impl State {
button, button,
event.state(), event.state(),
serial, serial,
event.time_msec(), event.time(),
); );
} }
@ -1017,12 +1017,12 @@ impl State {
button, button,
state: event.state(), state: event.state(),
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
); );
ptr.frame(self); ptr.frame(self);
} else if event.state() == ButtonState::Released { } else if event.state() == ButtonState::Released {
ptr.unset_grab(self, serial, event.time_msec()) ptr.unset_grab(self, serial, event.time())
} }
} }
InputEvent::PointerAxis { event, .. } => { InputEvent::PointerAxis { event, .. } => {
@ -1073,7 +1073,7 @@ impl State {
self.update_zoom(&seat, change, event.source() == AxisSource::Wheel); self.update_zoom(&seat, change, event.source() == AxisSource::Wheel);
} }
} else { } else {
let mut frame = AxisFrame::new(event.time_msec()).source(event.source()); let mut frame = AxisFrame::new(event.time()).source(event.source());
let horizontal_amount = event let horizontal_amount = event
.amount(Axis::Horizontal) .amount(Axis::Horizontal)
.or_else(|| Some(event.amount_v120(Axis::Horizontal)? * 15.0 / 120.)); .or_else(|| Some(event.amount_v120(Axis::Horizontal)? * 15.0 / 120.));
@ -1142,7 +1142,7 @@ impl State {
self, self,
&GestureSwipeBeginEvent { &GestureSwipeBeginEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
fingers: event.fingers(), fingers: event.fingers(),
}, },
); );
@ -1163,7 +1163,7 @@ impl State {
if let Some(ref mut gesture_state) = self.common.gesture_state { if let Some(ref mut gesture_state) = self.common.gesture_state {
let first_update = gesture_state.update( let first_update = gesture_state.update(
event.delta(), event.delta(),
Duration::from_millis(event.time_msec() as u64), Duration::from_millis(event.time().millis() as u64),
); );
// Decide on action if first update // Decide on action if first update
if first_update { if first_update {
@ -1239,7 +1239,7 @@ impl State {
pointer.gesture_swipe_update( pointer.gesture_swipe_update(
self, self,
&GestureSwipeUpdateEvent { &GestureSwipeUpdateEvent {
time: event.time_msec(), time: event.time(),
delta: event.delta(), delta: event.delta(),
}, },
); );
@ -1288,7 +1288,7 @@ impl State {
self, self,
&GestureSwipeEndEvent { &GestureSwipeEndEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
cancelled: event.cancelled(), cancelled: event.cancelled(),
}, },
); );
@ -1311,7 +1311,7 @@ impl State {
self, self,
&GesturePinchBeginEvent { &GesturePinchBeginEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
fingers: event.fingers(), fingers: event.fingers(),
}, },
); );
@ -1331,7 +1331,7 @@ impl State {
pointer.gesture_pinch_update( pointer.gesture_pinch_update(
self, self,
&GesturePinchUpdateEvent { &GesturePinchUpdateEvent {
time: event.time_msec(), time: event.time(),
delta: event.delta(), delta: event.delta(),
scale: event.scale(), scale: event.scale(),
rotation: event.rotation(), rotation: event.rotation(),
@ -1355,7 +1355,7 @@ impl State {
self, self,
&GesturePinchEndEvent { &GesturePinchEndEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
cancelled: event.cancelled(), cancelled: event.cancelled(),
}, },
); );
@ -1377,7 +1377,7 @@ impl State {
self, self,
&GestureHoldBeginEvent { &GestureHoldBeginEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
fingers: event.fingers(), fingers: event.fingers(),
}, },
); );
@ -1399,7 +1399,7 @@ impl State {
self, self,
&GestureHoldEndEvent { &GestureHoldEndEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
cancelled: event.cancelled(), cancelled: event.cancelled(),
}, },
); );
@ -1456,7 +1456,7 @@ impl State {
slot: event.slot(), slot: event.slot(),
location: position.as_logical(), location: position.as_logical(),
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
); );
} }
@ -1505,7 +1505,7 @@ impl State {
&TouchMotionEvent { &TouchMotionEvent {
slot: event.slot(), slot: event.slot(),
location: position.as_logical(), location: position.as_logical(),
time: event.time_msec(), time: event.time(),
}, },
); );
} }
@ -1531,7 +1531,7 @@ impl State {
self, self,
&UpEvent { &UpEvent {
slot: event.slot(), slot: event.slot(),
time: event.time_msec(), time: event.time(),
serial, serial,
}, },
); );
@ -1596,7 +1596,7 @@ impl State {
&MotionEvent { &MotionEvent {
location: position.as_logical(), location: position.as_logical(),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: self.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
@ -1627,11 +1627,11 @@ impl State {
&tool::MotionEvent { &tool::MotionEvent {
location: position.as_logical(), location: position.as_logical(),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: event.time_msec(), time: event.time(),
}, },
); );
tool.frame(self, event.time_msec()); tool.frame(self, event.time());
} }
} }
} }
@ -1665,7 +1665,7 @@ impl State {
&MotionEvent { &MotionEvent {
location: position.as_logical(), location: position.as_logical(),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: self.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
@ -1706,7 +1706,7 @@ impl State {
location: position.as_logical(), location: position.as_logical(),
axis: Some(frame), axis: Some(frame),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: event.time_msec(), time: event.time(),
}, },
) )
} }
@ -1714,12 +1714,12 @@ impl State {
self, self,
&tool::ProximityOutEvent { &tool::ProximityOutEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
), ),
} }
tool.frame(self, event.time_msec()); tool.frame(self, event.time());
} }
} }
} }
@ -1742,7 +1742,7 @@ impl State {
self, self,
&tool::DownEvent { &tool::DownEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
); );
} }
@ -1751,13 +1751,13 @@ impl State {
self, self,
&tool::UpEvent { &tool::UpEvent {
serial, serial,
time: event.time_msec(), time: event.time(),
}, },
); );
} }
} }
tool.frame(self, event.time_msec()); tool.frame(self, event.time());
} }
} }
} }
@ -1779,11 +1779,11 @@ impl State {
button: event.button(), button: event.button(),
state: event.button_state(), state: event.button_state(),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: event.time_msec(), time: event.time(),
}, },
); );
tool.frame(self, event.time_msec()); tool.frame(self, event.time());
} }
} }
} }
@ -1886,7 +1886,7 @@ impl State {
let Some(pointer) = seat.get_pointer() else { let Some(pointer) = seat.get_pointer() else {
return; return;
}; };
let time = self.common.clock.now().as_millis(); let time = InputTime::now();
for button in buttons { for button in buttons {
let serial = SERIAL_COUNTER.next_serial(); let serial = SERIAL_COUNTER.next_serial();
pointer.button( pointer.button(
@ -1948,7 +1948,7 @@ impl State {
modifiers: &ModifiersState, modifiers: &ModifiersState,
handle: KeysymHandle<'_>, handle: KeysymHandle<'_>,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
keycode: Keycode, keycode: Keycode,
key_state: KeyState, key_state: KeyState,
previous_modifiers: ModifiersState, previous_modifiers: ModifiersState,
@ -2008,7 +2008,7 @@ impl State {
return; return;
}; };
let serial = SERIAL_COUNTER.next_serial(); let serial = SERIAL_COUNTER.next_serial();
let time = self.common.clock.now().as_millis(); let time = InputTime::now();
let previous_modifiers = keyboard.modifier_state(); let previous_modifiers = keyboard.modifier_state();
let result = keyboard let result = keyboard
.input_from_source( .input_from_source(
@ -2157,7 +2157,7 @@ impl State {
serial: Serial, serial: Serial,
keycode: Keycode, keycode: Keycode,
key_state: KeyState, key_state: KeyState,
time: u32, time: InputTime,
) -> FilterResult<Option<(Action, shortcuts::Binding)>> { ) -> FilterResult<Option<(Action, shortcuts::Binding)>> {
// Pre-compute for layout-agnostic shortcut matching // Pre-compute for layout-agnostic shortcut matching
let raw_syms = handle.raw_syms(); let raw_syms = handle.raw_syms();
@ -2322,7 +2322,9 @@ impl State {
&backend_id_clone, &backend_id_clone,
&seat_clone, &seat_clone,
serial, serial,
time.overflowing_add(duration as u32).0, InputTime::from_millis(
time.millis().overflowing_add(duration as u32).0,
),
key_pattern_clone.clone(), key_pattern_clone.clone(),
None, None,
); );
@ -2374,7 +2376,7 @@ impl State {
self.common.event_loop_handle.insert_idle(move |state| { self.common.event_loop_handle.insert_idle(move |state| {
if let Some(keyboard) = seat.get_keyboard() { if let Some(keyboard) = seat.get_keyboard() {
let serial = SERIAL_COUNTER.next_serial(); let serial = SERIAL_COUNTER.next_serial();
let time = state.common.clock.now().as_millis(); let time = InputTime::now();
keyboard.input( keyboard.input(
state, state,
key_code, key_code,
@ -2900,6 +2902,7 @@ impl State {
surface: &WlSurface, surface: &WlSurface,
pointer: &PointerHandle<Self>, pointer: &PointerHandle<Self>,
mut location: Point<f64, Logical>, mut location: Point<f64, Logical>,
constraint: Option<&PointerConstraint>,
) { ) {
let Some(client) = surface.client() else { let Some(client) = surface.client() else {
return; return;
@ -2924,15 +2927,13 @@ impl State {
return false; return false;
} }
with_pointer_constraint(surface, pointer, |constraint| { if let Some(constraint) = constraint
if let Some(constraint) = constraint && let Some(region) = constraint.region()
&& let Some(region) = constraint.region() {
{ let point_in_surface = (p - surface_offset.to_f64()).to_i32_floor();
let point_in_surface = (p - surface_offset.to_f64()).to_i32_floor(); return region.contains(point_in_surface);
return region.contains(point_in_surface); }
} true
true
})
}; };
let workspace_origin = output.geometry().loc.to_f64(); let workspace_origin = output.geometry().loc.to_f64();
@ -2956,14 +2957,14 @@ impl State {
let serial = SERIAL_COUNTER.next_serial(); let serial = SERIAL_COUNTER.next_serial();
let under = State::surface_under(point, &output, &self.common.shell.write()) let under = State::surface_under(point, &output, &self.common.shell.write())
.map(|(target, pos)| (target, pos.as_logical())); .map(|(target, pos)| (target, pos.as_logical()));
let time = self.common.clock.now(); let time = InputTime::now();
pointer.relative_motion( pointer.relative_motion(
self, self,
under.clone(), under.clone(),
&RelativeMotionEvent { &RelativeMotionEvent {
delta: (0., 0.).into(), delta: (0., 0.).into(),
delta_unaccel: (0., 0.).into(), delta_unaccel: (0., 0.).into(),
utime: time.as_micros(), time,
}, },
); );
pointer.motion( pointer.motion(
@ -2972,7 +2973,7 @@ impl State {
&MotionEvent { &MotionEvent {
location: point.as_logical(), location: point.as_logical(),
serial, serial,
time: time.as_millis(), time,
}, },
); );
pointer.frame(self); pointer.frame(self);

View file

@ -12,7 +12,7 @@ use id_tree::NodeId;
use smithay::{ use smithay::{
backend::{ backend::{
drm::DrmNode, drm::DrmNode,
input::KeyState, input::{InputTime, KeyState},
renderer::{ renderer::{
element::{ element::{
Element, Kind, RenderElement, UnderlyingStorage, Element, Kind, RenderElement, UnderlyingStorage,
@ -1012,7 +1012,7 @@ impl KeyboardTarget<State> for CosmicMapped {
key: KeysymHandle<'_>, key: KeysymHandle<'_>,
state: KeyState, state: KeyState,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
match &self.element { match &self.element {
CosmicMappedInternal::Stack(s) => { CosmicMappedInternal::Stack(s) => {

View file

@ -38,7 +38,7 @@ use shortcuts::action::{Direction, FocusDirection};
use smithay::{ use smithay::{
backend::{ backend::{
drm::DrmNode, drm::DrmNode,
input::KeyState, input::{InputTime, KeyState},
renderer::{ renderer::{
ImportAll, ImportMem, Renderer, ImportAll, ImportMem, Renderer,
element::{Element, Id as RendererId, Kind, RenderElement, UnderlyingStorage}, element::{Element, Id as RendererId, Kind, RenderElement, UnderlyingStorage},
@ -1557,7 +1557,7 @@ impl KeyboardTarget<State> for CosmicStack {
key: KeysymHandle<'_>, key: KeysymHandle<'_>,
state: KeyState, state: KeyState,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
let active = self.keyboard_leave_if_previous(seat, data, serial); let active = self.keyboard_leave_if_previous(seat, data, serial);
self.0.with_program(|p| { self.0.with_program(|p| {
@ -1726,7 +1726,7 @@ impl PointerTarget<State> for CosmicStack {
} }
} }
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) { fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: InputTime) {
self.0.with_program(|p| { self.0.with_program(|p| {
let mut cursor_state = seat let mut cursor_state = seat
.user_data() .user_data()

View file

@ -21,6 +21,7 @@ use std::{
use smithay::{ use smithay::{
backend::{ backend::{
drm::DrmNode, drm::DrmNode,
input::InputTime,
renderer::{ renderer::{
ImportAll, Renderer, buffer_has_alpha, ImportAll, Renderer, buffer_has_alpha,
element::{Kind, RenderElementStates, surface::KindEvaluation}, element::{Kind, RenderElementStates, surface::KindEvaluation},
@ -1084,7 +1085,7 @@ impl KeyboardTarget<State> for CosmicSurface {
key: KeysymHandle<'_>, key: KeysymHandle<'_>,
state: smithay::backend::input::KeyState, state: smithay::backend::input::KeyState,
serial: smithay::utils::Serial, serial: smithay::utils::Serial,
time: u32, time: InputTime,
) { ) {
match self.0.underlying_surface() { match self.0.underlying_surface() {
WindowSurface::Wayland(toplevel) => { WindowSurface::Wayland(toplevel) => {

View file

@ -21,7 +21,7 @@ use cosmic_comp_config::AppearanceConfig;
use smithay::{ use smithay::{
backend::{ backend::{
drm::DrmNode, drm::DrmNode,
input::KeyState, input::{InputTime, KeyState},
renderer::{ renderer::{
ImportAll, ImportMem, Renderer, ImportAll, ImportMem, Renderer,
element::{Element, Id as RendererId, Kind, RenderElement, UnderlyingStorage}, element::{Element, Id as RendererId, Kind, RenderElement, UnderlyingStorage},
@ -985,7 +985,7 @@ impl KeyboardTarget<State> for CosmicWindow {
key: KeysymHandle<'_>, key: KeysymHandle<'_>,
state: KeyState, state: KeyState,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
self.0 self.0
.with_program(|p| KeyboardTarget::key(&p.window, seat, data, key, state, serial, time)) .with_program(|p| KeyboardTarget::key(&p.window, seat, data, key, state, serial, time))
@ -1124,7 +1124,7 @@ impl PointerTarget<State> for CosmicWindow {
} }
} }
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) { fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: InputTime) {
self.0.with_program(|p| { self.0.with_program(|p| {
let cursor_state = seat.user_data().get::<CursorState>().unwrap(); let cursor_state = seat.user_data().get::<CursorState>().unwrap();
cursor_state.lock().unwrap().unset_shape(); cursor_state.lock().unwrap().unset_shape();

View file

@ -6,6 +6,7 @@ use crate::{
}; };
use indexmap::IndexSet; use indexmap::IndexSet;
use smithay::{ use smithay::{
backend::input::InputTime,
desktop::{PopupUngrabStrategy, layer_map_for_output}, desktop::{PopupUngrabStrategy, layer_map_for_output},
input::{Seat, pointer::MotionEvent}, input::{Seat, pointer::MotionEvent},
output::Output, output::Output,
@ -419,7 +420,7 @@ fn update_focus_state(
&MotionEvent { &MotionEvent {
location: new_pos.as_logical(), location: new_pos.as_logical(),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: 0, time: InputTime::now(),
}, },
); );
} }
@ -768,7 +769,7 @@ fn update_pointer_focus(state: &mut State, seat: &Seat<State>) {
&MotionEvent { &MotionEvent {
location: pointer.current_location(), location: pointer.current_location(),
serial: SERIAL_COUNTER.next_serial(), serial: SERIAL_COUNTER.next_serial(),
time: state.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
} }

View file

@ -16,7 +16,7 @@ use crate::{
}; };
use id_tree::NodeId; use id_tree::NodeId;
use smithay::{ use smithay::{
backend::input::KeyState, backend::input::{InputTime, KeyState},
desktop::{LayerSurface, PopupKind, WindowSurface, WindowSurfaceType, space::SpaceElement}, desktop::{LayerSurface, PopupKind, WindowSurface, WindowSurfaceType, space::SpaceElement},
input::{ input::{
Seat, Seat,
@ -272,9 +272,10 @@ impl PointerFocusTarget {
None None
}; };
let cursor_hotspot = if let Some(CursorGeometry { hotspot, .. }) = let cursor_hotspot = if let Some(CursorGeometry { hotspot, .. }) = seat.cursor_geometry(
seat.cursor_geometry((0.0, 0.0), Duration::from_millis(event.time as u64).into()) (0.0, 0.0),
{ Duration::from_millis(event.time.millis() as u64).into(),
) {
hotspot hotspot
} else { } else {
Point::from((0, 0)) Point::from((0, 0))
@ -417,7 +418,7 @@ impl PointerTarget<State> for PointerFocusTarget {
fn frame(&self, seat: &Seat<State>, data: &mut State) { fn frame(&self, seat: &Seat<State>, data: &mut State) {
self.inner_pointer_target().frame(seat, data); self.inner_pointer_target().frame(seat, data);
} }
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) { fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: InputTime) {
let toplevel = self.toplevel(&data.common.shell.read()); let toplevel = self.toplevel(&data.common.shell.read());
if let Some(element) = toplevel { if let Some(element) = toplevel {
for session in element.cursor_sessions() { for session in element.cursor_sessions() {
@ -593,7 +594,7 @@ impl DndFocus<State> for PointerFocusTarget {
offer: Option<&mut CosmicOfferData<S>>, offer: Option<&mut CosmicOfferData<S>>,
seat: &Seat<State>, seat: &Seat<State>,
location: Point<f64, Logical>, location: Point<f64, Logical>,
time: u32, time: InputTime,
) { ) {
match self { match self {
PointerFocusTarget::WlSurface { surface, .. } => { PointerFocusTarget::WlSurface { surface, .. } => {
@ -695,7 +696,7 @@ impl KeyboardTarget<State> for KeyboardFocusTarget {
key: KeysymHandle<'_>, key: KeysymHandle<'_>,
state: KeyState, state: KeyState,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
if let Some(inner) = self.inner_keyboard_target() { if let Some(inner) = self.inner_keyboard_target() {
inner.key(seat, data, key, state, serial, time); inner.key(seat, data, key, state, serial, time);

View file

@ -1,7 +1,8 @@
use cosmic_settings_config::shortcuts::Action; use cosmic_settings_config::shortcuts::Action;
use smithay::{ use smithay::{
input::pointer::MotionEvent, reexports::wayland_server::protocol::wl_surface::WlSurface, backend::input::InputTime, input::pointer::MotionEvent,
utils::SERIAL_COUNTER, wayland::seat::WaylandFocus, reexports::wayland_server::protocol::wl_surface::WlSurface, utils::SERIAL_COUNTER,
wayland::seat::WaylandFocus,
}; };
use crate::{ use crate::{
@ -398,7 +399,7 @@ pub fn window_items(
&MotionEvent { &MotionEvent {
location: loc.as_logical().to_f64(), location: loc.as_logical().to_f64(),
serial, serial,
time: state.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
pointer.frame(state); pointer.frame(state);
@ -433,7 +434,7 @@ pub fn window_items(
&MotionEvent { &MotionEvent {
location: loc.as_logical().to_f64(), location: loc.as_logical().to_f64(),
serial, serial,
time: state.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
pointer.frame(state); pointer.frame(state);
@ -468,7 +469,7 @@ pub fn window_items(
&MotionEvent { &MotionEvent {
location: loc.as_logical().to_f64(), location: loc.as_logical().to_f64(),
serial, serial,
time: state.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
pointer.frame(state); pointer.frame(state);
@ -503,7 +504,7 @@ pub fn window_items(
&MotionEvent { &MotionEvent {
location: loc.as_logical().to_f64(), location: loc.as_logical().to_f64(),
serial, serial,
time: state.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
pointer.frame(state); pointer.frame(state);

View file

@ -20,7 +20,7 @@ use smallvec::SmallVec;
use smithay::{ use smithay::{
backend::{ backend::{
drm::DrmNode, drm::DrmNode,
input::ButtonState, input::{ButtonState, InputTime},
renderer::{ renderer::{
ImportAll, ImportMem, ImportAll, ImportMem,
element::{RenderElement, utils::RescaleRenderElement}, element::{RenderElement, utils::RescaleRenderElement},
@ -956,7 +956,7 @@ impl Drop for MoveGrab {
&MotionEvent { &MotionEvent {
location: pointer.current_location(), location: pointer.current_location(),
serial, serial,
time: state.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
} }

View file

@ -11,7 +11,7 @@ use crate::{
}; };
use id_tree::{NodeId, Tree}; use id_tree::{NodeId, Tree};
use smithay::{ use smithay::{
backend::input::ButtonState, backend::input::{ButtonState, InputTime},
input::{ input::{
Seat, Seat,
pointer::{ pointer::{
@ -65,7 +65,7 @@ impl PointerTarget<State> for ResizeForkTarget {
seat: &Seat<State>, seat: &Seat<State>,
_data: &mut State, _data: &mut State,
_serial: smithay::utils::Serial, _serial: smithay::utils::Serial,
_time: u32, _time: InputTime,
) { ) {
let user_data = seat.user_data(); let user_data = seat.user_data();
let cursor_state = user_data.get::<CursorState>().unwrap(); let cursor_state = user_data.get::<CursorState>().unwrap();

View file

@ -1,6 +1,6 @@
use cosmic_settings_config::shortcuts; use cosmic_settings_config::shortcuts;
use smithay::{ use smithay::{
backend::input::{KeyState, Keycode}, backend::input::{InputTime, KeyState, Keycode},
input::{ input::{
Seat, SeatHandler, Seat, SeatHandler,
keyboard::{ keyboard::{
@ -38,7 +38,7 @@ impl KeyboardGrab<State> for SwapWindowGrab {
state: KeyState, state: KeyState,
modifiers: Option<ModifiersState>, modifiers: Option<ModifiersState>,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
if !matches!(&data.common.shell.read().overview_mode.active_trigger(), Some(Trigger::KeyboardSwap(_, d)) if d == &self.desc) if !matches!(&data.common.shell.read().overview_mode.active_trigger(), Some(Trigger::KeyboardSwap(_, d)) if d == &self.desc)
{ {

View file

@ -11,7 +11,7 @@ use cosmic_comp_config::{ZoomConfig, ZoomMovement};
use cosmic_config::ConfigSet; use cosmic_config::ConfigSet;
use keyframe::{ease, functions::Linear}; use keyframe::{ease, functions::Linear};
use smithay::{ use smithay::{
backend::renderer::ImportMem, backend::{input::InputTime, renderer::ImportMem},
desktop::space::SpaceElement, desktop::space::SpaceElement,
input::{ input::{
Seat, Seat,
@ -1023,7 +1023,7 @@ impl PointerTarget<State> for ZoomFocusTarget {
} }
} }
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) { fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: InputTime) {
match self { match self {
ZoomFocusTarget::Main(elem) => PointerTarget::leave(elem, seat, data, serial, time), ZoomFocusTarget::Main(elem) => PointerTarget::leave(elem, seat, data, serial, time),
ZoomFocusTarget::Menu(elem) => PointerTarget::leave(elem, seat, data, serial, time), ZoomFocusTarget::Menu(elem) => PointerTarget::leave(elem, seat, data, serial, time),

View file

@ -31,7 +31,7 @@ use ordered_float::OrderedFloat;
use smithay::{ use smithay::{
backend::{ backend::{
allocator::Fourcc, allocator::Fourcc,
input::{ButtonState, KeyState}, input::{ButtonState, InputTime, KeyState},
renderer::{ renderer::{
ImportMem, ImportMem,
element::{ element::{
@ -581,7 +581,7 @@ impl<P: Program + Send + 'static> PointerTarget<crate::state::State> for IcedEle
_seat: &Seat<crate::state::State>, _seat: &Seat<crate::state::State>,
_data: &mut crate::state::State, _data: &mut crate::state::State,
_serial: Serial, _serial: Serial,
_time: u32, _time: InputTime,
) { ) {
let mut internal = self.0.lock().unwrap(); let mut internal = self.0.lock().unwrap();
internal internal
@ -784,7 +784,7 @@ impl<P: Program + Send + 'static> KeyboardTarget<crate::state::State> for IcedEl
_key: KeysymHandle<'_>, _key: KeysymHandle<'_>,
_state: KeyState, _state: KeyState,
_serial: Serial, _serial: Serial,
_time: u32, _time: InputTime,
) { ) {
// TODO convert keys // TODO convert keys
} }

View file

@ -3,9 +3,12 @@
use crate::{shell::grabs::SeatMoveGrabState, state::ClientState, utils::prelude::*}; use crate::{shell::grabs::SeatMoveGrabState, state::ClientState, utils::prelude::*};
use calloop::Interest; use calloop::Interest;
use smithay::{ use smithay::{
backend::renderer::{ backend::{
element::{Kind, surface::KindEvaluation}, input::InputTime,
utils::{on_commit_buffer_handler, with_renderer_surface_state}, renderer::{
element::{Kind, surface::KindEvaluation},
utils::{on_commit_buffer_handler, with_renderer_surface_state},
},
}, },
desktop::{LayerSurface, PopupKind, WindowSurfaceType, layer_map_for_output}, desktop::{LayerSurface, PopupKind, WindowSurfaceType, layer_map_for_output},
reexports::wayland_server::{Client, Resource, protocol::wl_surface::WlSurface}, reexports::wayland_server::{Client, Resource, protocol::wl_surface::WlSurface},
@ -325,9 +328,11 @@ impl CompositorHandler for State {
} }
} else { } else {
std::mem::drop(shell); std::mem::drop(shell);
seat.get_pointer() seat.get_pointer().unwrap().unset_grab(
.unwrap() self,
.unset_grab(self, SERIAL_COUNTER.next_serial(), 0); SERIAL_COUNTER.next_serial(),
InputTime::now(),
);
return; return;
} }
} }

View file

@ -5,7 +5,10 @@ use smithay::{
input::pointer::PointerHandle, input::pointer::PointerHandle,
reexports::wayland_server::protocol::wl_surface::WlSurface, reexports::wayland_server::protocol::wl_surface::WlSurface,
utils::{Logical, Point}, utils::{Logical, Point},
wayland::{pointer_constraints::PointerConstraintsHandler, seat::WaylandFocus}, wayland::{
pointer_constraints::{ConstraintRemove, PointerConstraintsHandler},
seat::WaylandFocus,
},
}; };
pub use smithay::wayland::pointer_constraints::{PointerConstraintRef, with_pointer_constraint}; pub use smithay::wayland::pointer_constraints::{PointerConstraintRef, with_pointer_constraint};
@ -76,23 +79,38 @@ impl PointerConstraintsHandler for State {
} }
} }
fn remove_constraint(&mut self, surface: &WlSurface, pointer: &PointerHandle<Self>) { fn remove_constraint(
if with_pointer_constraint(surface, pointer, |constraint| constraint.is_none()) { &mut self,
let seat = self surface: &WlSurface,
.common pointer: &PointerHandle<Self>,
.shell constraint_remove: ConstraintRemove,
.read() ) {
.seats match constraint_remove {
.iter() ConstraintRemove::PointerLeave(_) => {
.find(|s| s.get_pointer().as_ref() == Some(pointer)) // If the constraint was broken by the pointer forcibly leaving the surface, then it doesn't
.cloned(); // make much sense to warp it.
return;
}
ConstraintRemove::Destroyed(constraint) => {
let Some(seat) = self
.common
.shell
.read()
.seats
.iter()
.find(|s| s.get_pointer().as_ref() == Some(pointer))
.cloned()
else {
return;
};
let Some((hint_surface, hint_location)) = seat.pointer_constraint_hint() else {
return;
};
if let Some(seat) = seat if hint_surface == *surface {
&& let Some((hint_surface, hint_location)) = seat.pointer_constraint_hint() self.apply_cursor_hint(surface, pointer, hint_location, Some(&constraint));
&& hint_surface == *surface seat.set_pointer_constraint_hint(None);
{ }
self.apply_cursor_hint(surface, pointer, hint_location);
seat.set_pointer_constraint_hint(None);
} }
} }
} }

View file

@ -38,7 +38,7 @@ impl PointerWarpHandler for State {
drop(shell); drop(shell);
if let Some(pointer_handle) = pointer_handle { if let Some(pointer_handle) = pointer_handle {
self.apply_cursor_hint(&surface, &pointer_handle, pos); self.apply_cursor_hint(&surface, &pointer_handle, pos, None);
} }
} }
} }

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
use smithay::{ use smithay::{
backend::input::InputTime,
desktop::{WindowSurfaceType, layer_map_for_output}, desktop::{WindowSurfaceType, layer_map_for_output},
input::{Seat, pointer::MotionEvent}, input::{Seat, pointer::MotionEvent},
output::Output, output::Output,
@ -124,7 +125,7 @@ impl ToplevelManagementHandler for State {
&MotionEvent { &MotionEvent {
location: new_pos.to_f64().as_logical(), location: new_pos.to_f64().as_logical(),
serial, serial,
time: self.common.clock.now().as_millis(), time: InputTime::now(),
}, },
); );
ptr.frame(self); ptr.frame(self);

View file

@ -20,7 +20,7 @@ use smithay::{
backend::{ backend::{
allocator::Fourcc, allocator::Fourcc,
drm::DrmNode, drm::DrmNode,
input::{ButtonState, KeyState, Keycode}, input::{ButtonState, InputTime, KeyState, Keycode},
renderer::{ renderer::{
Bind, Frame, Offscreen, Renderer, Bind, Frame, Offscreen, Renderer,
element::{ element::{
@ -396,7 +396,7 @@ impl Common {
state: KeyState, state: KeyState,
modifiers: ModifiersState, modifiers: ModifiersState,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
let config = self.config.cosmic_conf.xwayland_eavesdropping.keyboard; let config = self.config.cosmic_conf.xwayland_eavesdropping.keyboard;
if config == EavesdroppingKeyboardMode::None { if config == EavesdroppingKeyboardMode::None {
@ -458,7 +458,7 @@ impl Common {
tracing::trace!("Forwaring key {} {:?} to xwayland", code.raw() - 8, state); tracing::trace!("Forwaring key {} {:?} to xwayland", code.raw() - 8, state);
for wl_keyboard in keyboard.client_keyboards(&xstate.client) { for wl_keyboard in keyboard.client_keyboards(&xstate.client) {
wl_keyboard.key(serial.into(), time, code.raw() - 8, state.into()); wl_keyboard.key(serial.into(), time.millis(), code.raw() - 8, state.into());
if xstate.last_modifier_state != Some(modifiers) { if xstate.last_modifier_state != Some(modifiers) {
xstate.last_modifier_state = Some(modifiers); xstate.last_modifier_state = Some(modifiers);
wl_keyboard.modifiers( wl_keyboard.modifiers(
@ -478,7 +478,7 @@ impl Common {
button: u32, button: u32,
state: ButtonState, state: ButtonState,
serial: Serial, serial: Serial,
time: u32, time: InputTime,
) { ) {
if !self.config.cosmic_conf.xwayland_eavesdropping.pointer { if !self.config.cosmic_conf.xwayland_eavesdropping.pointer {
return; return;
@ -518,7 +518,7 @@ impl Common {
tracing::trace!("Forwaring ptr button {} {:?} to Xwayland", button, state); tracing::trace!("Forwaring ptr button {} {:?} to Xwayland", button, state);
for wl_pointer in pointer.client_pointers(&xstate.client) { for wl_pointer in pointer.client_pointers(&xstate.client) {
wl_pointer.button(serial.into(), time, button, state.into()); wl_pointer.button(serial.into(), time.millis(), button, state.into());
} }
} }