Skip to content

Commit

Permalink
fixed webOS warp mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Mar 25, 2024
1 parent dc1d370 commit a9e67b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/video/wayland/SDL_waylandevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "tablet-unstable-v2-client-protocol.h"
#include "primary-selection-unstable-v1-client-protocol.h"
#include "webos-input-manager-client-protocol.h"
#include "starfish-client-protocol.h"

#ifdef HAVE_LIBDECOR_H
#include <libdecor.h>
Expand Down
16 changes: 16 additions & 0 deletions src/video/wayland/SDL_waylandmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "../../core/webos/SDL_webos_libs.h"
#include "SDL_waylandwebos_cursor.h"
#include "webos-input-manager-client-protocol.h"
#include "starfish-client-protocol.h"
#endif /* SDL_VIDEO_DRIVER_WAYLAND_WEBOS */

static int Wayland_SetRelativeMouseMode(SDL_bool enabled);
Expand Down Expand Up @@ -597,6 +598,13 @@ static void Wayland_WarpMouse(SDL_Window *window, int x, int y)
SDL_VideoData *d = vd->driverdata;
struct SDL_WaylandInput *input = d->input;

#ifdef SDL_VIDEO_DRIVER_WAYLAND_WEBOS
if (d->starfish_pointer) {
wl_starfish_pointer_set_cursor_position(d->starfish_pointer, window->x + x, window->y + y);
return;
}
#endif

if (input->cursor_visible == SDL_TRUE) {
SDL_Unsupported();
} else if (input->warp_emulation_prohibited) {
Expand All @@ -611,6 +619,14 @@ static void Wayland_WarpMouse(SDL_Window *window, int x, int y)

static int Wayland_WarpMouseGlobal(int x, int y)
{
#ifdef SDL_VIDEO_DRIVER_WAYLAND_WEBOS
SDL_VideoDevice *vd = SDL_GetVideoDevice();
SDL_VideoData *d = vd->driverdata;
if (d->starfish_pointer) {
wl_starfish_pointer_set_cursor_position(d->starfish_pointer, x, y);
return 0;
}
#endif
return SDL_Unsupported();
}

Expand Down

0 comments on commit a9e67b7

Please sign in to comment.