Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ display:
window:
fullscreen_on_startup: bool
fullscreen_exclusive: bool
fullscreen_resolution:
type: integer
default: 0
startup_size:
type: enum
values: [last_used, 640x480, 720x480, 1280x720, 1280x800, 1280x960, 1920x1080, 2560x1440, 2560x1600, 2560x1920, 3840x2160]
Expand Down
8 changes: 6 additions & 2 deletions ui/xemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,12 @@ static void set_full_screen(struct xemu_console *scon, bool set)
int num_modes = 0;
modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
if (modes && num_modes > 0) {
// First mode is the highest resolution, typically the native resolution
mode = modes[0];
// Use configured fullscreen resolution index, defaulting to 0 (highest resolution)
int mode_index = g_config.display.window.fullscreen_resolution;
if (mode_index < 0 || mode_index >= num_modes) {
mode_index = 0; // Fallback to highest resolution
}
mode = modes[mode_index];
}
}
if (mode) {
Expand Down
33 changes: 33 additions & 0 deletions ui/xui/main-menu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
#include "qapi/error.h"
#include "actions.hh"

#include <SDL3/SDL.h>

#include <vector>
#include <string>

#include "../xemu-input.h"
#include "../xemu-notifications.h"
#include "../xemu-settings.h"
Expand Down Expand Up @@ -775,6 +780,34 @@ void MainMenuDisplayView::Draw()
Toggle("Exclusive fullscreen",
&g_config.display.window.fullscreen_exclusive,
"May improve responsiveness, but slows window switching");
if (g_config.display.window.fullscreen_exclusive) {
// Get available fullscreen display modes
SDL_DisplayID display = SDL_GetDisplayForWindow(xemu_get_window());
int num_modes = 0;
SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
Comment thread
MasonT8198 marked this conversation as resolved.

if (modes && num_modes > 0) {
// Create a list of mode strings
std::vector<std::string> mode_strings;
for (int i = 0; i < num_modes; i++) {
char buf[64];
snprintf(buf, sizeof(buf), "%dx%d @ %.0fHz", modes[i]->w, modes[i]->h, modes[i]->refresh_rate);
mode_strings.push_back(buf);
}

// Create null-separated string for ChevronCombo
std::string items;
for (const auto& str : mode_strings) {
items += str;
items += '\0';
}
items += '\0'; // Double null terminate

ChevronCombo("Fullscreen resolution", &g_config.display.window.fullscreen_resolution,
items.c_str(), "Select preferred fullscreen resolution");
}
SDL_free(modes);
}
if (ChevronCombo("Window size", &g_config.display.window.startup_size,
"Last Used\0"
"640x480\0"
Expand Down
Loading