From 316e14d5de1fa1dbef40b34568bd760d21ae0edb Mon Sep 17 00:00:00 2001 From: Thraka Date: Sat, 15 Nov 2025 23:03:53 -0800 Subject: [PATCH 1/4] Add option to show UI while in fullscreen --- src/86box.c | 5 +++++ src/include/86box/86box.h | 2 +- src/qt/qt_mainwindow.cpp | 17 +++++++++++++++++ src/qt/qt_mainwindow.hpp | 4 ++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/86box.c b/src/86box.c index fae30ca5e..069aea60c 100644 --- a/src/86box.c +++ b/src/86box.c @@ -286,6 +286,11 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { .name="mute", .desc="Toggle mute", .seq="Ctrl+Alt+M" + }, + { + .name="toggle_ui_fullscreen", + .desc="Toggle UI in fullscreen", + .seq="Ctrl+Alt+PgDown" } }; diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 6c924e031..88acf5209 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -288,7 +288,7 @@ struct accelKey { char desc[64]; char seq[64]; }; -#define NUM_ACCELS 8 +#define NUM_ACCELS 9 extern struct accelKey acc_keys[NUM_ACCELS]; extern struct accelKey def_acc_keys[NUM_ACCELS]; extern int FindAccelerator(const char *name); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 1dfae0920..0d11a68ae 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1464,6 +1464,7 @@ MainWindow::on_actionFullscreen_triggered() if (!hide_tool_bar) ui->toolBar->show(); video_fullscreen = 0; + fullscreen_ui_visible = false; if (vid_resize != 1) { emit resizeContents(vid_resize == 2 ? fixed_size_x : monitors[0].mon_scrnsz_x, vid_resize == 2 ? fixed_size_y : monitors[0].mon_scrnsz_y); } @@ -1558,6 +1559,10 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("mute")) { ui->actionMute_Unmute->trigger(); } + if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("toggle_ui_fullscreen") + || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("toggle_ui_fullscreen")) { + toggleFullscreenUI(); + } return true; } @@ -2206,6 +2211,18 @@ MainWindow::on_actionUpdate_status_bar_icons_triggered() status->clearActivity(); } +void +MainWindow::toggleFullscreenUI() +{ + if (video_fullscreen == 0) + return; + + fullscreen_ui_visible ^= 1; + ui->menubar->setVisible(fullscreen_ui_visible); + ui->statusbar->setVisible(fullscreen_ui_visible && !hide_status_bar); + ui->toolBar->setVisible(fullscreen_ui_visible && !hide_tool_bar); +} + void MainWindow::on_actionTake_screenshot_triggered() { diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 916a254d0..4a0d50659 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -130,6 +130,7 @@ private slots: void on_actionHide_tool_bar_triggered(); void on_actionUpdate_status_bar_icons_triggered(); void on_actionTake_screenshot_triggered(); + void toggleFullscreenUI(); void on_actionMute_Unmute_triggered(); void on_actionSound_gain_triggered(); void on_actionPreferences_triggered(); @@ -197,6 +198,9 @@ private: /* Reload the renderers after closing renderer options dialog. */ bool reload_renderers = false; + /* Fullscreen UI visibility state */ + bool fullscreen_ui_visible = false; + friend class SpecifyDimensions; friend class ProgSettings; friend class RendererCommon; From e80dc4a541857a193468956a40685e6c4e41474d Mon Sep 17 00:00:00 2001 From: Thraka Date: Sat, 15 Nov 2025 23:16:54 -0800 Subject: [PATCH 2/4] Automatically release mouse; recapture mouse --- src/qt/qt_mainwindow.cpp | 14 ++++++++++++++ src/qt/qt_mainwindow.hpp | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 0d11a68ae..d5c3f26c4 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -2218,6 +2218,20 @@ MainWindow::toggleFullscreenUI() return; fullscreen_ui_visible ^= 1; + + if (fullscreen_ui_visible) { + // UI is being shown - save mouse capture state and release if captured + mouse_was_captured = (mouse_capture != 0); + if (mouse_was_captured) { + plat_mouse_capture(0); + } + } else { + // UI is being hidden - restore previous mouse capture state + if (mouse_was_captured) { + plat_mouse_capture(1); + } + } + ui->menubar->setVisible(fullscreen_ui_visible); ui->statusbar->setVisible(fullscreen_ui_visible && !hide_status_bar); ui->toolBar->setVisible(fullscreen_ui_visible && !hide_tool_bar); diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 4a0d50659..9bec1a049 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -201,6 +201,9 @@ private: /* Fullscreen UI visibility state */ bool fullscreen_ui_visible = false; + /* Mouse capture state before showing fullscreen UI */ + bool mouse_was_captured = false; + friend class SpecifyDimensions; friend class ProgSettings; friend class RendererCommon; From 3d9f31e85f05c1c54716cf37678fac52be9a0a96 Mon Sep 17 00:00:00 2001 From: Thraka Date: Sun, 16 Nov 2025 12:02:27 -0800 Subject: [PATCH 3/4] Move to C var; handle keyboard/mouse fullscreen conditions --- src/device/keyboard.c | 2 +- src/device/mouse_bus.c | 4 ++-- src/device/mouse_ps2.c | 2 +- src/include/86box/plat.h | 1 + src/qt/qt_mainwindow.cpp | 6 ++++-- src/qt/qt_mainwindow.hpp | 3 --- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/device/keyboard.c b/src/device/keyboard.c index 7806418dd..e77a5fc1d 100644 --- a/src/device/keyboard.c +++ b/src/device/keyboard.c @@ -372,7 +372,7 @@ keyboard_input(int down, uint16_t scan) /* kbc_at_log("Received scan code: %03X (%s)\n", scan & 0x1ff, down ? "down" : "up"); */ recv_key_ui[scan & 0x1ff] = down; - if (mouse_capture || !kbd_req_capture || video_fullscreen) { + if (mouse_capture || !kbd_req_capture || (video_fullscreen && !fullscreen_ui_visible)) { recv_key[scan & 0x1ff] = down; key_process(scan & 0x1ff, down); } diff --git a/src/device/mouse_bus.c b/src/device/mouse_bus.c index cd54f981a..52f7154a0 100644 --- a/src/device/mouse_bus.c +++ b/src/device/mouse_bus.c @@ -481,7 +481,7 @@ bm_poll(void *priv) int xor; int b = mouse_get_buttons_ex(); - if (!mouse_capture && !video_fullscreen) + if (!mouse_capture && !(video_fullscreen && !fullscreen_ui_visible)) return 1; if (!(dev->flags & FLAG_ENABLED)) @@ -543,7 +543,7 @@ bm_update_data(mouse_t *dev) int xor; /* If the counters are not frozen, update them. */ - if ((mouse_capture || video_fullscreen) && !(dev->flags & FLAG_HOLD)) { + if ((mouse_capture || (video_fullscreen && !fullscreen_ui_visible)) && !(dev->flags & FLAG_HOLD)) { /* Update the deltas and the delays. */ mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0); diff --git a/src/device/mouse_ps2.c b/src/device/mouse_ps2.c index 80d9f3876..9034d9322 100644 --- a/src/device/mouse_ps2.c +++ b/src/device/mouse_ps2.c @@ -332,7 +332,7 @@ ps2_poll(void *priv) atkbc_dev_t *dev = (atkbc_dev_t *) priv; int packet_size = (dev->flags & FLAG_INTMODE) ? 4 : 3; - int cond = (mouse_capture || video_fullscreen) && mouse_scan && (dev->mode == MODE_STREAM) && + int cond = (mouse_capture || (video_fullscreen && !fullscreen_ui_visible)) && mouse_scan && (dev->mode == MODE_STREAM) && mouse_state_changed() && (kbc_at_dev_queue_pos(dev, 1) < (FIFO_SIZE - packet_size)); if (cond) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index e18aa707b..7835fe3a2 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -132,6 +132,7 @@ extern int update_icons; extern int kbd_req_capture; extern int hide_status_bar; extern int hide_tool_bar; +extern int fullscreen_ui_visible; /* System-related functions. */ extern FILE *plat_fopen(const char *path, const char *mode); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index d5c3f26c4..44bf1269e 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -67,6 +67,8 @@ extern int qt_nvr_save(void); extern bool cpu_thread_running; }; +int fullscreen_ui_visible = 0; + #include #include #include @@ -1297,7 +1299,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode) case 0x10b: /* Microsoft scroll up normal */ case 0x180 ... 0x1ff: /* E0 break codes (including Microsoft scroll down normal) */ /* This key uses a break code as make. Send it manually, only on press. */ - if (down && (mouse_capture || !kbd_req_capture || video_fullscreen)) { + if (down && (mouse_capture || !kbd_req_capture || (video_fullscreen && !fullscreen_ui_visible))) { if (keycode & 0x100) keyboard_send(0xe0); keyboard_send(keycode & 0xff); @@ -1464,7 +1466,7 @@ MainWindow::on_actionFullscreen_triggered() if (!hide_tool_bar) ui->toolBar->show(); video_fullscreen = 0; - fullscreen_ui_visible = false; + fullscreen_ui_visible = 0; if (vid_resize != 1) { emit resizeContents(vid_resize == 2 ? fixed_size_x : monitors[0].mon_scrnsz_x, vid_resize == 2 ? fixed_size_y : monitors[0].mon_scrnsz_y); } diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 9bec1a049..1a1cf4f20 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -198,9 +198,6 @@ private: /* Reload the renderers after closing renderer options dialog. */ bool reload_renderers = false; - /* Fullscreen UI visibility state */ - bool fullscreen_ui_visible = false; - /* Mouse capture state before showing fullscreen UI */ bool mouse_was_captured = false; From 8d8d5708f57f8ff7929318e91203a109af4abb34 Mon Sep 17 00:00:00 2001 From: Thraka Date: Sun, 16 Nov 2025 17:51:24 -0800 Subject: [PATCH 4/4] Move variable declaration out of plat to general --- src/86box.c | 1 + src/qt/qt_mainwindow.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/86box.c b/src/86box.c index 069aea60c..fa7be14fe 100644 --- a/src/86box.c +++ b/src/86box.c @@ -171,6 +171,7 @@ int vid_api = 0; /* (C) video r int vid_cga_contrast = 0; /* (C) video */ int video_fullscreen = 0; /* (C) video */ int video_fullscreen_scale = 0; /* (C) video */ +int fullscreen_ui_visible = 0; /* (C) video */ int enable_overscan = 0; /* (C) video */ int force_43 = 0; /* (C) video */ int video_filter_method = 1; /* (C) video */ diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 44bf1269e..87415ba07 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -67,8 +67,6 @@ extern int qt_nvr_save(void); extern bool cpu_thread_running; }; -int fullscreen_ui_visible = 0; - #include #include #include