Skip to content

Commit

Permalink
Update pointer focus before input
Browse files Browse the repository at this point in the history
During an animation, our pointer might have updated.
  • Loading branch information
YaLTeR committed Oct 21, 2023
1 parent fb866c6 commit 5156ab1
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ impl State {
}
};

self.update_pointer_focus();

pointer.button(
self,
&ButtonEvent {
Expand Down Expand Up @@ -520,6 +522,8 @@ impl State {
}
}

self.update_pointer_focus();

let pointer = &self.niri.seat.get_pointer().unwrap();
pointer.axis(self, frame);
pointer.frame(self);
Expand Down Expand Up @@ -705,6 +709,11 @@ impl State {

let serial = SERIAL_COUNTER.next_serial();
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_swipe_begin(
self,
&GestureSwipeBeginEvent {
Expand All @@ -729,6 +738,11 @@ impl State {
}

let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_swipe_update(
self,
&GestureSwipeUpdateEvent {
Expand All @@ -751,6 +765,11 @@ impl State {

let serial = SERIAL_COUNTER.next_serial();
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_swipe_end(
self,
&GestureSwipeEndEvent {
Expand All @@ -763,6 +782,11 @@ impl State {
InputEvent::GesturePinchBegin { event } => {
let serial = SERIAL_COUNTER.next_serial();
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_pinch_begin(
self,
&GesturePinchBeginEvent {
Expand All @@ -774,6 +798,11 @@ impl State {
}
InputEvent::GesturePinchUpdate { event } => {
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_pinch_update(
self,
&GesturePinchUpdateEvent {
Expand All @@ -787,6 +816,11 @@ impl State {
InputEvent::GesturePinchEnd { event } => {
let serial = SERIAL_COUNTER.next_serial();
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_pinch_end(
self,
&GesturePinchEndEvent {
Expand All @@ -799,6 +833,11 @@ impl State {
InputEvent::GestureHoldBegin { event } => {
let serial = SERIAL_COUNTER.next_serial();
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_hold_begin(
self,
&GestureHoldBeginEvent {
Expand All @@ -811,6 +850,11 @@ impl State {
InputEvent::GestureHoldEnd { event } => {
let serial = SERIAL_COUNTER.next_serial();
let pointer = self.niri.seat.get_pointer().unwrap();

if self.update_pointer_focus() {
pointer.frame(self);
}

pointer.gesture_hold_end(
self,
&GestureHoldEndEvent {
Expand Down

0 comments on commit 5156ab1

Please sign in to comment.