mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 01:25:33 -07:00
Merge pull request #6481 from Thraka/showui
Add a shortcut key to toggle the UI when fullscreen
This commit is contained in:
@@ -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 */
|
||||
@@ -286,6 +287,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"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1297,7 +1297,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,6 +1464,7 @@ MainWindow::on_actionFullscreen_triggered()
|
||||
if (!hide_tool_bar)
|
||||
ui->toolBar->show();
|
||||
video_fullscreen = 0;
|
||||
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);
|
||||
}
|
||||
@@ -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,32 @@ MainWindow::on_actionUpdate_status_bar_icons_triggered()
|
||||
status->clearActivity();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::toggleFullscreenUI()
|
||||
{
|
||||
if (video_fullscreen == 0)
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionTake_screenshot_triggered()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
/* Mouse capture state before showing fullscreen UI */
|
||||
bool mouse_was_captured = false;
|
||||
|
||||
friend class SpecifyDimensions;
|
||||
friend class ProgSettings;
|
||||
friend class RendererCommon;
|
||||
|
||||
Reference in New Issue
Block a user