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: do not set to null the surface and target at touch_on_up() #720

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions platform/wayland/cog-platform-wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ touch_on_down(void *data,

CogWlViewport *viewport = wl_surface_get_user_data(
surface); // Viewport is attached the context of the wl_surface. Check cog_wl_viewport_create_window();
seat->touch_target = viewport;
g_set_weak_pointer(&seat->touch_target, viewport);
seat->touch.serial = serial;
seat->touch.surface = surface;

Expand Down Expand Up @@ -820,13 +820,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 @@ -838,6 +832,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 @@ -853,7 +848,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);
aperezdc marked this conversation as resolved.
Show resolved Hide resolved
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
Loading