Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wl: Add safe-guards for touch and pointer events #701

Merged

Conversation

psaavedra
Copy link
Member

In some compositors it could be possible these 2 cases:

  • to receive touch up/motion events immediately after a touch up (touch deinit the touch target).
  • to receive pointer motion/leave event immediately after a touch leave (deinit the touch target).

This patch adds safeguards in the touch events callbacks

@psaavedra psaavedra requested a review from aperezdc March 9, 2024 14:15
@psaavedra psaavedra force-pushed the psaavedra/wl-Add-safe-guards-for-touch-and-pointer-events branch 2 times, most recently from e8a742d to 3b76948 Compare March 9, 2024 14:21
@psaavedra psaavedra self-assigned this Mar 9, 2024
In some unstable compositors it could be possible these 2 cases:

* to receive touch up/motion events immediatelly after a touch up
  (touch deinit the touch target).
* to receive pointer motion/leave event immediatelly after a touch
  leave (deinit the touch target).
@psaavedra psaavedra force-pushed the psaavedra/wl-Add-safe-guards-for-touch-and-pointer-events branch from 3b76948 to 26cf220 Compare March 11, 2024 10:51
Copy link
Member

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @psaavedra 👌🏼

@@ -271,8 +271,14 @@ pointer_on_enter(void *data,
static void
pointer_on_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface)
{
if (data == NULL || pointer == NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it's not needed to explicitly compare with NULL, which tends to be clearer:

Suggested change
if (data == NULL || pointer == NULL)
if (!data || !pointer)

@aperezdc aperezdc merged commit c0ef309 into master Mar 27, 2024
5 checks passed
@aperezdc aperezdc deleted the psaavedra/wl-Add-safe-guards-for-touch-and-pointer-events branch March 27, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants