Add fullscreen fallback mode, and titlebar control

This commit is contained in:
Lorenzooone 2024-06-26 21:35:50 +02:00
parent 9bb96819d3
commit d893ccf7a0
7 changed files with 148 additions and 38 deletions

View File

@ -38,6 +38,7 @@ enum VideoMenuOutAction{
VIDEO_MENU_FAST_POLL,
VIDEO_MENU_NON_INT_SCALING,
VIDEO_MENU_SCALING_RATIO_SETTINGS,
VIDEO_MENU_CHANGE_TITLEBAR,
};
class VideoMenu : public OptionSelectionMenu {
@ -45,7 +46,7 @@ public:
VideoMenu(bool font_load_success, sf::Font &text_font);
~VideoMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, bool fast_poll, ScreenType screen_type);
void insert_data(ScreenType s_type, bool is_fullscreen);
void insert_data(ScreenType s_type, bool is_fullscreen, bool can_have_titlebar);
VideoMenuOutAction selected_index = VideoMenuOutAction::VIDEO_MENU_NO_ACTION;
void reset_output_option();
protected:

View File

@ -37,6 +37,8 @@ struct ScreenInfo {
NonIntegerScalingModes non_integer_mode;
bool use_non_integer_scaling_top;
bool use_non_integer_scaling_bottom;
bool failed_fullscreen;
bool have_titlebar;
};
struct DisplayData {

View File

@ -85,6 +85,7 @@ private:
bool call_rotate;
bool call_blur;
bool call_screen_settings_update;
bool call_titlebar;
};
struct ResizingScreenData {
sf::Vector2f size;
@ -227,6 +228,7 @@ private:
void bottom_pos_change(int new_bottom_pos);
void non_int_scaling_change(bool target_top);
void non_int_mode_change(bool positive);
void titlebar_change();
bool query_reset_request();
void reset_held_times();
void poll_window(bool do_everything);
@ -255,7 +257,7 @@ private:
int get_fullscreen_offset_x(int top_width, int top_height, int bot_width, int bot_height);
int get_fullscreen_offset_y(int top_width, int top_height, int bot_width, int bot_height);
void resize_window_and_out_rects(bool do_work = true);
void create_window(bool re_prepare_size);
void create_window(bool re_prepare_size, bool reset_text = true);
std::string title_factory();
void update_view_size();
void open();

View File

@ -7,6 +7,7 @@ struct VideoMenuOptionInfo {
const std::string false_name;
const bool active_fullscreen;
const bool active_windowed_screen;
const bool requires_titlebar_possible;
const bool active_joint_screen;
const bool active_top_screen;
const bool active_bottom_screen;
@ -19,158 +20,165 @@ struct VideoMenuOptionInfo {
static const VideoMenuOptionInfo vsync_option = {
.base_name = "Turn VSync Off", .false_name = "Turn VSync On",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_VSYNC};
static const VideoMenuOptionInfo async_option = {
.base_name = "Turn Async Off", .false_name = "Turn Async On",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_ASYNC};
static const VideoMenuOptionInfo blur_option = {
.base_name = "Turn Blur Off", .false_name = "Turn Blur On",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_BLUR};
static const VideoMenuOptionInfo padding_option = {
.base_name = "Turn Padding Off", .false_name = "Turn Padding On",
.active_fullscreen = false, .active_windowed_screen = true,
.active_fullscreen = false, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_PADDING};
static const VideoMenuOptionInfo crop_option = {
.base_name = "Crop Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_CROPPING};
static const VideoMenuOptionInfo top_par_option = {
.base_name = "Top Screen PAR", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_TOP_PAR};
static const VideoMenuOptionInfo bot_par_option = {
.base_name = "Bottom Screen PAR", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_BOT_PAR};
static const VideoMenuOptionInfo one_par_option = {
.base_name = "Screen PAR", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = false, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_ONE_PAR};
static const VideoMenuOptionInfo bottom_screen_pos_option = {
.base_name = "Screens Relative Positions", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_BOTTOM_SCREEN_POS};
static const VideoMenuOptionInfo small_screen_offset_option = {
.base_name = "Screen Offset", .false_name = "",
.active_fullscreen = false, .active_windowed_screen = true,
.active_fullscreen = false, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = true, .dec_str = "-", .inc_str = "+", .inc_out_action = VIDEO_MENU_SMALL_SCREEN_OFFSET_INC,
.out_action = VIDEO_MENU_SMALL_SCREEN_OFFSET_DEC};
static const VideoMenuOptionInfo offset_settings_option = {
.base_name = "Offset Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_fullscreen = true, .active_windowed_screen = false, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_OFFSET_SETTINGS};
static const VideoMenuOptionInfo window_scaling_option = {
.base_name = "Scaling Factor", .false_name = "",
.active_fullscreen = false, .active_windowed_screen = true,
.active_fullscreen = false, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = true, .dec_str = "-", .inc_str = "+", .inc_out_action = VIDEO_MENU_WINDOW_SCALING_INC,
.out_action = VIDEO_MENU_WINDOW_SCALING_DEC};
static const VideoMenuOptionInfo bfi_settings_option = {
.base_name = "BFI Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_BFI_SETTINGS};
static const VideoMenuOptionInfo menu_scaling_option = {
.base_name = "Menu Scaling", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = true, .dec_str = "-", .inc_str = "+", .inc_out_action = VIDEO_MENU_MENU_SCALING_INC,
.out_action = VIDEO_MENU_MENU_SCALING_DEC};
static const VideoMenuOptionInfo resolution_settings_option = {
.base_name = "Resolution Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_fullscreen = true, .active_windowed_screen = false, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_RESOLUTION_SETTINGS};
static const VideoMenuOptionInfo rotation_settings_option = {
.base_name = "Rotation Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_ROTATION_SETTINGS};
static const VideoMenuOptionInfo top_one_rotation_option = {
.base_name = "Screen Rotation", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = false, .active_top_screen = true, .active_bottom_screen = false,
.is_inc = true, .dec_str = "Left", .inc_str = "Right", .inc_out_action = VIDEO_MENU_TOP_ROTATION_INC,
.out_action = VIDEO_MENU_TOP_ROTATION_DEC};
static const VideoMenuOptionInfo bottom_one_rotation_option = {
.base_name = "Screen Rotation", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = false, .active_top_screen = false, .active_bottom_screen = true,
.is_inc = true, .dec_str = "Left", .inc_str = "Right", .inc_out_action = VIDEO_MENU_BOTTOM_ROTATION_INC,
.out_action = VIDEO_MENU_BOTTOM_ROTATION_DEC};
static const VideoMenuOptionInfo fast_poll_option = {
.base_name = "Disable Slow Poll", .false_name = "Enable Slow Poll",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_FAST_POLL};
static const VideoMenuOptionInfo allow_game_crops_option = {
.base_name = "Disable Game Crops", .false_name = "Enable Game Crops",
.active_fullscreen = true, .active_windowed_screen = true,
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_GAMES_CROPPING};
static const VideoMenuOptionInfo allow_fill_scaling_option = {
.base_name = "Disable Fill Scaling", .false_name = "Enable Fill Scaling",
.active_fullscreen = true, .active_windowed_screen = false,
.active_fullscreen = true, .active_windowed_screen = false, .requires_titlebar_possible = false,
.active_joint_screen = false, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_NON_INT_SCALING};
static const VideoMenuOptionInfo scaling_ratio_settings_option = {
.base_name = "Scaling & Ratio Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_fullscreen = true, .active_windowed_screen = false, .requires_titlebar_possible = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_SCALING_RATIO_SETTINGS};
static const VideoMenuOptionInfo titlebar_change_option = {
.base_name = "Disable Titlebar", .false_name = "Enable Titlebar",
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
.out_action = VIDEO_MENU_CHANGE_TITLEBAR};
static const VideoMenuOptionInfo* pollable_options[] = {
&crop_option,
&window_scaling_option,
@ -191,6 +199,7 @@ static const VideoMenuOptionInfo* pollable_options[] = {
&bot_par_option,
&one_par_option,
&allow_game_crops_option,
&titlebar_change_option,
&resolution_settings_option,
&padding_option,
&bfi_settings_option,
@ -222,7 +231,7 @@ void VideoMenu::class_setup() {
this->show_title = true;
}
void VideoMenu::insert_data(ScreenType s_type, bool is_fullscreen) {
void VideoMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool can_have_titlebar) {
this->num_enabled_options = 0;
for(int i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
bool valid = true;
@ -236,6 +245,8 @@ void VideoMenu::insert_data(ScreenType s_type, bool is_fullscreen) {
valid = valid && pollable_options[i]->active_bottom_screen;
else
valid = valid && pollable_options[i]->active_joint_screen;
if((!can_have_titlebar) && pollable_options[i]->requires_titlebar_possible)
valid = false;
if(valid) {
this->options_indexes[this->num_enabled_options] = i;
this->num_enabled_options++;
@ -326,6 +337,9 @@ void VideoMenu::prepare(float menu_scaling_factor, int view_size_x, int view_siz
else if(screen_type == ScreenType::BOTTOM)
this->labels[index]->setText(this->setTextOptionBool(real_index, info->use_non_integer_scaling_bottom));
break;
case VIDEO_MENU_CHANGE_TITLEBAR:
this->labels[index]->setText(this->setTextOptionBool(real_index, info->have_titlebar));
break;
default:
break;
}

View File

@ -228,6 +228,7 @@ void WindowScreen::reset_operations(ScreenOperations &operations) {
operations.call_rotate = false;
operations.call_screen_settings_update = false;
operations.call_blur = false;
operations.call_titlebar = false;
}
void WindowScreen::free_ownership_of_window(bool is_main_thread) {
@ -339,16 +340,30 @@ void WindowScreen::window_factory(bool is_main_thread) {
this->loaded_operations.call_create = false;
}
if(this->loaded_operations.call_create) {
this->notification->setShowText(false);
this->m_win.setActive(true);
this->main_thread_owns_window = is_main_thread;
bool previously_open = this->m_win.isOpen();
sf::Vector2i prev_pos = sf::Vector2i(0, 0);
if(previously_open)
prev_pos = this->m_win.getPosition();
if(!this->loaded_info.is_fullscreen) {
this->update_screen_settings();
this->m_win.create(sf::VideoMode(this->m_width, this->m_height), this->title_factory());
if(this->loaded_info.have_titlebar)
this->m_win.create(sf::VideoMode(this->m_width, this->m_height), this->title_factory());
else
this->m_win.create(sf::VideoMode(this->m_width, this->m_height), this->title_factory(), sf::Style::None);
this->update_view_size();
}
else
this->m_win.create(this->curr_desk_mode, this->title_factory(), sf::Style::Fullscreen);
else {
if(!this->loaded_info.failed_fullscreen)
this->m_win.create(this->curr_desk_mode, this->title_factory(), sf::Style::Fullscreen);
else if(this->loaded_info.have_titlebar)
this->m_win.create(this->curr_desk_mode, this->title_factory());
else
this->m_win.create(this->curr_desk_mode, this->title_factory(), sf::Style::None);
}
if(previously_open && this->loaded_operations.call_titlebar)
this->m_win.setPosition(prev_pos);
this->last_window_creation_time = std::chrono::high_resolution_clock::now();
this->update_screen_settings();
this->loaded_operations.call_create = false;
@ -864,9 +879,13 @@ void WindowScreen::resize_window_and_out_rects(bool do_work) {
}
}
void WindowScreen::create_window(bool re_prepare_size) {
if(!this->m_info.is_fullscreen)
void WindowScreen::create_window(bool re_prepare_size, bool reset_text) {
if(reset_text)
this->notification->setShowText(false);
this->m_info.failed_fullscreen = false;
if(!this->m_info.is_fullscreen) {
this->m_info.show_mouse = !this->display_data->mono_app_mode;
}
else {
bool success = false;
if((this->m_info.fullscreen_mode_width > 0) && (this->m_info.fullscreen_mode_height > 0) && (this->m_info.fullscreen_mode_bpp > 0)) {
@ -890,12 +909,29 @@ void WindowScreen::create_window(bool re_prepare_size) {
success = this->curr_desk_mode.isValid();
}
#endif
if(!success) {
std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
if(modes.size() > 0) {
this->curr_desk_mode = modes[0];
success = this->curr_desk_mode.isValid();
}
}
if(!success) {
if((this->m_info.fullscreen_mode_width <= 0) || (this->m_info.fullscreen_mode_height <= 0) || (this->m_info.fullscreen_mode_bpp <= 0)) {
this->m_info.fullscreen_mode_width = FALLBACK_FS_RESOLUTION_WIDTH;
this->m_info.fullscreen_mode_height = FALLBACK_FS_RESOLUTION_HEIGHT;
this->m_info.fullscreen_mode_bpp = FALLBACK_FS_RESOLUTION_BPP;
}
this->curr_desk_mode = sf::VideoMode(this->m_info.fullscreen_mode_width, this->m_info.fullscreen_mode_height, this->m_info.fullscreen_mode_bpp);
this->m_info.failed_fullscreen = true;
}
this->m_window_width = curr_desk_mode.width;
this->m_window_height = curr_desk_mode.height;
this->m_info.show_mouse = false;
}
if(re_prepare_size)
this->prepare_size_ratios(false, false);
this->reset_held_times();
this->future_operations.call_create = true;
}

View File

@ -2,6 +2,38 @@
#define FPS_WINDOW_SIZE 64
static const sf::VideoMode default_fs_mode_4_5k_macos = sf::VideoMode(4480, 2520);
static const sf::VideoMode default_fs_mode_4k_macos = sf::VideoMode(4096, 2304);
static const sf::VideoMode default_fs_mode_4k = sf::VideoMode(3840, 2160);
static const sf::VideoMode default_fs_mode_1440p = sf::VideoMode(2560, 1440);
static const sf::VideoMode default_fs_mode_4_5k_half_macos = sf::VideoMode(2240, 1260);
static const sf::VideoMode default_fs_mode_4k_half_macos = sf::VideoMode(2048, 1152);
static const sf::VideoMode default_fs_mode_1080p = sf::VideoMode(1920, 1080);
static const sf::VideoMode default_fs_mode_1050p = sf::VideoMode(1680, 1050);
static const sf::VideoMode default_fs_mode_900p = sf::VideoMode(1600, 900);
static const sf::VideoMode default_fs_mode_720p = sf::VideoMode(1280, 720);
static const sf::VideoMode default_fs_mode_600p = sf::VideoMode(800, 600);
static const sf::VideoMode default_fs_mode_480p = sf::VideoMode(720, 480);
static const sf::VideoMode default_fs_mode_240p = sf::VideoMode(400, 240);
static const sf::VideoMode default_fs_mode_240p_2 = sf::VideoMode(320, 240);
static const sf::VideoMode* default_fs_modes[] = {
&default_fs_mode_4_5k_macos,
&default_fs_mode_4k_macos,
&default_fs_mode_4k,
&default_fs_mode_1440p,
&default_fs_mode_4_5k_half_macos,
&default_fs_mode_4k_half_macos,
&default_fs_mode_1080p,
&default_fs_mode_1050p,
&default_fs_mode_900p,
&default_fs_mode_720p,
&default_fs_mode_600p,
&default_fs_mode_480p,
&default_fs_mode_240p,
&default_fs_mode_240p_2,
};
static void check_held_reset(bool value, HeldTime &action_time) {
if(value) {
if(!action_time.started) {
@ -117,6 +149,8 @@ void WindowScreen::fullscreen_change() {
this->setup_no_menu();
this->m_info.is_fullscreen = !this->m_info.is_fullscreen;
this->create_window(true);
if(this->m_info.is_fullscreen && this->m_info.failed_fullscreen)
this->print_notification("Fullscreen impossible", TEXT_KIND_ERROR);
}
void WindowScreen::async_change() {
@ -307,6 +341,12 @@ void WindowScreen::non_int_mode_change(bool positive) {
this->future_operations.call_screen_settings_update = true;
}
void WindowScreen::titlebar_change() {
this->m_info.have_titlebar = !this->m_info.have_titlebar;
this->create_window(true, false);
this->future_operations.call_titlebar = true;
}
bool WindowScreen::can_execute_cmd(const WindowCommand* window_cmd, bool is_extra, bool is_always) {
if((!window_cmd->usable_always) && is_always)
return false;
@ -594,7 +634,7 @@ void WindowScreen::setup_video_menu(bool reset_data) {
this->curr_menu = VIDEO_MENU_TYPE;
if(reset_data)
this->video_menu->reset_data();
this->video_menu->insert_data(this->m_stype, this->m_info.is_fullscreen);
this->video_menu->insert_data(this->m_stype, this->m_info.is_fullscreen, (!this->m_info.is_fullscreen) || this->m_info.failed_fullscreen);
this->last_menu_change_time = std::chrono::high_resolution_clock::now();
}
}
@ -736,11 +776,18 @@ void WindowScreen::setup_resolution_menu(bool reset_data) {
if(this->curr_menu != RESOLUTION_MENU_TYPE) {
this->possible_resolutions.clear();
std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
if(modes.size() > 0)
if(modes.size() > 0) {
this->possible_resolutions.push_back(modes[0]);
for(int i = 1; i < modes.size(); ++i)
if(this->possible_resolutions[0].bitsPerPixel == modes[i].bitsPerPixel)
this->possible_resolutions.push_back(modes[i]);
for(int i = 1; i < modes.size(); ++i)
if(this->possible_resolutions[0].bitsPerPixel == modes[i].bitsPerPixel)
this->possible_resolutions.push_back(modes[i]);
}
else {
this->print_notification("No Fullscreen resolution found", TEXT_KIND_WARNING);
for(int i = 0; i < (sizeof(default_fs_modes) / sizeof(default_fs_modes[0])); i++) {
this->possible_resolutions.push_back(*default_fs_modes[i]);
}
}
if(this->possible_resolutions.size() > 0) {
this->curr_menu = RESOLUTION_MENU_TYPE;
if(reset_data)
@ -748,8 +795,6 @@ void WindowScreen::setup_resolution_menu(bool reset_data) {
this->resolution_menu->insert_data(&this->possible_resolutions);
this->last_menu_change_time = std::chrono::high_resolution_clock::now();
}
else
this->print_notification("No Resolution found", TEXT_KIND_WARNING);
}
}
@ -1377,6 +1422,9 @@ void WindowScreen::poll(bool do_everything) {
case VIDEO_MENU_SCALING_RATIO_SETTINGS:
this->setup_scaling_ratio_menu();
break;
case VIDEO_MENU_CHANGE_TITLEBAR:
this->titlebar_change();
break;
default:
break;
}

View File

@ -434,6 +434,8 @@ void reset_screen_info(ScreenInfo &info) {
info.non_integer_mode = SMALLER_PRIORITY;
info.use_non_integer_scaling_top = false;
info.use_non_integer_scaling_bottom = false;
info.failed_fullscreen = false;
info.have_titlebar = true;
}
static float offset_sanitization(float value) {
@ -592,6 +594,10 @@ bool load_screen_info(std::string key, std::string value, std::string base, Scre
info.use_non_integer_scaling_bottom = std::stoi(value);
return true;
}
if(key == (base + "have_titlebar")) {
info.have_titlebar = std::stoi(value);
return true;
}
return false;
}
@ -627,6 +633,7 @@ std::string save_screen_info(std::string base, const ScreenInfo &info) {
out += base + "non_integer_mode=" + std::to_string(info.non_integer_mode) + "\n";
out += base + "use_non_integer_scaling_top=" + std::to_string(info.use_non_integer_scaling_top) + "\n";
out += base + "use_non_integer_scaling_bottom=" + std::to_string(info.use_non_integer_scaling_bottom) + "\n";
out += base + "have_titlebar=" + std::to_string(info.have_titlebar) + "\n";
return out;
}