Quit via File -> Exit / Alt+F4 instead of Escape
Escape was a leftover spike convenience that quit the tool. Esc is a common in-game key, so dropping it from a borderless mirror was too easy to do by accident. Remove the Escape-quit handler and add a File -> Exit menu item (shown with its Alt+F4 shortcut). Alt+F4 already worked via DefWindowProc -> WM_CLOSE -> WM_DESTROY; the menu item sets a one-shot flag the main loop reads. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -204,14 +204,10 @@ LRESULT CALLBACK D3D11Window::wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||
self->resize_height_ = HIWORD(lparam);
|
||||
}
|
||||
return 0;
|
||||
case WM_KEYDOWN:
|
||||
// Spike convenience: Esc quits so we aren't stuck in a borderless window.
|
||||
if (wparam == VK_ESCAPE)
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
// Reached by the close button, Alt+F4 (DefWindowProc turns it into WM_CLOSE ->
|
||||
// DestroyWindow), and our own teardown. Esc deliberately does NOT quit -- it's a
|
||||
// common in-game key, so quitting is via the File -> Exit menu item or Alt+F4.
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
default:
|
||||
|
||||
@@ -241,6 +241,11 @@ int run()
|
||||
}
|
||||
coop::apply_layout_end_frame(); // clear the one-shot "Reset layout" force
|
||||
|
||||
if (ui.request_quit) // File -> Exit
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Forward the host window's mouse/keyboard into the game (when the MKB
|
||||
// subsystem is on, we're focused, and ImGui isn't using the event).
|
||||
coop::forward_mkb_frame(injection, window.hwnd(), capture.mirroring(), capture.source_hooked());
|
||||
|
||||
@@ -169,6 +169,15 @@ float draw_main_menu_bar(UiState& ui, const FrameStats& stats)
|
||||
ImGui::TextUnformatted("CoopAllTheThings");
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("Exit", "Alt+F4"))
|
||||
{
|
||||
ui.request_quit = true; // the main loop sees this and stops
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("View"))
|
||||
{
|
||||
ImGui::MenuItem("Controllers", nullptr, &ui.show_controllers);
|
||||
@@ -190,9 +199,9 @@ float draw_main_menu_bar(UiState& ui, const FrameStats& stats)
|
||||
|
||||
if (ImGui::BeginMenu("Help"))
|
||||
{
|
||||
ImGui::TextDisabled("F1 hide/show this overlay");
|
||||
ImGui::TextDisabled("F2 release/clip the operator cursor");
|
||||
ImGui::TextDisabled("Esc quit");
|
||||
ImGui::TextDisabled("F1 hide/show this overlay");
|
||||
ImGui::TextDisabled("F2 release/clip the operator cursor");
|
||||
ImGui::TextDisabled("Alt+F4 quit (or File -> Exit)");
|
||||
ImGui::Separator();
|
||||
ImGui::TextDisabled("This window is what Remote Play");
|
||||
ImGui::TextDisabled("Together captures.");
|
||||
|
||||
@@ -20,6 +20,7 @@ struct UiState
|
||||
bool show_audio = true;
|
||||
bool show_log = true;
|
||||
bool debug_details = false; // off = general status; on = full diagnostics
|
||||
bool request_quit = false; // set by File -> Exit; the main loop reads it and stops
|
||||
};
|
||||
|
||||
// Persist the verbosity-affecting UI switches (currently the "Debug details" toggle)
|
||||
|
||||
Reference in New Issue
Block a user