shithub: ft²

Download patch

ref: b1e009f93c40ddaf5c9c663b4dfae82b2e90d1d2
parent: 01d639ec25889d7131a6d37f49c7cbbd2e0e5853
author: Olav Sørensen <olav.sorensen@live.no>
date: Mon Dec 13 10:08:43 EST 2021

Mac: Allow left Option key for A/X/C/V bindings, and remove "Play Song" on Left Cmd press

--- a/src/ft2_keyboard.c
+++ b/src/ft2_keyboard.c
@@ -382,9 +382,6 @@
 		break;
 
 		// play pattern
-#ifdef __APPLE__
-		case SDLK_LGUI: // fall-through for Apple keyboards
-#endif
 		case SDLK_RALT:
 		{
 			if (!keyb.leftCtrlPressed) // kludge for Mac (toggle fullscreen)
@@ -779,11 +776,19 @@
 
 		case SDLK_a:
 		{
-			if (keyb.leftCtrlPressed)
+#ifdef __APPLE__
+			if (keyb.leftAltPressed || keyb.leftCommandPressed)
+#else
+			if (keyb.leftAltPressed)
+#endif
 			{
 				if (ui.sampleEditorShown)
 					rangeAll();
+#ifdef __APPLE__
+				else if (!keyb.leftCommandPressed) // yuck!
+#else
 				else
+#endif
 					showAdvEdit();
 
 				return true;
@@ -814,7 +819,11 @@
 
 		case SDLK_c:
 		{
+#ifdef __APPLE__
+			if (keyb.leftAltPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftAltPressed)
+#endif
 			{
 				if (ui.sampleEditorShown)
 				{
@@ -1091,7 +1100,11 @@
 
 		case SDLK_v:
 		{
+#ifdef __APPLE__
+			if (keyb.leftAltPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftAltPressed)
+#endif
 			{
 				if (ui.sampleEditorShown)
 					sampPaste();
@@ -1134,7 +1147,11 @@
 
 		case SDLK_x:
 		{
+#ifdef __APPLE__
+			if (keyb.leftAltPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftAltPressed)
+#endif
 			{
 				if (ui.sampleEditorShown)
 					sampCut();
--- a/src/ft2_textboxes.c
+++ b/src/ft2_textboxes.c
@@ -823,7 +823,11 @@
 		case SDLK_a:
 		{
 			// CTRL+A - mark all text
+#ifdef __APPLE__
+			if (keyb.leftCtrlPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftCtrlPressed)
+#endif
 			{
 				// count number of chars and get full text width
 				textWidth = 0;
@@ -851,7 +855,11 @@
 		case SDLK_x:
 		{
 			// CTRL+X - cut marked text
+#ifdef __APPLE__
+			if (keyb.leftCtrlPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftCtrlPressed)
+#endif
 				cutMarkedText(t);
 		}
 		break;
@@ -859,7 +867,11 @@
 		case SDLK_c:
 		{
 			// CTRL+C - copy marked text
+#ifdef __APPLE__
+			if (keyb.leftCtrlPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftCtrlPressed)
+#endif
 				copyMarkedText(t);
 		}
 		break;
@@ -867,7 +879,11 @@
 		case SDLK_v:
 		{
 			// CTRL+V - paste text
+#ifdef __APPLE__
+			if (keyb.leftCtrlPressed || keyb.leftCommandPressed)
+#else
 			if (keyb.leftCtrlPressed)
+#endif
 				pasteText(t);
 		}
 		break;