chore: update smithay
This commit is contained in:
parent
31827ed240
commit
5c93094574
22 changed files with 168 additions and 165 deletions
53
Cargo.lock
generated
53
Cargo.lock
generated
|
|
@ -1189,7 +1189,7 @@ dependencies = [
|
|||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1503,7 +1503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2690,7 +2690,7 @@ dependencies = [
|
|||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"serde_core",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2813,7 +2813,7 @@ version = "1.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3429,7 +3429,7 @@ version = "0.50.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4167,20 +4167,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_chacha",
|
||||
"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]]
|
||||
name = "rand"
|
||||
version = "0.10.0"
|
||||
|
|
@ -4202,16 +4192,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
|
|
@ -4221,15 +4201,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "rand_core"
|
||||
version = "0.10.0"
|
||||
|
|
@ -4525,7 +4496,7 @@ dependencies = [
|
|||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.12.1",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4820,7 +4791,7 @@ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
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 = [
|
||||
"aliasable",
|
||||
"appendlist",
|
||||
|
|
@ -4849,7 +4820,7 @@ dependencies = [
|
|||
"pkg-config",
|
||||
"portable-atomic",
|
||||
"profiling",
|
||||
"rand 0.9.2",
|
||||
"rand 0.10.0",
|
||||
"reis",
|
||||
"rustix 1.1.4",
|
||||
"scopeguard",
|
||||
|
|
@ -5115,7 +5086,7 @@ dependencies = [
|
|||
"getrandom 0.4.1",
|
||||
"once_cell",
|
||||
"rustix 1.1.4",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -5414,7 +5385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6134,7 +6105,7 @@ version = "0.1.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -146,4 +146,4 @@ lto = "fat"
|
|||
cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }
|
||||
|
||||
[patch.crates-io]
|
||||
smithay = { git = "https://github.com/smithay/smithay.git", rev = "5fb12b8" }
|
||||
smithay = { git = "https://github.com/smithay/smithay.git", rev = "e3d461a" }
|
||||
|
|
|
|||
|
|
@ -14,8 +14,11 @@ use cosmic_config::{ConfigGet, CosmicConfigEntry};
|
|||
use cosmic_settings_config::window_rules::ApplicationException;
|
||||
use cosmic_settings_config::{Shortcuts, shortcuts, window_rules};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smithay::utils::{Clock, Monotonic};
|
||||
use smithay::wayland::xdg_activation::XdgActivationState;
|
||||
use smithay::{
|
||||
backend::input::InputTime,
|
||||
utils::{Clock, Monotonic},
|
||||
};
|
||||
pub use smithay::{
|
||||
backend::input::{self as smithay_input, KeyState},
|
||||
input::keyboard::{Keysym, ModifiersState, keysyms as KeySyms},
|
||||
|
|
@ -770,13 +773,12 @@ pub fn change_modifier_state(
|
|||
const X11_KEYCODE_OFFSET: u32 = 8;
|
||||
|
||||
let mut input = |key_state, scan_code| {
|
||||
let time = state.common.clock.now().as_millis();
|
||||
let _ = keyboard.input(
|
||||
state,
|
||||
smithay_input::Keycode::new(scan_code + X11_KEYCODE_OFFSET),
|
||||
key_state,
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
time,
|
||||
InputTime::now(),
|
||||
|_, _, _| smithay::input::keyboard::FilterResult::<()>::Forward,
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use cosmic_config::ConfigSet;
|
|||
use cosmic_settings_config::shortcuts;
|
||||
use cosmic_settings_config::shortcuts::action::{Direction, FocusDirection};
|
||||
use smithay::{
|
||||
backend::input::InputTime,
|
||||
input::{Seat, pointer::MotionEvent},
|
||||
utils::{Point, Serial},
|
||||
};
|
||||
|
|
@ -45,7 +46,7 @@ impl State {
|
|||
backend_id: &InputBackendId,
|
||||
seat: &Seat<State>,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
pattern: shortcuts::Binding,
|
||||
direction: Option<Direction>,
|
||||
) {
|
||||
|
|
@ -150,7 +151,7 @@ impl State {
|
|||
backend_id: &InputBackendId,
|
||||
seat: &Seat<State>,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
pattern: shortcuts::Binding,
|
||||
direction: Option<Direction>,
|
||||
propagate: bool,
|
||||
|
|
|
|||
107
src/input/mod.rs
107
src/input/mod.rs
|
|
@ -42,9 +42,9 @@ use smithay::{
|
|||
backend::input::{
|
||||
AbsolutePositionEvent, Axis, AxisRelativeDirection, AxisSource, Device, DeviceCapability,
|
||||
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _,
|
||||
GestureSwipeUpdateEvent as _, InputBackend, InputEvent, KeyState, PointerAxisEvent,
|
||||
ProximityState, TabletToolButtonEvent, TabletToolEvent, TabletToolProximityEvent,
|
||||
TabletToolTipEvent, TabletToolTipState, TouchEvent,
|
||||
GestureSwipeUpdateEvent as _, InputBackend, InputEvent, InputTime, KeyState,
|
||||
PointerAxisEvent, ProximityState, TabletToolButtonEvent, TabletToolEvent,
|
||||
TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState, TouchEvent,
|
||||
},
|
||||
desktop::{PopupKeyboardGrab, WindowSurfaceType, utils::under_from_surface_tree},
|
||||
input::{
|
||||
|
|
@ -271,7 +271,7 @@ impl State {
|
|||
trace!(?keycode, ?state, "key");
|
||||
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
let time = Event::time_msec(&event);
|
||||
let time = Event::time(&event);
|
||||
let keyboard = seat.get_keyboard().unwrap();
|
||||
let previous_modifiers = keyboard.modifier_state();
|
||||
if let Some((action, pattern)) = keyboard
|
||||
|
|
@ -397,7 +397,7 @@ impl State {
|
|||
&RelativeMotionEvent {
|
||||
delta: event.delta(),
|
||||
delta_unaccel: event.delta_unaccel(),
|
||||
utime: event.time(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -638,7 +638,7 @@ impl State {
|
|||
&MotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
ptr.frame(self);
|
||||
|
|
@ -753,7 +753,7 @@ impl State {
|
|||
&MotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
ptr.frame(self);
|
||||
|
|
@ -1005,7 +1005,7 @@ impl State {
|
|||
button,
|
||||
event.state(),
|
||||
serial,
|
||||
event.time_msec(),
|
||||
event.time(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1017,12 +1017,12 @@ impl State {
|
|||
button,
|
||||
state: event.state(),
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
ptr.frame(self);
|
||||
} else if event.state() == ButtonState::Released {
|
||||
ptr.unset_grab(self, serial, event.time_msec())
|
||||
ptr.unset_grab(self, serial, event.time())
|
||||
}
|
||||
}
|
||||
InputEvent::PointerAxis { event, .. } => {
|
||||
|
|
@ -1073,7 +1073,7 @@ impl State {
|
|||
self.update_zoom(&seat, change, event.source() == AxisSource::Wheel);
|
||||
}
|
||||
} 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
|
||||
.amount(Axis::Horizontal)
|
||||
.or_else(|| Some(event.amount_v120(Axis::Horizontal)? * 15.0 / 120.));
|
||||
|
|
@ -1142,7 +1142,7 @@ impl State {
|
|||
self,
|
||||
&GestureSwipeBeginEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
fingers: event.fingers(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1163,7 +1163,7 @@ impl State {
|
|||
if let Some(ref mut gesture_state) = self.common.gesture_state {
|
||||
let first_update = gesture_state.update(
|
||||
event.delta(),
|
||||
Duration::from_millis(event.time_msec() as u64),
|
||||
Duration::from_millis(event.time().millis() as u64),
|
||||
);
|
||||
// Decide on action if first update
|
||||
if first_update {
|
||||
|
|
@ -1239,7 +1239,7 @@ impl State {
|
|||
pointer.gesture_swipe_update(
|
||||
self,
|
||||
&GestureSwipeUpdateEvent {
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
delta: event.delta(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1288,7 +1288,7 @@ impl State {
|
|||
self,
|
||||
&GestureSwipeEndEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
cancelled: event.cancelled(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1311,7 +1311,7 @@ impl State {
|
|||
self,
|
||||
&GesturePinchBeginEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
fingers: event.fingers(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1331,7 +1331,7 @@ impl State {
|
|||
pointer.gesture_pinch_update(
|
||||
self,
|
||||
&GesturePinchUpdateEvent {
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
delta: event.delta(),
|
||||
scale: event.scale(),
|
||||
rotation: event.rotation(),
|
||||
|
|
@ -1355,7 +1355,7 @@ impl State {
|
|||
self,
|
||||
&GesturePinchEndEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
cancelled: event.cancelled(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1377,7 +1377,7 @@ impl State {
|
|||
self,
|
||||
&GestureHoldBeginEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
fingers: event.fingers(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1399,7 +1399,7 @@ impl State {
|
|||
self,
|
||||
&GestureHoldEndEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
cancelled: event.cancelled(),
|
||||
},
|
||||
);
|
||||
|
|
@ -1456,7 +1456,7 @@ impl State {
|
|||
slot: event.slot(),
|
||||
location: position.as_logical(),
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -1505,7 +1505,7 @@ impl State {
|
|||
&TouchMotionEvent {
|
||||
slot: event.slot(),
|
||||
location: position.as_logical(),
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -1531,7 +1531,7 @@ impl State {
|
|||
self,
|
||||
&UpEvent {
|
||||
slot: event.slot(),
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
serial,
|
||||
},
|
||||
);
|
||||
|
|
@ -1596,7 +1596,7 @@ impl State {
|
|||
&MotionEvent {
|
||||
location: position.as_logical(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: self.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -1627,11 +1627,11 @@ impl State {
|
|||
&tool::MotionEvent {
|
||||
location: position.as_logical(),
|
||||
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 {
|
||||
location: position.as_logical(),
|
||||
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(),
|
||||
axis: Some(frame),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -1714,12 +1714,12 @@ impl State {
|
|||
self,
|
||||
&tool::ProximityOutEvent {
|
||||
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,
|
||||
&tool::DownEvent {
|
||||
serial,
|
||||
time: event.time_msec(),
|
||||
time: event.time(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -1751,13 +1751,13 @@ impl State {
|
|||
self,
|
||||
&tool::UpEvent {
|
||||
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(),
|
||||
state: event.button_state(),
|
||||
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 {
|
||||
return;
|
||||
};
|
||||
let time = self.common.clock.now().as_millis();
|
||||
let time = InputTime::now();
|
||||
for button in buttons {
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
pointer.button(
|
||||
|
|
@ -1948,7 +1948,7 @@ impl State {
|
|||
modifiers: &ModifiersState,
|
||||
handle: KeysymHandle<'_>,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
keycode: Keycode,
|
||||
key_state: KeyState,
|
||||
previous_modifiers: ModifiersState,
|
||||
|
|
@ -2008,7 +2008,7 @@ impl State {
|
|||
return;
|
||||
};
|
||||
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 result = keyboard
|
||||
.input_from_source(
|
||||
|
|
@ -2157,7 +2157,7 @@ impl State {
|
|||
serial: Serial,
|
||||
keycode: Keycode,
|
||||
key_state: KeyState,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) -> FilterResult<Option<(Action, shortcuts::Binding)>> {
|
||||
// Pre-compute for layout-agnostic shortcut matching
|
||||
let raw_syms = handle.raw_syms();
|
||||
|
|
@ -2322,7 +2322,9 @@ impl State {
|
|||
&backend_id_clone,
|
||||
&seat_clone,
|
||||
serial,
|
||||
time.overflowing_add(duration as u32).0,
|
||||
InputTime::from_millis(
|
||||
time.millis().overflowing_add(duration as u32).0,
|
||||
),
|
||||
key_pattern_clone.clone(),
|
||||
None,
|
||||
);
|
||||
|
|
@ -2374,7 +2376,7 @@ impl State {
|
|||
self.common.event_loop_handle.insert_idle(move |state| {
|
||||
if let Some(keyboard) = seat.get_keyboard() {
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
let time = state.common.clock.now().as_millis();
|
||||
let time = InputTime::now();
|
||||
keyboard.input(
|
||||
state,
|
||||
key_code,
|
||||
|
|
@ -2900,6 +2902,7 @@ impl State {
|
|||
surface: &WlSurface,
|
||||
pointer: &PointerHandle<Self>,
|
||||
mut location: Point<f64, Logical>,
|
||||
constraint: Option<&PointerConstraint>,
|
||||
) {
|
||||
let Some(client) = surface.client() else {
|
||||
return;
|
||||
|
|
@ -2924,15 +2927,13 @@ impl State {
|
|||
return false;
|
||||
}
|
||||
|
||||
with_pointer_constraint(surface, pointer, |constraint| {
|
||||
if let Some(constraint) = constraint
|
||||
&& let Some(region) = constraint.region()
|
||||
{
|
||||
let point_in_surface = (p - surface_offset.to_f64()).to_i32_floor();
|
||||
return region.contains(point_in_surface);
|
||||
}
|
||||
true
|
||||
})
|
||||
if let Some(constraint) = constraint
|
||||
&& let Some(region) = constraint.region()
|
||||
{
|
||||
let point_in_surface = (p - surface_offset.to_f64()).to_i32_floor();
|
||||
return region.contains(point_in_surface);
|
||||
}
|
||||
true
|
||||
};
|
||||
|
||||
let workspace_origin = output.geometry().loc.to_f64();
|
||||
|
|
@ -2956,14 +2957,14 @@ impl State {
|
|||
let serial = SERIAL_COUNTER.next_serial();
|
||||
let under = State::surface_under(point, &output, &self.common.shell.write())
|
||||
.map(|(target, pos)| (target, pos.as_logical()));
|
||||
let time = self.common.clock.now();
|
||||
let time = InputTime::now();
|
||||
pointer.relative_motion(
|
||||
self,
|
||||
under.clone(),
|
||||
&RelativeMotionEvent {
|
||||
delta: (0., 0.).into(),
|
||||
delta_unaccel: (0., 0.).into(),
|
||||
utime: time.as_micros(),
|
||||
time,
|
||||
},
|
||||
);
|
||||
pointer.motion(
|
||||
|
|
@ -2972,7 +2973,7 @@ impl State {
|
|||
&MotionEvent {
|
||||
location: point.as_logical(),
|
||||
serial,
|
||||
time: time.as_millis(),
|
||||
time,
|
||||
},
|
||||
);
|
||||
pointer.frame(self);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use id_tree::NodeId;
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::DrmNode,
|
||||
input::KeyState,
|
||||
input::{InputTime, KeyState},
|
||||
renderer::{
|
||||
element::{
|
||||
Element, Kind, RenderElement, UnderlyingStorage,
|
||||
|
|
@ -1012,7 +1012,7 @@ impl KeyboardTarget<State> for CosmicMapped {
|
|||
key: KeysymHandle<'_>,
|
||||
state: KeyState,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
match &self.element {
|
||||
CosmicMappedInternal::Stack(s) => {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ use shortcuts::action::{Direction, FocusDirection};
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::DrmNode,
|
||||
input::KeyState,
|
||||
input::{InputTime, KeyState},
|
||||
renderer::{
|
||||
ImportAll, ImportMem, Renderer,
|
||||
element::{Element, Id as RendererId, Kind, RenderElement, UnderlyingStorage},
|
||||
|
|
@ -1557,7 +1557,7 @@ impl KeyboardTarget<State> for CosmicStack {
|
|||
key: KeysymHandle<'_>,
|
||||
state: KeyState,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
let active = self.keyboard_leave_if_previous(seat, data, serial);
|
||||
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| {
|
||||
let mut cursor_state = seat
|
||||
.user_data()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use std::{
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::DrmNode,
|
||||
input::InputTime,
|
||||
renderer::{
|
||||
ImportAll, Renderer, buffer_has_alpha,
|
||||
element::{Kind, RenderElementStates, surface::KindEvaluation},
|
||||
|
|
@ -1084,7 +1085,7 @@ impl KeyboardTarget<State> for CosmicSurface {
|
|||
key: KeysymHandle<'_>,
|
||||
state: smithay::backend::input::KeyState,
|
||||
serial: smithay::utils::Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
match self.0.underlying_surface() {
|
||||
WindowSurface::Wayland(toplevel) => {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use cosmic_comp_config::AppearanceConfig;
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::DrmNode,
|
||||
input::KeyState,
|
||||
input::{InputTime, KeyState},
|
||||
renderer::{
|
||||
ImportAll, ImportMem, Renderer,
|
||||
element::{Element, Id as RendererId, Kind, RenderElement, UnderlyingStorage},
|
||||
|
|
@ -985,7 +985,7 @@ impl KeyboardTarget<State> for CosmicWindow {
|
|||
key: KeysymHandle<'_>,
|
||||
state: KeyState,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
self.0
|
||||
.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| {
|
||||
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||
cursor_state.lock().unwrap().unset_shape();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use crate::{
|
|||
};
|
||||
use indexmap::IndexSet;
|
||||
use smithay::{
|
||||
backend::input::InputTime,
|
||||
desktop::{PopupUngrabStrategy, layer_map_for_output},
|
||||
input::{Seat, pointer::MotionEvent},
|
||||
output::Output,
|
||||
|
|
@ -419,7 +420,7 @@ fn update_focus_state(
|
|||
&MotionEvent {
|
||||
location: new_pos.as_logical(),
|
||||
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 {
|
||||
location: pointer.current_location(),
|
||||
serial: SERIAL_COUNTER.next_serial(),
|
||||
time: state.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use crate::{
|
|||
};
|
||||
use id_tree::NodeId;
|
||||
use smithay::{
|
||||
backend::input::KeyState,
|
||||
backend::input::{InputTime, KeyState},
|
||||
desktop::{LayerSurface, PopupKind, WindowSurface, WindowSurfaceType, space::SpaceElement},
|
||||
input::{
|
||||
Seat,
|
||||
|
|
@ -272,9 +272,10 @@ impl PointerFocusTarget {
|
|||
None
|
||||
};
|
||||
|
||||
let cursor_hotspot = if let Some(CursorGeometry { hotspot, .. }) =
|
||||
seat.cursor_geometry((0.0, 0.0), Duration::from_millis(event.time as u64).into())
|
||||
{
|
||||
let cursor_hotspot = if let Some(CursorGeometry { hotspot, .. }) = seat.cursor_geometry(
|
||||
(0.0, 0.0),
|
||||
Duration::from_millis(event.time.millis() as u64).into(),
|
||||
) {
|
||||
hotspot
|
||||
} else {
|
||||
Point::from((0, 0))
|
||||
|
|
@ -417,7 +418,7 @@ impl PointerTarget<State> for PointerFocusTarget {
|
|||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||
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());
|
||||
if let Some(element) = toplevel {
|
||||
for session in element.cursor_sessions() {
|
||||
|
|
@ -593,7 +594,7 @@ impl DndFocus<State> for PointerFocusTarget {
|
|||
offer: Option<&mut CosmicOfferData<S>>,
|
||||
seat: &Seat<State>,
|
||||
location: Point<f64, Logical>,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
match self {
|
||||
PointerFocusTarget::WlSurface { surface, .. } => {
|
||||
|
|
@ -695,7 +696,7 @@ impl KeyboardTarget<State> for KeyboardFocusTarget {
|
|||
key: KeysymHandle<'_>,
|
||||
state: KeyState,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
if let Some(inner) = self.inner_keyboard_target() {
|
||||
inner.key(seat, data, key, state, serial, time);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use cosmic_settings_config::shortcuts::Action;
|
||||
use smithay::{
|
||||
input::pointer::MotionEvent, reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||
utils::SERIAL_COUNTER, wayland::seat::WaylandFocus,
|
||||
backend::input::InputTime, input::pointer::MotionEvent,
|
||||
reexports::wayland_server::protocol::wl_surface::WlSurface, utils::SERIAL_COUNTER,
|
||||
wayland::seat::WaylandFocus,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
@ -398,7 +399,7 @@ pub fn window_items(
|
|||
&MotionEvent {
|
||||
location: loc.as_logical().to_f64(),
|
||||
serial,
|
||||
time: state.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
pointer.frame(state);
|
||||
|
|
@ -433,7 +434,7 @@ pub fn window_items(
|
|||
&MotionEvent {
|
||||
location: loc.as_logical().to_f64(),
|
||||
serial,
|
||||
time: state.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
pointer.frame(state);
|
||||
|
|
@ -468,7 +469,7 @@ pub fn window_items(
|
|||
&MotionEvent {
|
||||
location: loc.as_logical().to_f64(),
|
||||
serial,
|
||||
time: state.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
pointer.frame(state);
|
||||
|
|
@ -503,7 +504,7 @@ pub fn window_items(
|
|||
&MotionEvent {
|
||||
location: loc.as_logical().to_f64(),
|
||||
serial,
|
||||
time: state.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
pointer.frame(state);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use smallvec::SmallVec;
|
|||
use smithay::{
|
||||
backend::{
|
||||
drm::DrmNode,
|
||||
input::ButtonState,
|
||||
input::{ButtonState, InputTime},
|
||||
renderer::{
|
||||
ImportAll, ImportMem,
|
||||
element::{RenderElement, utils::RescaleRenderElement},
|
||||
|
|
@ -956,7 +956,7 @@ impl Drop for MoveGrab {
|
|||
&MotionEvent {
|
||||
location: pointer.current_location(),
|
||||
serial,
|
||||
time: state.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
};
|
||||
use id_tree::{NodeId, Tree};
|
||||
use smithay::{
|
||||
backend::input::ButtonState,
|
||||
backend::input::{ButtonState, InputTime},
|
||||
input::{
|
||||
Seat,
|
||||
pointer::{
|
||||
|
|
@ -65,7 +65,7 @@ impl PointerTarget<State> for ResizeForkTarget {
|
|||
seat: &Seat<State>,
|
||||
_data: &mut State,
|
||||
_serial: smithay::utils::Serial,
|
||||
_time: u32,
|
||||
_time: InputTime,
|
||||
) {
|
||||
let user_data = seat.user_data();
|
||||
let cursor_state = user_data.get::<CursorState>().unwrap();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use cosmic_settings_config::shortcuts;
|
||||
use smithay::{
|
||||
backend::input::{KeyState, Keycode},
|
||||
backend::input::{InputTime, KeyState, Keycode},
|
||||
input::{
|
||||
Seat, SeatHandler,
|
||||
keyboard::{
|
||||
|
|
@ -38,7 +38,7 @@ impl KeyboardGrab<State> for SwapWindowGrab {
|
|||
state: KeyState,
|
||||
modifiers: Option<ModifiersState>,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
if !matches!(&data.common.shell.read().overview_mode.active_trigger(), Some(Trigger::KeyboardSwap(_, d)) if d == &self.desc)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use cosmic_comp_config::{ZoomConfig, ZoomMovement};
|
|||
use cosmic_config::ConfigSet;
|
||||
use keyframe::{ease, functions::Linear};
|
||||
use smithay::{
|
||||
backend::renderer::ImportMem,
|
||||
backend::{input::InputTime, renderer::ImportMem},
|
||||
desktop::space::SpaceElement,
|
||||
input::{
|
||||
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 {
|
||||
ZoomFocusTarget::Main(elem) => PointerTarget::leave(elem, seat, data, serial, time),
|
||||
ZoomFocusTarget::Menu(elem) => PointerTarget::leave(elem, seat, data, serial, time),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use ordered_float::OrderedFloat;
|
|||
use smithay::{
|
||||
backend::{
|
||||
allocator::Fourcc,
|
||||
input::{ButtonState, KeyState},
|
||||
input::{ButtonState, InputTime, KeyState},
|
||||
renderer::{
|
||||
ImportMem,
|
||||
element::{
|
||||
|
|
@ -581,7 +581,7 @@ impl<P: Program + Send + 'static> PointerTarget<crate::state::State> for IcedEle
|
|||
_seat: &Seat<crate::state::State>,
|
||||
_data: &mut crate::state::State,
|
||||
_serial: Serial,
|
||||
_time: u32,
|
||||
_time: InputTime,
|
||||
) {
|
||||
let mut internal = self.0.lock().unwrap();
|
||||
internal
|
||||
|
|
@ -784,7 +784,7 @@ impl<P: Program + Send + 'static> KeyboardTarget<crate::state::State> for IcedEl
|
|||
_key: KeysymHandle<'_>,
|
||||
_state: KeyState,
|
||||
_serial: Serial,
|
||||
_time: u32,
|
||||
_time: InputTime,
|
||||
) {
|
||||
// TODO convert keys
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,12 @@
|
|||
use crate::{shell::grabs::SeatMoveGrabState, state::ClientState, utils::prelude::*};
|
||||
use calloop::Interest;
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
element::{Kind, surface::KindEvaluation},
|
||||
utils::{on_commit_buffer_handler, with_renderer_surface_state},
|
||||
backend::{
|
||||
input::InputTime,
|
||||
renderer::{
|
||||
element::{Kind, surface::KindEvaluation},
|
||||
utils::{on_commit_buffer_handler, with_renderer_surface_state},
|
||||
},
|
||||
},
|
||||
desktop::{LayerSurface, PopupKind, WindowSurfaceType, layer_map_for_output},
|
||||
reexports::wayland_server::{Client, Resource, protocol::wl_surface::WlSurface},
|
||||
|
|
@ -325,9 +328,11 @@ impl CompositorHandler for State {
|
|||
}
|
||||
} else {
|
||||
std::mem::drop(shell);
|
||||
seat.get_pointer()
|
||||
.unwrap()
|
||||
.unset_grab(self, SERIAL_COUNTER.next_serial(), 0);
|
||||
seat.get_pointer().unwrap().unset_grab(
|
||||
self,
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
InputTime::now(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ use smithay::{
|
|||
input::pointer::PointerHandle,
|
||||
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||
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};
|
||||
|
|
@ -76,23 +79,38 @@ impl PointerConstraintsHandler for State {
|
|||
}
|
||||
}
|
||||
|
||||
fn remove_constraint(&mut self, surface: &WlSurface, pointer: &PointerHandle<Self>) {
|
||||
if with_pointer_constraint(surface, pointer, |constraint| constraint.is_none()) {
|
||||
let seat = self
|
||||
.common
|
||||
.shell
|
||||
.read()
|
||||
.seats
|
||||
.iter()
|
||||
.find(|s| s.get_pointer().as_ref() == Some(pointer))
|
||||
.cloned();
|
||||
fn remove_constraint(
|
||||
&mut self,
|
||||
surface: &WlSurface,
|
||||
pointer: &PointerHandle<Self>,
|
||||
constraint_remove: ConstraintRemove,
|
||||
) {
|
||||
match constraint_remove {
|
||||
ConstraintRemove::PointerLeave(_) => {
|
||||
// If the constraint was broken by the pointer forcibly leaving the surface, then it doesn't
|
||||
// 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
|
||||
&& let Some((hint_surface, hint_location)) = seat.pointer_constraint_hint()
|
||||
&& hint_surface == *surface
|
||||
{
|
||||
self.apply_cursor_hint(surface, pointer, hint_location);
|
||||
seat.set_pointer_constraint_hint(None);
|
||||
if hint_surface == *surface {
|
||||
self.apply_cursor_hint(surface, pointer, hint_location, Some(&constraint));
|
||||
seat.set_pointer_constraint_hint(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl PointerWarpHandler for State {
|
|||
drop(shell);
|
||||
|
||||
if let Some(pointer_handle) = pointer_handle {
|
||||
self.apply_cursor_hint(&surface, &pointer_handle, pos);
|
||||
self.apply_cursor_hint(&surface, &pointer_handle, pos, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use smithay::{
|
||||
backend::input::InputTime,
|
||||
desktop::{WindowSurfaceType, layer_map_for_output},
|
||||
input::{Seat, pointer::MotionEvent},
|
||||
output::Output,
|
||||
|
|
@ -124,7 +125,7 @@ impl ToplevelManagementHandler for State {
|
|||
&MotionEvent {
|
||||
location: new_pos.to_f64().as_logical(),
|
||||
serial,
|
||||
time: self.common.clock.now().as_millis(),
|
||||
time: InputTime::now(),
|
||||
},
|
||||
);
|
||||
ptr.frame(self);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use smithay::{
|
|||
backend::{
|
||||
allocator::Fourcc,
|
||||
drm::DrmNode,
|
||||
input::{ButtonState, KeyState, Keycode},
|
||||
input::{ButtonState, InputTime, KeyState, Keycode},
|
||||
renderer::{
|
||||
Bind, Frame, Offscreen, Renderer,
|
||||
element::{
|
||||
|
|
@ -396,7 +396,7 @@ impl Common {
|
|||
state: KeyState,
|
||||
modifiers: ModifiersState,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
let config = self.config.cosmic_conf.xwayland_eavesdropping.keyboard;
|
||||
if config == EavesdroppingKeyboardMode::None {
|
||||
|
|
@ -458,7 +458,7 @@ impl Common {
|
|||
|
||||
tracing::trace!("Forwaring key {} {:?} to xwayland", code.raw() - 8, state);
|
||||
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) {
|
||||
xstate.last_modifier_state = Some(modifiers);
|
||||
wl_keyboard.modifiers(
|
||||
|
|
@ -478,7 +478,7 @@ impl Common {
|
|||
button: u32,
|
||||
state: ButtonState,
|
||||
serial: Serial,
|
||||
time: u32,
|
||||
time: InputTime,
|
||||
) {
|
||||
if !self.config.cosmic_conf.xwayland_eavesdropping.pointer {
|
||||
return;
|
||||
|
|
@ -518,7 +518,7 @@ impl Common {
|
|||
|
||||
tracing::trace!("Forwaring ptr button {} {:?} to Xwayland", button, state);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue