Implement pointer constraints; update to send frame manually
This commit is contained in:
parent
0b057f153e
commit
373af07319
16 changed files with 272 additions and 49 deletions
|
|
@ -906,6 +906,13 @@ impl PointerTarget<State> for CosmicMapped {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||
match &self.element {
|
||||
CosmicMappedInternal::Stack(s) => PointerTarget::frame(s, seat, data),
|
||||
CosmicMappedInternal::Window(w) => PointerTarget::frame(w, seat, data),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||
self.last_cursor_position.lock().unwrap().remove(&seat.id());
|
||||
match &self.element {
|
||||
|
|
|
|||
|
|
@ -1169,6 +1169,27 @@ impl PointerTarget<State> for CosmicStack {
|
|||
}
|
||||
}
|
||||
|
||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||
if let Some((location, serial, time)) = self
|
||||
.0
|
||||
.with_program(|p| p.last_location.lock().unwrap().clone())
|
||||
{
|
||||
self.pointer_leave_if_previous(seat, data, serial, time, location);
|
||||
}
|
||||
|
||||
match self.0.with_program(|p| p.current_focus()) {
|
||||
Focus::Header => PointerTarget::frame(&self.0, seat, data),
|
||||
Focus::Window => self.0.with_program(|p| {
|
||||
PointerTarget::frame(
|
||||
&p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)],
|
||||
seat,
|
||||
data,
|
||||
)
|
||||
}),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||
if let Some((location, serial, time)) = self
|
||||
.0
|
||||
|
|
|
|||
|
|
@ -757,6 +757,14 @@ impl PointerTarget<State> for CosmicSurface {
|
|||
}
|
||||
}
|
||||
|
||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||
match self {
|
||||
CosmicSurface::Wayland(window) => PointerTarget::frame(window, seat, data),
|
||||
CosmicSurface::X11(surface) => PointerTarget::frame(surface, seat, data),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn leave(
|
||||
&self,
|
||||
seat: &Seat<State>,
|
||||
|
|
|
|||
|
|
@ -585,6 +585,16 @@ impl PointerTarget<State> for CosmicWindow {
|
|||
}
|
||||
}
|
||||
|
||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||
match self.0.with_program(|p| p.current_focus()) {
|
||||
Focus::Header => PointerTarget::frame(&self.0, seat, data),
|
||||
Focus::Window => self
|
||||
.0
|
||||
.with_program(|p| PointerTarget::frame(&p.window, seat, data)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||
let previous = self.0.with_program(|p| {
|
||||
if let Some(sessions) = p.window.user_data().get::<ScreencopySessions>() {
|
||||
|
|
|
|||
|
|
@ -190,6 +190,16 @@ impl PointerTarget<State> for PointerFocusTarget {
|
|||
PointerFocusTarget::ResizeFork(f) => PointerTarget::axis(f, seat, data, frame),
|
||||
}
|
||||
}
|
||||
fn frame(&self, seat: &Seat<State>, data: &mut State) {
|
||||
match self {
|
||||
PointerFocusTarget::Element(w) => PointerTarget::frame(w, seat, data),
|
||||
PointerFocusTarget::Fullscreen(w) => PointerTarget::frame(w, seat, data),
|
||||
PointerFocusTarget::LayerSurface(l) => PointerTarget::frame(l, seat, data),
|
||||
PointerFocusTarget::Popup(p) => PointerTarget::frame(p.wl_surface(), seat, data),
|
||||
PointerFocusTarget::OverrideRedirect(s) => PointerTarget::frame(s, seat, data),
|
||||
PointerFocusTarget::ResizeFork(f) => PointerTarget::frame(f, seat, data),
|
||||
}
|
||||
}
|
||||
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
|
||||
match self {
|
||||
PointerFocusTarget::Element(w) => PointerTarget::leave(w, seat, data, serial, time),
|
||||
|
|
|
|||
|
|
@ -152,6 +152,13 @@ impl PointerGrab<State> for ResizeGrab {
|
|||
}
|
||||
}
|
||||
|
||||
fn frame(&mut self, data: &mut State, handle: &mut PointerInnerHandle<'_, State>) {
|
||||
match self {
|
||||
ResizeGrab::Floating(grab) => grab.frame(data, handle),
|
||||
ResizeGrab::Tiling(grab) => grab.frame(data, handle),
|
||||
}
|
||||
}
|
||||
|
||||
fn gesture_swipe_begin(
|
||||
&mut self,
|
||||
data: &mut State,
|
||||
|
|
|
|||
|
|
@ -311,6 +311,10 @@ impl PointerGrab<State> for MoveGrab {
|
|||
handle.axis(state, details);
|
||||
}
|
||||
|
||||
fn frame(&mut self, data: &mut State, handle: &mut PointerInnerHandle<'_, State>) {
|
||||
handle.frame(data)
|
||||
}
|
||||
|
||||
fn gesture_swipe_begin(
|
||||
&mut self,
|
||||
data: &mut State,
|
||||
|
|
|
|||
|
|
@ -164,6 +164,10 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
|
|||
handle.axis(data, details)
|
||||
}
|
||||
|
||||
fn frame(&mut self, data: &mut State, handle: &mut PointerInnerHandle<'_, State>) {
|
||||
handle.frame(data)
|
||||
}
|
||||
|
||||
fn gesture_swipe_begin(
|
||||
&mut self,
|
||||
data: &mut State,
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ impl PointerTarget<State> for ResizeForkTarget {
|
|||
) {
|
||||
}
|
||||
fn axis(&self, _seat: &Seat<State>, _data: &mut State, _frame: AxisFrame) {}
|
||||
fn frame(&self, _seat: &Seat<State>, _data: &mut State) {}
|
||||
fn gesture_swipe_begin(&self, _: &Seat<State>, _: &mut State, _: &GestureSwipeBeginEvent) {}
|
||||
fn gesture_swipe_update(&self, _: &Seat<State>, _: &mut State, _: &GestureSwipeUpdateEvent) {}
|
||||
fn gesture_swipe_end(&self, _: &Seat<State>, _: &mut State, _: &GestureSwipeEndEvent) {}
|
||||
|
|
@ -234,6 +235,10 @@ impl PointerGrab<State> for ResizeForkGrab {
|
|||
handle.axis(data, details)
|
||||
}
|
||||
|
||||
fn frame(&mut self, data: &mut State, handle: &mut PointerInnerHandle<'_, State>) {
|
||||
handle.frame(data)
|
||||
}
|
||||
|
||||
fn gesture_swipe_begin(
|
||||
&mut self,
|
||||
data: &mut State,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue