Re: [hatari-devel] Keyboard shortcut to toggle Atari borders?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 11/19/2017 11:59 PM, Eero Tamminen wrote:
On 11/19/2017 04:51 PM, Thomas Huth wrote:
Am Sun, 19 Nov 2017 13:23:44 +0200
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
Attached is patch implementing Borders shortcut, could you try it?

I think you don't have to add anything new to the
configs_ShortCut*Mod_Sdl1 arrays since they are only used for
loading legacy config files, but not for saving new data.

I see, I hadn't noticed that earlier.


And I think you also have to adapt gui-sdl/dlgKeyboard.c for
the new shortcut accordingly.

Yes, it appears to crash without it.

Attached is a fixed patch.

If nobody's against this, I'll commit it in a day or two.


	- Eero

PS. Shortcut for toggling borders is actually quite handy.
I usually run Hatari without borders as they're empty for
most programs, so it's nice to be able to quickly toggle
it ON to check whether program actually has drawn something
to the borders...
diff -r b5c20dca2330 doc/hatari.1
--- a/doc/hatari.1	Tue Nov 21 22:04:24 2017 +0200
+++ b/doc/hatari.1	Tue Nov 21 22:06:41 2017 +0200
@@ -630,6 +630,9 @@
 .B AltGr + F4
 switch joystick type for joypad B
 .TP
+.B AltGr + b
+toggle borders on/off
+.TP
 .B AltGr + f or F11
 toggle between fullscreen and windowed mode
 .TP
diff -r b5c20dca2330 doc/manual.html
--- a/doc/manual.html	Tue Nov 21 22:04:24 2017 +0200
+++ b/doc/manual.html	Tue Nov 21 22:06:41 2017 +0200
@@ -1732,6 +1732,10 @@
       <td>switch joystick type for joypad B</td>
     </tr>
     <tr>
+      <td><span class="key">AltGr+b</span></td>
+      <td>toggle borders on/off</td>
+    </tr>
+    <tr>
       <td><span class="key">AltGr+f or F11</span></td>
       <td>toggle between fullscreen and windowed mode</td>
     </tr>
diff -r b5c20dca2330 doc/release-notes.txt
--- a/doc/release-notes.txt	Tue Nov 21 22:04:24 2017 +0200
+++ b/doc/release-notes.txt	Tue Nov 21 22:06:41 2017 +0200
@@ -25,6 +25,7 @@
 - MIDI support for Windows & OSX (with PortMidi library)
 - Miscellaneous:
   - Initial patching for ST-Book ROM
+  - Add keyboard shortcut for toggling borders
   - Fix: rate-limit DSP illegal instruction warnings output
 - Disk handling:
   - Add "--gemdos-time <atari/host>" option so that user can specify
diff -r b5c20dca2330 src/configuration.c
--- a/src/configuration.c	Tue Nov 21 22:04:24 2017 +0200
+++ b/src/configuration.c	Tue Nov 21 22:06:41 2017 +0200
@@ -329,6 +329,7 @@
 {
 	{ "kOptions",    Key_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] },
 	{ "kFullScreen", Key_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] },
+	{ "kBorders",    Key_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_BORDERS] },
 	{ "kMouseMode",  Key_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEGRAB] },
 	{ "kColdReset",  Key_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] },
 	{ "kWarmReset",  Key_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] },
@@ -357,6 +358,7 @@
 {
 	{ "kOptions",    Key_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] },
 	{ "kFullScreen", Key_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] },
+	{ "kBorders",    Key_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_BORDERS] },
 	{ "kMouseMode",  Key_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_MOUSEGRAB] },
 	{ "kColdReset",  Key_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_COLDRESET] },
 	{ "kWarmReset",  Key_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_WARMRESET] },
@@ -692,6 +694,7 @@
 	ConfigureParams.Shortcut.withModifier[SHORTCUT_DEBUG] = SDLK_PAUSE;
 	ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] = SDLK_o;
 	ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] = SDLK_f;
+	ConfigureParams.Shortcut.withModifier[SHORTCUT_BORDERS] = SDLK_b;
 	ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEGRAB] = SDLK_m;
 	ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] = SDLK_c;
 	ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] = SDLK_r;
diff -r b5c20dca2330 src/gui-sdl/dlgKeyboard.c
--- a/src/gui-sdl/dlgKeyboard.c	Tue Nov 21 22:04:24 2017 +0200
+++ b/src/gui-sdl/dlgKeyboard.c	Tue Nov 21 22:06:41 2017 +0200
@@ -72,6 +72,7 @@
 static char *sc_names[SHORTCUT_KEYS] = {
 	"Edit settings",
 	"Toggle fullscreen",
+	"Toggle borders",
 	"Grab mouse",
 	"Cold reset",
 	"Warm reset",
diff -r b5c20dca2330 src/includes/configuration.h
--- a/src/includes/configuration.h	Tue Nov 21 22:04:24 2017 +0200
+++ b/src/includes/configuration.h	Tue Nov 21 22:06:41 2017 +0200
@@ -88,6 +88,7 @@
 typedef enum {
   SHORTCUT_OPTIONS,
   SHORTCUT_FULLSCREEN,
+  SHORTCUT_BORDERS,
   SHORTCUT_MOUSEGRAB,
   SHORTCUT_COLDRESET,
   SHORTCUT_WARMRESET,
diff -r b5c20dca2330 src/shortcut.c
--- a/src/shortcut.c	Tue Nov 21 22:04:24 2017 +0200
+++ b/src/shortcut.c	Tue Nov 21 22:06:41 2017 +0200
@@ -50,6 +50,15 @@
 	}
 }
 
+/*-----------------------------------------------------------------------*/
+/**
+ * Shortcut to toggle borders
+ */
+static void ShortCut_Borders(void)
+{
+	ConfigureParams.Screen.bAllowOverscan = !ConfigureParams.Screen.bAllowOverscan;
+	Screen_ModeChanged(false);  /* false: re-create window only if size changed */
+}
 
 /*-----------------------------------------------------------------------*/
 /**
@@ -281,6 +290,9 @@
 	 case SHORTCUT_FULLSCREEN:
 		ShortCut_FullScreen();		/* Switch between fullscreen/windowed mode */
 		break;
+	 case SHORTCUT_BORDERS:
+		ShortCut_Borders();		/* Toggle Atari borders */
+		break;
 	 case SHORTCUT_MOUSEGRAB:
 		ShortCut_MouseGrab();		/* Toggle mouse grab */
 		break;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/