Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/codeql.yml # .github/workflows/commit-checker.yml # .github/workflows/release-linux-legacy.yml # .github/workflows/release-linux.yml # .github/workflows/release-macos.yml # .github/workflows/release-windows-store.yml # .github/workflows/release-windows.yml # .github/workflows/upload-cdn.yml # .github/workflows/upload-gog.yml # .github/workflows/upload-steam.yml # src/console_cmds.cpp # src/core/math_func.hpp # src/fios.cpp # src/fios.h # src/intro_gui.cpp # src/network/network_server.cpp # src/openttd.cpp # src/settings.cpp # src/settings_gui.cpp # src/settings_internal.h # src/settings_table.cpp # src/settings_type.h # src/table/settings.h.preamble # src/table/settings/company_settings.ini # src/table/settings/currency_settings.ini # src/table/settings/difficulty_settings.ini # src/table/settings/economy_settings.ini # src/table/settings/game_settings.ini # src/table/settings/gui_settings.ini # src/table/settings/linkgraph_settings.ini # src/table/settings/locale_settings.ini # src/table/settings/misc_settings.ini # src/table/settings/multimedia_settings.ini # src/table/settings/network_private_settings.ini # src/table/settings/network_settings.ini # src/table/settings/news_display_settings.ini # src/table/settings/old_gameopt_settings.ini # src/table/settings/pathfinding_settings.ini # src/table/settings/script_settings.ini # src/table/settings/win32_settings.ini # src/table/settings/window_settings.ini # src/table/settings/world_settings.ini # src/viewport.cpp # src/viewport_func.h # src/window.cpp
This commit is contained in:
@@ -1578,8 +1578,8 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height)
|
||||
ResizeWindow(this, enlarge_x, enlarge_y);
|
||||
/* ResizeWindow() calls this->OnResize(). */
|
||||
} else {
|
||||
/* Always call OnResize; that way the scrollbars and matrices get initialized. */
|
||||
this->OnResize();
|
||||
/* Schedule OnResize; that way the scrollbars and matrices get initialized. */
|
||||
this->ScheduleResize();
|
||||
}
|
||||
|
||||
int nx = this->left;
|
||||
@@ -2197,8 +2197,8 @@ void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
|
||||
|
||||
EnsureVisibleCaption(w, w->left, w->top);
|
||||
|
||||
/* Always call OnResize to make sure everything is initialised correctly if it needs to be. */
|
||||
w->OnResize();
|
||||
/* Schedule OnResize to make sure everything is initialised correctly if it needs to be. */
|
||||
w->ScheduleResize();
|
||||
extern bool _gfx_draw_active;
|
||||
if (_gfx_draw_active) {
|
||||
SetWindowDirtyPending(w);
|
||||
@@ -3272,6 +3272,7 @@ void UpdateWindows()
|
||||
|
||||
/* Process invalidations before anything else. */
|
||||
for (Window *w : Window::Iterate()) {
|
||||
w->ProcessScheduledResize();
|
||||
w->ProcessScheduledInvalidations();
|
||||
w->ProcessHighlightedInvalidations();
|
||||
}
|
||||
@@ -3314,7 +3315,7 @@ void UpdateWindows()
|
||||
|
||||
for (Window *w : Window::Iterate()) {
|
||||
/* Update viewport only if window is not shaded. */
|
||||
if (w->viewport != nullptr && !w->IsShaded()) UpdateNextViewportPosition(w);
|
||||
if (w->viewport != nullptr && !w->IsShaded()) UpdateNextViewportPosition(w, delta_ms);
|
||||
}
|
||||
|
||||
DrawDirtyBlocks();
|
||||
@@ -3375,6 +3376,26 @@ void SetWindowClassesDirty(WindowClass cls)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this window as resized and in need of OnResize() event.
|
||||
*/
|
||||
void Window::ScheduleResize()
|
||||
{
|
||||
this->scheduled_resize = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process scheduled OnResize() event.
|
||||
*/
|
||||
void Window::ProcessScheduledResize()
|
||||
{
|
||||
/* Sometimes OnResize() resizes the window again, in which case we can reprocess immediately. */
|
||||
while (this->scheduled_resize) {
|
||||
this->scheduled_resize = false;
|
||||
this->OnResize();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this window's data as invalid (in need of re-computing)
|
||||
* @param data The data to invalidate with
|
||||
|
Reference in New Issue
Block a user