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 => {

View file

@ -10,7 +10,7 @@ use smithay::{
desktop::{LayerSurface, PopupKind},
input::{
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget},
pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget, RelativeMotionEvent},
Seat,
},
output::WeakOutput,
@ -107,7 +107,24 @@ impl PointerTarget<State> for PointerFocusTarget {
PointerFocusTarget::Popup(p) => {
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) {

View file

@ -1,7 +1,7 @@
use smithay::{
input::pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
PointerInnerHandle,
PointerInnerHandle, RelativeMotionEvent,
},
reexports::wayland_protocols::xdg::shell::server::xdg_toplevel,
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(
&mut self,
data: &mut State,

View file

@ -18,7 +18,7 @@ use smithay::{
input::{
pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent,
PointerGrab, PointerInnerHandle,
PointerGrab, PointerInnerHandle, RelativeMotionEvent,
},
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(
&mut self,
state: &mut State,

View file

@ -10,7 +10,7 @@ use smithay::{
desktop::space::SpaceElement,
input::pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
PointerInnerHandle,
PointerInnerHandle, RelativeMotionEvent,
},
utils::{IsAlive, Logical, Point, Rectangle, Size},
};
@ -107,6 +107,17 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
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(
&mut self,
data: &mut State,

View file

@ -8,7 +8,7 @@ use id_tree::NodeId;
use smithay::{
input::pointer::{
AxisFrame, ButtonEvent, GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab,
PointerInnerHandle,
PointerInnerHandle, RelativeMotionEvent,
},
output::{Output, WeakOutput},
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(
&mut self,
data: &mut State,