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

2
Cargo.lock generated
View file

@ -3282,7 +3282,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "smithay" name = "smithay"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/pop-os/smithay?rev=406a40d6ec#406a40d6ec09723d8f1c73f3b7c9d62494cdbd13" source = "git+https://github.com/pop-os/smithay?rev=139c6e6079#139c6e6079da3624f58edf5c59bd7f264aede985"
dependencies = [ dependencies = [
"appendlist", "appendlist",
"bitflags", "bitflags",

View file

@ -70,4 +70,4 @@ debug = true
lto = "fat" lto = "fat"
[patch."https://github.com/Smithay/smithay.git"] [patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/pop-os/smithay", rev = "406a40d6ec" } smithay = { git = "https://github.com/pop-os/smithay", rev = "139c6e6079" }

View file

@ -23,7 +23,7 @@ use smithay::{
desktop::{layer_map_for_output, space::SpaceElement, WindowSurfaceType}, desktop::{layer_map_for_output, space::SpaceElement, WindowSurfaceType},
input::{ input::{
keyboard::{keysyms, FilterResult, KeysymHandle, XkbConfig}, keyboard::{keysyms, FilterResult, KeysymHandle, XkbConfig},
pointer::{AxisFrame, ButtonEvent, CursorImageStatus, MotionEvent}, pointer::{AxisFrame, ButtonEvent, CursorImageStatus, MotionEvent, RelativeMotionEvent},
Seat, SeatState, Seat, SeatState,
}, },
output::Output, output::Output,
@ -207,7 +207,7 @@ impl State {
slog_scope::trace!("key"; "keycode" => keycode, "state" => format!("{:?}", state)); slog_scope::trace!("key"; "keycode" => keycode, "state" => format!("{:?}", state));
let serial = SERIAL_COUNTER.next_serial(); let serial = SERIAL_COUNTER.next_serial();
let time = Event::time(&event); let time = Event::time_msec(&event);
if let Some(action) = seat if let Some(action) = seat
.get_keyboard() .get_keyboard()
.unwrap() .unwrap()
@ -337,13 +337,23 @@ impl State {
session.cursor_info(seat, InputType::Pointer, geometry, offset); session.cursor_info(seat, InputType::Pointer, geometry, offset);
} }
} }
seat.get_pointer().unwrap().motion( let ptr = seat.get_pointer().unwrap();
ptr.motion(
self, self,
under, under.clone(),
&MotionEvent { &MotionEvent {
location: position, location: position,
serial, serial,
time: event.time(), time: event.time_msec(),
},
);
ptr.relative_motion(
self,
under,
&RelativeMotionEvent {
delta: event.delta(),
delta_unaccel: event.delta_unaccel(),
utime: event.time(),
}, },
); );
break; break;
@ -393,7 +403,7 @@ impl State {
&MotionEvent { &MotionEvent {
location: position, location: position,
serial, serial,
time: event.time(), time: event.time_msec(),
}, },
); );
@ -492,7 +502,7 @@ impl State {
button, button,
state: event.state(), state: event.state(),
serial, serial,
time: event.time(), time: event.time_msec(),
}, },
); );
break; break;
@ -516,7 +526,8 @@ impl State {
let vertical_amount_discrete = event.amount_discrete(Axis::Vertical); let vertical_amount_discrete = event.amount_discrete(Axis::Vertical);
{ {
let mut frame = AxisFrame::new(event.time()).source(event.source()); let mut frame =
AxisFrame::new(event.time_msec()).source(event.source());
if horizontal_amount != 0.0 { if horizontal_amount != 0.0 {
frame = frame.value(Axis::Horizontal, horizontal_amount); frame = frame.value(Axis::Horizontal, horizontal_amount);
if let Some(discrete) = horizontal_amount_discrete { if let Some(discrete) = horizontal_amount_discrete {

View file

@ -16,7 +16,7 @@ use smithay::{
desktop::{space::SpaceElement, PopupManager, WindowSurfaceType}, desktop::{space::SpaceElement, PopupManager, WindowSurfaceType},
input::{ input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState}, keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget}, pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat, Seat,
}, },
output::Output, 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) { fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
match &self.element { match &self.element {
CosmicMappedInternal::Stack(s) => PointerTarget::button(s, seat, data, event), CosmicMappedInternal::Stack(s) => PointerTarget::button(s, seat, data, event),

View file

@ -21,7 +21,7 @@ use smithay::{
desktop::space::SpaceElement, desktop::space::SpaceElement,
input::{ input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState}, keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget}, pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat, Seat,
}, },
output::Output, 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) { fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
if let Some((location, _serial, _time)) = self if let Some((location, _serial, _time)) = self
.0 .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( fn button(
&self, &self,
seat: &smithay::input::Seat<crate::state::State>, seat: &smithay::input::Seat<crate::state::State>,

View file

@ -25,7 +25,7 @@ use smithay::{
desktop::space::SpaceElement, desktop::space::SpaceElement,
input::{ input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState}, keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget}, pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat, Seat,
}, },
output::Output, 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) { fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {
match self.0.with_program(|p| p.current_focus()) { match self.0.with_program(|p| p.current_focus()) {
Focus::Header => { Focus::Header => {

View file

@ -10,7 +10,7 @@ use smithay::{
desktop::{LayerSurface, PopupKind}, desktop::{LayerSurface, PopupKind},
input::{ input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState}, keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget}, pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat, Seat,
}, },
output::WeakOutput, output::WeakOutput,
@ -107,7 +107,24 @@ impl PointerTarget<State> for PointerFocusTarget {
PointerFocusTarget::Popup(p) => { PointerFocusTarget::Popup(p) => {
PointerTarget::motion(p.wl_surface(), seat, data, event) PointerTarget::motion(p.wl_surface(), seat, data, event)
} }
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::enter(s, seat, data, event), PointerFocusTarget::OverrideRedirect(s) => PointerTarget::motion(s, seat, data, event),
}
}
fn relative_motion(&self, seat: &Seat<State>, data: &mut State, event: &RelativeMotionEvent) {
match self {
PointerFocusTarget::Element(w) => PointerTarget::relative_motion(w, seat, data, event),
PointerFocusTarget::Fullscreen(w) => {
PointerTarget::relative_motion(w, seat, data, event)
}
PointerFocusTarget::LayerSurface(l) => {
PointerTarget::relative_motion(l, seat, data, event)
}
PointerFocusTarget::Popup(p) => {
PointerTarget::relative_motion(p.wl_surface(), seat, data, event)
}
PointerFocusTarget::OverrideRedirect(s) => {
PointerTarget::relative_motion(s, seat, data, event)
}
} }
} }
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) { fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {

View file

@ -1,7 +1,7 @@
use smithay::{ use smithay::{
input::pointer::{ input::pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
PointerInnerHandle, PointerInnerHandle, RelativeMotionEvent,
}, },
reexports::wayland_protocols::xdg::shell::server::xdg_toplevel, reexports::wayland_protocols::xdg::shell::server::xdg_toplevel,
utils::{Logical, Point}, utils::{Logical, Point},
@ -91,6 +91,19 @@ impl PointerGrab<State> for ResizeGrab {
} }
} }
fn relative_motion(
&mut self,
data: &mut State,
handle: &mut PointerInnerHandle<'_, State>,
focus: Option<(PointerFocusTarget, Point<i32, Logical>)>,
event: &RelativeMotionEvent,
) {
match self {
ResizeGrab::Floating(grab) => grab.relative_motion(data, handle, focus, event),
ResizeGrab::Tiling(grab) => grab.relative_motion(data, handle, focus, event),
}
}
fn button( fn button(
&mut self, &mut self,
data: &mut State, data: &mut State,

View file

@ -18,7 +18,7 @@ use smithay::{
input::{ input::{
pointer::{ pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent,
PointerGrab, PointerInnerHandle, PointerGrab, PointerInnerHandle, RelativeMotionEvent,
}, },
Seat, Seat,
}, },
@ -85,6 +85,17 @@ impl PointerGrab<State> for MoveSurfaceGrab {
} }
} }
fn relative_motion(
&mut self,
state: &mut State,
handle: &mut PointerInnerHandle<'_, State>,
_focus: Option<(PointerFocusTarget, Point<i32, Logical>)>,
event: &RelativeMotionEvent,
) {
// While the grab is active, no client has pointer focus
handle.relative_motion(state, None, event);
}
fn button( fn button(
&mut self, &mut self,
state: &mut State, state: &mut State,

View file

@ -10,7 +10,7 @@ use smithay::{
desktop::space::SpaceElement, desktop::space::SpaceElement,
input::pointer::{ input::pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
PointerInnerHandle, PointerInnerHandle, RelativeMotionEvent,
}, },
utils::{IsAlive, Logical, Point, Rectangle, Size}, utils::{IsAlive, Logical, Point, Rectangle, Size},
}; };
@ -107,6 +107,17 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
self.window.configure(); self.window.configure();
} }
fn relative_motion(
&mut self,
state: &mut State,
handle: &mut PointerInnerHandle<'_, State>,
_focus: Option<(PointerFocusTarget, Point<i32, Logical>)>,
event: &RelativeMotionEvent,
) {
// While the grab is active, no client has pointer focus
handle.relative_motion(state, None, event);
}
fn button( fn button(
&mut self, &mut self,
data: &mut State, data: &mut State,

View file

@ -8,7 +8,7 @@ use id_tree::NodeId;
use smithay::{ use smithay::{
input::pointer::{ input::pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
PointerInnerHandle, PointerInnerHandle, RelativeMotionEvent,
}, },
output::{Output, WeakOutput}, output::{Output, WeakOutput},
utils::{Logical, Point}, utils::{Logical, Point},
@ -189,6 +189,17 @@ impl PointerGrab<State> for ResizeForkGrab {
} }
} }
fn relative_motion(
&mut self,
state: &mut State,
handle: &mut PointerInnerHandle<'_, State>,
_focus: Option<(PointerFocusTarget, Point<i32, Logical>)>,
event: &RelativeMotionEvent,
) {
// While the grab is active, no client has pointer focus
handle.relative_motion(state, None, event);
}
fn button( fn button(
&mut self, &mut self,
data: &mut State, data: &mut State,

View file

@ -40,7 +40,7 @@ use smithay::{
desktop::space::{RenderZindex, SpaceElement}, desktop::space::{RenderZindex, SpaceElement},
input::{ input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState}, keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget}, pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat, Seat,
}, },
output::Output, output::Output,
@ -308,6 +308,14 @@ impl<P: Program + Send + 'static> PointerTarget<crate::state::State> for IcedEle
let _ = internal.update(true); // TODO let _ = internal.update(true); // TODO
} }
fn relative_motion(
&self,
_seat: &Seat<crate::state::State>,
_data: &mut crate::state::State,
_event: &RelativeMotionEvent,
) {
}
fn button( fn button(
&self, &self,
_seat: &Seat<crate::state::State>, _seat: &Seat<crate::state::State>,