Move to C var; handle keyboard/mouse fullscreen conditions

This commit is contained in:
Thraka
2025-11-16 12:02:27 -08:00
parent e80dc4a541
commit 3d9f31e85f
6 changed files with 9 additions and 9 deletions

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);

View File

@@ -67,6 +67,8 @@ extern int qt_nvr_save(void);
extern bool cpu_thread_running;
};
int fullscreen_ui_visible = 0;
#include <QGuiApplication>
#include <QWindow>
#include <QTimer>
@@ -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);
}

View File

@@ -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;