From 19917654aa2823f8a911b559d0c6def37f8c88a3 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 10 Oct 2017 01:41:53 -0300 Subject: [PATCH] Adds support for Alt+F4 to close a program's window (Windows-only). --- internal/c/libqb.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index d5a1d3e0a..463556f4f 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -33054,6 +33054,16 @@ QB64_GAMEPAD_INIT(); goto key_handled; } + #ifdef QB64_WINDOWS + //note: Alt+F4 is supposed to close the window, but glut windows don't seem to be affected; + //this addresses the issue: + if ( (x==(0x3E00)) && (keyheld(VK+QBVK_RALT)||keyheld(VK+QBVK_LALT)) ){ + if (exit_blocked){exit_value|=1; goto key_handled;} + close_program=1; + goto key_handled; + } + #endif + //note: On early keyboards without a Pause key (before the introduction of 101-key keyboards) the Pause function was assigned to Ctrl+NumLock, and the Break function to Ctrl+ScrLock; these key-combinations still work with most programs, even on modern PCs with modern keyboards. //PAUSE handling if ( (x==(VK+QBVK_PAUSE)) || ((x==(VK+QBVK_NUMLOCK))&&(keyheld(VK+QBVK_LCTRL)||keyheld(VK+QBVK_RCTRL))) ){