shithub: ft²

Download patch

ref: 6de936ef684960570b2cde4805753103114ee3fd
parent: da4dd26ac98ef4aab16f9da9825874958e9c542a
author: Olav Sørensen <[email protected]>
date: Tue May 10 14:13:06 EDT 2022

Handle top-left corner as quit in fullscreen mode

--- a/src/ft2_mouse.c
+++ b/src/ft2_mouse.c
@@ -684,8 +684,8 @@
 		return;
 	}
 
-	// mouse 0,0 = open exit dialog
-	if (mouse.x == 0 && mouse.y == 0)
+	// mouse 0,0 = open exit dialog (also make sure the test always works in fullscreen mode)
+	if (mouse.x == 0 && mouse.y == 0 || (video.fullscreen && (video.renderX > 0 || video.renderY > 0) && (mouse.rawX == 0 && mouse.rawY == 0)))
 	{
 		if (quitBox(false) == 1)
 			editor.throwExit = true;
@@ -844,6 +844,9 @@
 		// special mode for KMSDRM (XXX: Confirm that this still works...)
 		mouse.buttonState = SDL_GetMouseState(&mx, &my);
 	}
+
+	mouse.rawX = mx;
+	mouse.rawY = my;
 
 	if (video.fullscreen)
 	{
--- a/src/ft2_mouse.h
+++ b/src/ft2_mouse.h
@@ -20,7 +20,7 @@
 	bool firstTimePressingButton, mouseOverTextBox;
 	int8_t buttonCounter, mode;
 	int16_t lastUsedObjectID, lastUsedObjectType, lastEditBox;
-	int32_t x, y, lastX, lastY, xBias, yBias, setPosX, setPosY;
+	int32_t rawX, rawY, x, y, lastX, lastY, xBias, yBias, setPosX, setPosY;
 	int32_t lastScrollX, lastScrollXTmp, lastScrollY, saveMouseX, saveMouseY;
 	uint32_t buttonState;
 } mouse_t;