Skip to content

wayland: Uncomment support for wl_display_reconnect #6531

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
15 changes: 2 additions & 13 deletions src/events/SDL_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,14 @@ static Uint32 GetButtonState(SDL_Mouse *mouse, SDL_bool include_touch)
return buttonstate;
}

SDL_Window *
SDL_GetMouseFocus(void)
SDL_Window *SDL_GetMouseFocus(void)
{
SDL_Mouse *mouse = SDL_GetMouse();

return mouse->focus;
}

/* TODO RECONNECT: Hello from the Wayland video driver!
* This was once removed from SDL, but it's been added back in comment form
* because we will need it when Wayland adds compositor reconnect support.
* If you need this before we do, great! Otherwise, leave this alone, we'll
* uncomment it at the right time.
* -flibit
*/
#if 0
void
SDL_ResetMouse(void)
void SDL_ResetMouse(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
Uint32 buttonState = GetButtonState(mouse, SDL_FALSE);
Expand All @@ -266,7 +256,6 @@ SDL_ResetMouse(void)
}
SDL_assert(GetButtonState(mouse, SDL_FALSE) == 0);
}
#endif /* 0 */

void SDL_SetMouseFocus(SDL_Window *window)
{
Expand Down
4 changes: 1 addition & 3 deletions src/events/SDL_mouse_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ extern int SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID
/* Warp the mouse within the window, potentially overriding relative mode */
extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode);

/* TODO RECONNECT: Set mouse state to "zero" */
#if 0
/* Set mouse state to "zero" */
extern void SDL_ResetMouse(void);
#endif /* 0 */

/* Shutdown the mouse subsystem */
extern void SDL_MouseQuit(void);
Expand Down
5 changes: 1 addition & 4 deletions src/video/wayland/SDL_waylandmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ static void SDLCALL Wayland_EmulateMouseWarpChanged(void *userdata, const char *
input->warp_emulation_prohibited = !SDL_GetStringBoolean(hint, !input->warp_emulation_prohibited);
}

#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */
static void Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata)
{
Wayland_CursorData *cdata = (Wayland_CursorData *) cursor->driverdata;
Expand All @@ -602,8 +601,7 @@ static void Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata)
wl_surface_set_user_data(cdata->surface, NULL);
}

void
Wayland_RecreateCursors(void)
void Wayland_RecreateCursors(void)
{
SDL_Cursor *cursor;
SDL_Mouse *mouse = SDL_GetMouse();
Expand Down Expand Up @@ -632,7 +630,6 @@ Wayland_RecreateCursors(void)
}
}
}
#endif /* 0 */

void Wayland_InitMouse(void)
{
Expand Down
2 changes: 0 additions & 2 deletions src/video/wayland/SDL_waylandmouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

extern void Wayland_InitMouse(void);
extern void Wayland_FiniMouse(SDL_VideoData *data);
#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */
extern void Wayland_RecreateCursors(void);
#endif /* 0 */

#endif
7 changes: 2 additions & 5 deletions src/video/wayland/SDL_waylandsym.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *prox
SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args))
#endif

#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */
#if SDL_WAYLAND_CHECK_VERSION(broken, on, purpose)
SDL_WAYLAND_SYM(int, wl_display_reconnect, (struct wl_display*));
#endif
#endif /* 0 */
SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_SOON)
SDL_WAYLAND_SYM(int, wl_display_reconnect, (struct wl_display*))

SDL_WAYLAND_INTERFACE(wl_seat_interface)
SDL_WAYLAND_INTERFACE(wl_surface_interface)
Expand Down
6 changes: 1 addition & 5 deletions src/video/wayland/SDL_waylandvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,6 @@ static void Wayland_VideoCleanup(_THIS)

SDL_bool Wayland_VideoReconnect(_THIS)
{
#if 0 /* TODO RECONNECT: Uncomment all when https://invent.kde.org/plasma/kwin/-/wikis/Restarting is completed */
SDL_VideoData *data = _this->driverdata;

SDL_Window *window = NULL;
Expand All @@ -1136,7 +1135,7 @@ SDL_bool Wayland_VideoReconnect(_THIS)

SDL_ResetKeyboard();
SDL_ResetMouse();
if (WAYLAND_wl_display_reconnect(data->display) < 0) {
if (!SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_SOON || WAYLAND_wl_display_reconnect(data->display) < 0) {
return SDL_FALSE;
}

Expand All @@ -1163,9 +1162,6 @@ SDL_bool Wayland_VideoReconnect(_THIS)
SDL_GL_MakeCurrent (current_window, current_ctx);
}
return SDL_TRUE;
#else
return SDL_FALSE;
#endif /* 0 */
}

void Wayland_VideoQuit(_THIS)
Expand Down