Changeset - r28303:33171aadc9f1
[Not reviewed]
master
0 1 0
Peter Nelson - 6 months ago 2023-12-18 13:05:06
peter1138@openttd.org
Fix: Window width/height was doubly-scaled with automatic DPI switch. (#11598)
1 file changed with 0 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -1999,14 +1999,12 @@ bool AdjustGUIZoom(bool automatic)
 
	   to move around when the application is moved to a screen with different DPI. */
 
	auto zoom_shift = old_gui_zoom - _gui_zoom;
 
	for (Window *w : Window::Iterate()) {
 
		if (automatic) {
 
			w->left   = (w->left   * _gui_scale) / old_scale;
 
			w->top    = (w->top    * _gui_scale) / old_scale;
 
			w->width  = (w->width  * _gui_scale) / old_scale;
 
			w->height = (w->height * _gui_scale) / old_scale;
 
		}
 
		if (w->viewport != nullptr) {
 
			w->viewport->zoom = Clamp(ZoomLevel(w->viewport->zoom - zoom_shift), _settings_client.gui.zoom_min, _settings_client.gui.zoom_max);
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)