shithub: pt2-clone

Download patch

ref: 326bc5d8cb7a619f0c9981bf57951a1e68146053
parent: b305f0dca596c8771bfcc50fbc09d9b0a5025899
author: Olav Sørensen <olav.sorensen@live.no>
date: Tue Jul 6 12:53:29 EDT 2021

Mouse fix for Wayland

--- a/src/pt2_visuals.c
+++ b/src/pt2_visuals.c
@@ -2430,10 +2430,10 @@
 	else
 		SDL_ShowCursor(SDL_FALSE);
 
-	// Workaround: SDL_GetGlobalMouseState() doesn't work with KMSDRM
+	// Workaround: SDL_GetGlobalMouseState() doesn't work with KMSDRM/Wayland
 	video.useDesktopMouseCoords = true;
 	const char *videoDriver = SDL_GetCurrentVideoDriver();
-	if (videoDriver != NULL && strcmp("KMSDRM", videoDriver) == 0)
+	if (videoDriver != NULL && (strcmp("KMSDRM", videoDriver) == 0 || strcmp("wayland", videoDriver) == 0))
 		video.useDesktopMouseCoords = false;
 
 	SDL_SetRenderDrawColor(video.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);