mirror of
https://github.com/sal063/AC6_recomp
synced 2026-08-21 23:00:53 -04:00
Add keybind F11 to toggle fullscreen
Records the choice through the same user_value path as a settings-menu edit.
This commit is contained in:
@@ -498,6 +498,19 @@ bool ReXApp::OnInitialize() {
|
||||
window_->AddListener(this);
|
||||
window_->AddInputListener(this, 0);
|
||||
|
||||
// F11 toggles borderless fullscreen (rebindable via the bind_fullscreen
|
||||
// cvar). The change is recorded through the same path as a settings-menu
|
||||
// edit (SetFlagByName -> user_value), so "Save to config" persists it and
|
||||
// the next launch starts in the chosen mode.
|
||||
rex::ui::RegisterBind("bind_fullscreen", "F11", "Toggle fullscreen", [this] {
|
||||
if (!window_) {
|
||||
return;
|
||||
}
|
||||
bool new_fullscreen = !window_->IsFullscreen();
|
||||
window_->SetFullscreen(new_fullscreen);
|
||||
rex::cvar::SetFlagByName("fullscreen", new_fullscreen ? "true" : "false");
|
||||
});
|
||||
|
||||
// Attach window to input system so deferred drivers (e.g. MnK) can register
|
||||
if (runtime_ && runtime_->input_system()) {
|
||||
static_cast<rex::input::InputSystem*>(runtime_->input_system())->AttachWindow(window_.get());
|
||||
@@ -610,6 +623,9 @@ void ReXApp::OnDestroy() {
|
||||
// Notify subclass before cleanup
|
||||
OnShutdown();
|
||||
|
||||
// The fullscreen bind's callback captures this - drop it before teardown.
|
||||
rex::ui::UnregisterBind("bind_fullscreen");
|
||||
|
||||
// ImGui cleanup (reverse of setup)
|
||||
settings_overlay_.reset();
|
||||
console_overlay_.reset();
|
||||
|
||||
+6
@@ -209,6 +209,12 @@ void UnregisterBind(std::string_view name) {
|
||||
}
|
||||
|
||||
bool ProcessKeyEvent(KeyEvent& e) {
|
||||
// Auto-repeat never fires binds: every bind is a toggle-style action, so a
|
||||
// held key would fire it once per repeat (fullscreen thrash, overlay
|
||||
// flicker). Only the initial down transition counts.
|
||||
if (e.prev_state()) {
|
||||
return false;
|
||||
}
|
||||
std::lock_guard lock(g_binds_mutex);
|
||||
for (auto& entry : g_binds) {
|
||||
if (!entry.callback)
|
||||
|
||||
Reference in New Issue
Block a user