Skip to content

Commit

Permalink
wl: do not set to null the surface and target at touch_on_up()
Browse files Browse the repository at this point in the history
On a multitouch screen, when several fingers are on the screen at
the same time, if we set to null surface and target on touch_on_up()
then we stop all the ongoing touch gestures and not only the one
of the finger that caused the up event. That is becasue
touch_on_motion() will refuse to process further events if surface
or target are null.

Instead of doing that do not set to null this pointers on the
touch_on_up() event. The value of those will be set again on
the next touch_on_down() event in any case.

Related: Igalia#698
Related: https://bugs.webkit.org/show_bug.cgi?id=270516
  • Loading branch information
clopez committed Jul 18, 2024
1 parent 42b00d7 commit 2b757bb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions platform/wayland/cog-platform-wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,7 @@ touch_on_up(void *data, struct wl_touch *touch, uint32_t serial, uint32_t time,
return;
}

g_assert(seat->touch_target);
CogWlViewport *viewport = COG_WL_VIEWPORT(seat->touch_target);

struct wl_surface *target_surface = seat->touch.surface;
seat->touch_target = NULL;
seat->touch.serial = serial;
seat->touch.surface = NULL;

if (id < 0 || id >= 10)
return;
Expand All @@ -829,6 +823,7 @@ touch_on_up(void *data, struct wl_touch *touch, uint32_t serial, uint32_t time,
CogWlPlatform *platform = (CogWlPlatform *) cog_platform_get();
CogWlPopup *popup = platform->popup;

struct wl_surface *target_surface = seat->touch.surface;
if (popup && popup->wl_surface) {
if (target_surface == popup->wl_surface) {
cog_popup_menu_handle_event(popup->popup_menu, COG_POPUP_MENU_EVENT_STATE_RELEASED, raw_event.x,
Expand All @@ -844,7 +839,8 @@ touch_on_up(void *data, struct wl_touch *touch, uint32_t serial, uint32_t time,

struct wpe_input_touch_event event = {seat->touch.points, 10, raw_event.type, raw_event.id, raw_event.time};

CogView *view = cog_viewport_get_visible_view((CogViewport *) viewport);
CogWlViewport *viewport = COG_WL_VIEWPORT(seat->touch_target);
CogView *view = cog_viewport_get_visible_view((CogViewport *) viewport);
if (view)
wpe_view_backend_dispatch_touch_event(cog_view_get_backend(view), &event);

Expand Down

0 comments on commit 2b757bb

Please sign in to comment.