Skip to content

Commit

Permalink
update wayland gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Jun 12, 2024
1 parent f90c0c7 commit 71ff19d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/video/wayland/SDL_waylandevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat,
input);

/* Pinch gesture */
input->gesture_pinch = zwp_pointer_gestures_v1_get_pinch_gesture(input->pointer_gestures, input->pointer);
input->gesture_pinch = zwp_pointer_gestures_v1_get_pinch_gesture(input->display->zwp_pointer_gestures, input->pointer);
zwp_pointer_gesture_pinch_v1_set_user_data(input->gesture_pinch, input);
zwp_pointer_gesture_pinch_v1_add_listener(input->gesture_pinch, &gesture_pinch_listener, input);

Expand Down Expand Up @@ -3163,6 +3163,11 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
}
}

if (input->gesture_pinch) {
zwp_pointer_gesture_pinch_v1_destroy(input->gesture_pinch);
input->gesture_pinch = NULL;
}

if (input->tablet) {
Wayland_input_destroy_tablet(input);
}
Expand Down
2 changes: 0 additions & 2 deletions src/video/wayland/SDL_waylandevents_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ struct SDL_WaylandInput
struct wl_seat *seat;
struct wl_pointer *pointer;
struct wl_touch *touch;
struct zwp_pointer_gestures_v1 *pointer_gestures;
struct zwp_pointer_gesture_pinch_v1 *gesture_pinch;
struct zwp_pointer_gesture_swipe_v1 *gesture_swipe;
struct wl_keyboard *keyboard;
SDL_WaylandDataDevice *data_device;
SDL_WaylandPrimarySelectionDevice *primary_selection_device;
Expand Down
7 changes: 6 additions & 1 deletion src/video/wayland/SDL_waylandvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
d->kde_output_order = wl_registry_bind(d->registry, id, &kde_output_order_v1_interface, 1);
kde_output_order_v1_add_listener(d->kde_output_order, &kde_output_order_listener, d);
} else if (SDL_strcmp(interface, "zwp_pointer_gestures_v1") == 0) {
d->input->pointer_gestures = wl_registry_bind(d->registry, id, &zwp_pointer_gestures_v1_interface, 1);
d->zwp_pointer_gestures = wl_registry_bind(d->registry, id, &zwp_pointer_gestures_v1_interface, 1);
}
}

Expand Down Expand Up @@ -1387,6 +1387,11 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
data->kde_output_order = NULL;
}

if (data->zwp_pointer_gestures) {
zwp_pointer_gestures_v1_destroy(data->zwp_pointer_gestures);
data->zwp_pointer_gestures = NULL;
}

if (data->compositor) {
wl_compositor_destroy(data->compositor);
data->compositor = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/video/wayland/SDL_waylandvideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct SDL_VideoData
struct xdg_wm_dialog_v1 *xdg_wm_dialog_v1;
struct wp_alpha_modifier_v1 *wp_alpha_modifier_v1;
struct kde_output_order_v1 *kde_output_order;
struct zwp_pointer_gestures_v1 *zwp_pointer_gestures;

struct xkb_context *xkb_context;
struct SDL_WaylandInput *input;
Expand Down

0 comments on commit 71ff19d

Please sign in to comment.