wayland: Remove some unnecessary helper functions

This commit is contained in:
Frank Praznik 2023-09-23 12:51:24 -04:00
parent 399bc709b7
commit 9284a03053
3 changed files with 12 additions and 39 deletions

View File

@ -2846,35 +2846,6 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
d->input = NULL;
}
/* !!! FIXME: just merge these into display_handle_global(). */
void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id)
{
d->relative_pointer_manager =
wl_registry_bind(d->registry, id,
&zwp_relative_pointer_manager_v1_interface, 1);
}
void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d)
{
if (d->relative_pointer_manager) {
zwp_relative_pointer_manager_v1_destroy(d->relative_pointer_manager);
}
}
void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id)
{
d->pointer_constraints =
wl_registry_bind(d->registry, id,
&zwp_pointer_constraints_v1_interface, 1);
}
void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d)
{
if (d->pointer_constraints) {
zwp_pointer_constraints_v1_destroy(d->pointer_constraints);
}
}
static void relative_pointer_handle_relative_motion(void *data,
struct zwp_relative_pointer_v1 *pointer,
uint32_t time_hi,

View File

@ -182,18 +182,12 @@ extern void Wayland_add_text_input_manager(SDL_VideoData *d, uint32_t id, uint32
extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version);
extern void Wayland_display_destroy_input(SDL_VideoData *d);
extern void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id);
extern void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d);
extern int Wayland_input_lock_pointer(struct SDL_WaylandInput *input);
extern int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input);
extern int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *window);
extern int Wayland_input_unconfine_pointer(struct SDL_WaylandInput *input, SDL_Window *window);
extern void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id);
extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d);
extern int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input);
extern int Wayland_input_ungrab_keyboard(SDL_Window *window);

View File

@ -55,6 +55,8 @@
#include "primary-selection-unstable-v1-client-protocol.h"
#include "fractional-scale-v1-client-protocol.h"
#include "input-timestamps-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h"
#include "pointer-constraints-unstable-v1-client-protocol.h"
#ifdef HAVE_LIBDECOR_H
#include <libdecor.h>
@ -762,9 +764,9 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
} else if (SDL_strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
} else if (SDL_strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
Wayland_display_add_relative_pointer_manager(d, id);
d->relative_pointer_manager = wl_registry_bind(d->registry, id, &zwp_relative_pointer_manager_v1_interface, 1);
} else if (SDL_strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
Wayland_display_add_pointer_constraints(d, id);
d->pointer_constraints = wl_registry_bind(d->registry, id, &zwp_pointer_constraints_v1_interface, 1);
} else if (SDL_strcmp(interface, "zwp_keyboard_shortcuts_inhibit_manager_v1") == 0) {
d->key_inhibitor_manager = wl_registry_bind(d->registry, id, &zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1);
} else if (SDL_strcmp(interface, "zwp_idle_inhibit_manager_v1") == 0) {
@ -941,8 +943,14 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
}
Wayland_display_destroy_input(data);
Wayland_display_destroy_pointer_constraints(data);
Wayland_display_destroy_relative_pointer_manager(data);
if (data->pointer_constraints) {
zwp_pointer_constraints_v1_destroy(data->pointer_constraints);
}
if (data->relative_pointer_manager) {
zwp_relative_pointer_manager_v1_destroy(data->relative_pointer_manager);
}
if (data->activation_manager) {
xdg_activation_v1_destroy(data->activation_manager);