Changeset - r28747:c18b8e5fa74a
[Not reviewed]
master
0 1 0
Patric Stout - 10 months ago 2024-02-12 02:19:08
truebrain@openttd.org
Fix: visually also disable vsync when not using HW acceleration (#12066)
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -719,24 +719,25 @@ struct GameOptionsWindow : Window {
 
					ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, WL_ERROR);
 
				}
 
				this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
 
				this->SetWidgetDirty(WID_GO_FULLSCREEN_BUTTON);
 
				break;
 

	
 
			case WID_GO_VIDEO_ACCEL_BUTTON:
 
				_video_hw_accel = !_video_hw_accel;
 
				ShowErrorMessage(STR_GAME_OPTIONS_VIDEO_ACCELERATION_RESTART, INVALID_STRING_ID, WL_INFO);
 
				this->SetWidgetLoweredState(WID_GO_VIDEO_ACCEL_BUTTON, _video_hw_accel);
 
				this->SetWidgetDirty(WID_GO_VIDEO_ACCEL_BUTTON);
 
#ifndef __APPLE__
 
				this->SetWidgetLoweredState(WID_GO_VIDEO_VSYNC_BUTTON, _video_hw_accel && _video_vsync);
 
				this->SetWidgetDisabledState(WID_GO_VIDEO_VSYNC_BUTTON, !_video_hw_accel);
 
				this->SetWidgetDirty(WID_GO_VIDEO_VSYNC_BUTTON);
 
#endif
 
				break;
 

	
 
			case WID_GO_VIDEO_VSYNC_BUTTON:
 
				if (!_video_hw_accel) break;
 

	
 
				_video_vsync = !_video_vsync;
 
				VideoDriver::GetInstance()->ToggleVsync(_video_vsync);
 

	
 
				this->SetWidgetLoweredState(WID_GO_VIDEO_VSYNC_BUTTON, _video_vsync);
 
@@ -959,25 +960,25 @@ struct GameOptionsWindow : Window {
 
	 * @param data Information about the changed data. @see GameOptionsInvalidationData
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetLoweredState(WID_GO_SURVEY_PARTICIPATE_BUTTON, _settings_client.network.participate_survey == PS_YES);
 
		this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
 
		this->SetWidgetLoweredState(WID_GO_VIDEO_ACCEL_BUTTON, _video_hw_accel);
 
		this->SetWidgetDisabledState(WID_GO_REFRESH_RATE_DROPDOWN, _video_vsync);
 

	
 
#ifndef __APPLE__
 
		this->SetWidgetLoweredState(WID_GO_VIDEO_VSYNC_BUTTON, _video_vsync);
 
		this->SetWidgetLoweredState(WID_GO_VIDEO_VSYNC_BUTTON, _video_hw_accel && _video_vsync);
 
		this->SetWidgetDisabledState(WID_GO_VIDEO_VSYNC_BUTTON, !_video_hw_accel);
 
#endif
 

	
 
		this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, _gui_scale_cfg == -1);
 
		this->SetWidgetLoweredState(WID_GO_GUI_SCALE_BEVEL_BUTTON, _settings_client.gui.scale_bevels);
 
#ifdef HAS_TRUETYPE_FONT
 
		this->SetWidgetLoweredState(WID_GO_GUI_FONT_SPRITE, _fcsettings.prefer_sprite);
 
		this->SetWidgetLoweredState(WID_GO_GUI_FONT_AA, _fcsettings.global_aa);
 
		this->SetWidgetDisabledState(WID_GO_GUI_FONT_AA, _fcsettings.prefer_sprite);
 
#endif /* HAS_TRUETYPE_FONT */
 

	
 
		this->SetWidgetDisabledState(WID_GO_BASE_GRF_DROPDOWN, _game_mode != GM_MENU);
0 comments (0 inline, 0 general)