Added new -alt-enter cmd-line switch to allow configuration of Alt+Enter behaviour (#556)

This commit is contained in:
tomcw 2018-06-10 18:14:34 +01:00
parent d2a34dfae0
commit 4a0e93fe28
5 changed files with 32 additions and 7 deletions

View File

@ -68,8 +68,13 @@
<br><br>
-dcd<br>
For the SSC's 6551's Status register's DCD bit, use this switch to force AppleWin to use the state of the MS_RLSD_ON bit from GetCommModemStatus().<br><br>
-alt-enter=&lt;toggle-full-screen|open-apple-enter&gt;<br>
Define the behavior of Alt+Enter:
<ul>
<li>Either: Toggle between windowed and full screen video modes (default).
<li>Or: Allow the emulated Apple II to read the Enter key state when Alt (Open Apple key) is pressed.
</ul>
<br>
<br>
<P style="FONT-WEIGHT: bold">Debug arguments:
</P>

View File

@ -73,7 +73,7 @@
<p><span style="font-weight: bold;">Ctrl+PrintScrn:</span><br>
Copy the text screen (auto detect 40/80 columns) to the clipboard.</p>
<p><span style="font-weight: bold;">Alt+Enter:</span><br>
Toggle between windowed and full screen video modes. (NB. Will conflict with emulation when doing Open Apple + Enter.)</p>
Default: Toggle between windowed and full screen video modes. (NB. Will conflict with emulation and prevent Open Apple + Enter from being readable. Use the <a href="CommandLine.html">Command Line</a> switch to allow Open Apple + Enter to be readable.)</p>
<p><span style="font-weight: bold;">Function Keys F1-F8:</span><br>
These PC function keys correspond to buttons on the <a href="toolbar.html">toolbar</a>.</p>
<p><span style="font-weight: bold;">Function Key F2 + Ctrl:</span><br>

View File

@ -1257,6 +1257,14 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
{
sg_SSC.SupportDCD(true);
}
else if (strcmp(lpCmdLine, "-alt-enter=toggle-full-screen") == 0) // GH#556
{
SetAltEnterToggleFullScreen(true);
}
else if (strcmp(lpCmdLine, "-alt-enter=open-apple-enter") == 0) // GH#556
{
SetAltEnterToggleFullScreen(false);
}
else // unsupported
{
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);

View File

@ -175,6 +175,15 @@ void ScreenWindowResize(const bool bCtrlKey);
void FrameResizeWindow(int nNewScale);
// ==========================================================================
static bool g_bAltEnter_ToggleFullScreen = true; // Default for ALT+ENTER is to toggle between windowed and full-screen modes
void SetAltEnterToggleFullScreen(bool mode)
{
g_bAltEnter_ToggleFullScreen = mode;
}
// ==========================================================================
// Display construction:
@ -1733,15 +1742,15 @@ LRESULT CALLBACK FrameWndProc (
}
break;
case WM_SYSKEYDOWN:
case WM_SYSKEYDOWN: // ALT + any key; or F10
KeybUpdateCtrlShiftStatus();
// http://msdn.microsoft.com/en-us/library/windows/desktop/gg153546(v=vs.85).aspx
// v1.25.0: Alt-Return Alt-Enter toggle fullscreen
if (g_bAltKey && (wparam == VK_RETURN)) // NB. VK_RETURN = 0x0D; Normally WM_CHAR will be 0x0A but ALT key triggers as WM_SYSKEYDOWN and VK_MENU
if (g_bAltEnter_ToggleFullScreen && g_bAltKey && (wparam == VK_RETURN)) // NB. VK_RETURN = 0x0D; Normally WM_CHAR will be 0x0A but ALT key triggers as WM_SYSKEYDOWN and VK_MENU
return 0; // NOP -- eat key
else
PostMessage(window,WM_KEYDOWN,wparam,lparam);
PostMessage(window,WM_KEYDOWN,wparam,lparam);
if ((wparam == VK_F10) || (wparam == VK_MENU)) // VK_MENU == ALT Key
return 0;
@ -1752,10 +1761,11 @@ LRESULT CALLBACK FrameWndProc (
KeybUpdateCtrlShiftStatus();
// v1.25.0: Alt-Return Alt-Enter toggle fullscreen
if (g_bAltKey && (wparam == VK_RETURN)) // NB. VK_RETURN = 0x0D; Normally WM_CHAR will be 0x0A but ALT key triggers as WM_SYSKEYDOWN and VK_MENU
if (g_bAltEnter_ToggleFullScreen && g_bAltKey && (wparam == VK_RETURN)) // NB. VK_RETURN = 0x0D; Normally WM_CHAR will be 0x0A but ALT key triggers as WM_SYSKEYDOWN and VK_MENU
ScreenWindowResize(false);
else
PostMessage(window,WM_KEYUP,wparam,lparam);
break;
case WM_MENUCHAR: // GH#556 - Suppress the Windows Default Beep (ie. Ding) whenever ALT+<key> is pressed

View File

@ -61,3 +61,5 @@
UINT GetFrameBufferHeight(void);
UINT Get3DBorderWidth(void);
UINT Get3DBorderHeight(void);
void SetAltEnterToggleFullScreen(bool mode);