I didn't look at the keyboard code...
Now the confirmation when "emergency quit" hotkey (It's in fact Ctrl+Esc, however Windows itself use it as a substitute to the Windows key so only Ctrl+Alt+Esc will work) down is also added.
Code:
--- /d/video_sdl.cpp Sat Jan 14 23:45:18 2012
+++ video_sdl.cpp Fri Jun 22 20:52:05 2012
@@ -88,6 +88,7 @@ static int display_type = DISPLAY_WINDOW
// Constants
#ifdef WIN32
const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes";
+const unsigned int fquit = 432;
#else
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
#endif
@@ -244,7 +245,19 @@ static LRESULT CALLBACK windows_message_
SysMediaArrived();
}
return 0;
-
+ break;
+ case WM_SYSCOMMAND:
+ if(wParam == fquit)
+ {
+ int rt;
+ rt = MessageBox(hwnd, "Do you really want to Force Quit Sheepshaver?",
+ "Sheepshaver", MB_ICONWARNING|MB_OKCANCEL);
+ if(rt == IDOK)
+ {
+ printf("Force quitting...\n");
+ quit_full_screen = true; emerg_quit = true;
+ }
+ }
default:
if (sdl_window_proc)
return CallWindowProc(sdl_window_proc, hwnd, msg, wParam, lParam);
@@ -1089,6 +1102,12 @@ bool SDL_monitor_desc::video_open(void)
HWND the_window = GetMainWindowHandle();
sdl_window_proc = (WNDPROC)GetWindowLongPtr(the_window, GWLP_WNDPROC);
SetWindowLongPtr(the_window, GWLP_WNDPROC, (LONG_PTR)windows_message_handler);
+
+ HMENU smenu = GetSystemMenu(the_window, 0);
+ unsigned int fp=fquit;
+ if (smenu)
+ AppendMenu(smenu, MF_STRING, (UINT_PTR)fp, "&Force Quit");
+
#endif
// Initialize VideoRefresh function
@@ -1701,7 +1720,23 @@ static int kc_decode(SDL_keysym const &
case SDLK_LEFT: return 0x3b;
case SDLK_RIGHT: return 0x3c;
- case SDLK_ESCAPE: if (is_ctrl_down(ks)) {if (!key_down) { quit_full_screen = true; emerg_quit = true; } return -2;} else return 0x35;
+ case SDLK_ESCAPE: if (is_ctrl_down(ks))
+ {
+ if (!key_down)
+ {
+#ifdef WIN32
+ HWND the_window = GetMainWindowHandle();
+ if ( MessageBox(the_window, "Do you really want to Force Quit Sheepshaver?",
+ "Sheepshaver", MB_ICONWARNING|MB_OKCANCEL) == IDOK )
+#endif
+ {
+ printf ("Force quitting on hotkey down...\n");
+ quit_full_screen = true; emerg_quit = true;
+ }
+ }
+ return -2;
+ }
+ else return 0x35;
case SDLK_F1: if (is_ctrl_down(ks)) {if (!key_down) SysMountFirstFloppy(); return -2;} else return 0x7a;
case SDLK_F2: return 0x78;