deps: Update smithay & relative motion events

This commit is contained in:
Victoria Brekenfeld 2023-01-30 23:19:36 +01:00
parent f54f367a0e
commit 21db472f8b
13 changed files with 143 additions and 20 deletions

View file

@ -16,7 +16,7 @@ use smithay::{
desktop::{space::SpaceElement, PopupManager, WindowSurfaceType},
input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat,
},
output::Output,
@ -573,6 +573,13 @@ impl PointerTarget<State> for CosmicMapped {
_ => {}
}
}
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
match &self.element {
CosmicMappedInternal::Stack(s) => PointerTarget::relative_motion(s, seat, data, event),
CosmicMappedInternal::Window(w) => PointerTarget::relative_motion(w, seat, data, event),
_ => {}
}
}
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
match &self.element {
CosmicMappedInternal::Stack(s) => PointerTarget::button(s, seat, data, event),

View file

@ -21,7 +21,7 @@ use smithay::{
desktop::space::SpaceElement,
input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat,
},
output::Output,
@ -491,6 +491,15 @@ impl PointerTarget<State> for CosmicStack {
}
}
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
self.0.with_program(|p| {
if p.current_focus() == Focus::Window {
let window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
window.relative_motion(seat, data, event)
}
})
}
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
if let Some((location, _serial, _time)) = self
.0

View file

@ -537,6 +537,23 @@ impl PointerTarget<crate::state::State> for CosmicSurface {
}
}
fn relative_motion(
&self,
seat: &smithay::input::Seat<crate::state::State>,
data: &mut crate::state::State,
event: &smithay::input::pointer::RelativeMotionEvent,
) {
match self {
CosmicSurface::Wayland(window) => {
PointerTarget::relative_motion(window, seat, data, event)
}
CosmicSurface::X11(surface) => {
PointerTarget::relative_motion(surface, seat, data, event)
}
_ => unreachable!(),
}
}
fn button(
&self,
seat: &smithay::input::Seat<crate::state::State>,

View file

@ -25,7 +25,7 @@ use smithay::{
desktop::space::SpaceElement,
input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat,
},
output::Output,
@ -468,6 +468,14 @@ impl PointerTarget<State> for CosmicWindow {
}
}
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
self.0.with_program(|p| {
if !p.has_ssd() || p.current_focus() == Focus::Window {
PointerTarget::relative_motion(&p.window, seat, data, event)
}
})
}
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
match self.0.with_program(|p| p.current_focus()) {
Focus::Header => {