shithub: ft²

Download patch

ref: 46897c2079dd6b7f30dc76320ed3cf9d25214b22
parent: c10569ad8bc61859e8d989a9eaf640c71f55c9d4
author: Olav Sørensen <olav.sorensen@live.no>
date: Tue Apr 5 15:32:54 EDT 2022

Added checkbox for disabling custom FT2 mouse pointer

--- a/src/ft2_checkboxes.c
+++ b/src/ft2_checkboxes.c
@@ -90,6 +90,7 @@
 	{ 113,  79, 128, 12, cbConfigLineColors },
 	{ 113,  92, 126, 12, cbConfigChanNums },
 	{ 255,  14, 136, 12, cbConfigShowVolCol },
+	{ 237, 108,  13, 12, cbEnableCustomPointer },
 	{ 255, 158, 111, 12, cbSoftwareMouse },
 	// ---------------------------------
 	{ 212,   2, 150, 12, cbSampCutToBuff },
--- a/src/ft2_checkboxes.h
+++ b/src/ft2_checkboxes.h
@@ -65,6 +65,7 @@
 	CB_CONF_LINECOLORS,
 	CB_CONF_CHANNUMS,
 	CB_CONF_SHOW_VOLCOL,
+	CB_CONF_ENABLE_CUSTOM_POINTER,
 	CB_CONF_SOFTWARE_MOUSE,
 
 	// CONFIG MISCELLANEOUS
--- a/src/ft2_config.c
+++ b/src/ft2_config.c
@@ -872,6 +872,7 @@
 	checkBoxes[CB_CONF_LINECOLORS].checked = config.ptnLineLight;
 	checkBoxes[CB_CONF_CHANNUMS].checked = config.ptnChnNumbers;
 	checkBoxes[CB_CONF_SHOW_VOLCOL].checked = config.ptnShowVolColumn;
+	checkBoxes[CB_CONF_ENABLE_CUSTOM_POINTER].checked = (config.specialFlags2 & USE_OS_MOUSE_POINTER) ? false : true;
 	checkBoxes[CB_CONF_SOFTWARE_MOUSE].checked = (config.specialFlags2 & HARDWARE_MOUSE) ? false : true;
 
 	showCheckBox(CB_CONF_PATTSTRETCH);
@@ -882,6 +883,7 @@
 	showCheckBox(CB_CONF_LINECOLORS);
 	showCheckBox(CB_CONF_CHANNUMS);
 	showCheckBox(CB_CONF_SHOW_VOLCOL);
+	showCheckBox(CB_CONF_ENABLE_CUSTOM_POINTER);
 	showCheckBox(CB_CONF_SOFTWARE_MOUSE);
 }
 
@@ -1737,6 +1739,29 @@
 	redrawPatternEditor();
 }
 
+void cbEnableCustomPointer(void)
+{
+	config.specialFlags2 ^= USE_OS_MOUSE_POINTER;
+
+	if (config.specialFlags2 & USE_OS_MOUSE_POINTER)
+	{
+		checkBoxes[CB_CONF_ENABLE_CUSTOM_POINTER].checked = false;
+		drawCheckBox(CB_CONF_ENABLE_CUSTOM_POINTER);
+	}
+	else
+	{
+		checkBoxes[CB_CONF_ENABLE_CUSTOM_POINTER].checked = true;
+		drawCheckBox(CB_CONF_ENABLE_CUSTOM_POINTER);
+	}
+
+	if (config.specialFlags2 & HARDWARE_MOUSE)
+		SDL_ShowCursor(SDL_TRUE);
+	else
+		SDL_ShowCursor(SDL_FALSE);
+
+	createMouseCursors();
+}
+
 void cbSoftwareMouse(void)
 {
 	config.specialFlags2 ^= HARDWARE_MOUSE;
@@ -1747,14 +1772,17 @@
 	{
 		checkBoxes[CB_CONF_SOFTWARE_MOUSE].checked = false;
 		drawCheckBox(CB_CONF_SOFTWARE_MOUSE);
-		SDL_ShowCursor(SDL_TRUE);
 	}
 	else
 	{
 		checkBoxes[CB_CONF_SOFTWARE_MOUSE].checked = true;
 		drawCheckBox(CB_CONF_SOFTWARE_MOUSE);
-		SDL_ShowCursor(SDL_FALSE);
 	}
+
+	if (config.specialFlags2 & HARDWARE_MOUSE)
+		SDL_ShowCursor(SDL_TRUE);
+	else
+		SDL_ShowCursor(SDL_FALSE);
 }
 
 void rbConfigMouseNice(void)
--- a/src/ft2_config.h
+++ b/src/ft2_config.h
@@ -80,9 +80,10 @@
 	LINED_SCOPES = 128,
 
 	// specialFlags2
-	DITHERED_AUDIO = 1, /* DEPRECATED */
+	DITHERED_AUDIO = 1, /* DEPRECATED (but don't use it for anything else!) */
 	HARDWARE_MOUSE = 2,
 	STRETCH_IMAGE = 4,
+	USE_OS_MOUSE_POINTER = 8,
 
 	// windowFlags
 	WINSIZE_AUTO = 1,
@@ -260,6 +261,7 @@
 void cbConfigLineColors(void);
 void cbConfigChanNums(void);
 void cbConfigShowVolCol(void);
+void cbEnableCustomPointer(void);
 void cbSoftwareMouse(void);
 void cbSampCutToBuff(void);
 void cbPattCutToBuff(void);
--- a/src/ft2_header.h
+++ b/src/ft2_header.h
@@ -12,7 +12,7 @@
 #endif
 #include "ft2_replayer.h"
 
-#define PROG_VER_STR "1.52"
+#define PROG_VER_STR "1.53"
 
 // do NOT change these! It will only mess things up...
 
--- a/src/ft2_mouse.c
+++ b/src/ft2_mouse.c
@@ -32,6 +32,12 @@
 
 static bool setSystemCursor(SDL_Cursor *cur)
 {
+	if (config.specialFlags2 & USE_OS_MOUSE_POINTER)
+	{
+		SDL_SetCursor(SDL_GetDefaultCursor());
+		return true;
+	}
+
 	if (cur == NULL)
 	{
 		SDL_SetCursor(SDL_GetDefaultCursor());
@@ -77,8 +83,18 @@
 		if (surface == NULL)
 		{
 			freeMouseCursors();
-			config.specialFlags2 &= ~HARDWARE_MOUSE; // enable software mouse
-			SDL_ShowCursor(SDL_FALSE);
+
+			if (config.specialFlags2 & USE_OS_MOUSE_POINTER)
+			{
+				SDL_ShowCursor(SDL_TRUE);
+			}
+			else
+			{
+				// enable software mouse
+				config.specialFlags2 &= ~HARDWARE_MOUSE;
+				SDL_ShowCursor(SDL_FALSE);
+			}
+
 			return false;
 		}
 
@@ -148,8 +164,18 @@
 		{
 			SDL_FreeSurface(surface);
 			freeMouseCursors();
-			config.specialFlags2 &= ~HARDWARE_MOUSE; // enable software mouse
-			SDL_ShowCursor(SDL_FALSE);
+
+			if (config.specialFlags2 & USE_OS_MOUSE_POINTER)
+			{
+				SDL_ShowCursor(SDL_TRUE);
+			}
+			else
+			{
+				// enable software mouse
+				config.specialFlags2 &= ~HARDWARE_MOUSE;
+				SDL_ShowCursor(SDL_FALSE);
+			}
+
 			return false;
 		}