diff --git a/src/gfx.cpp b/src/gfx.cpp index d6d130f0a0..00692f0a57 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1542,7 +1542,7 @@ void DrawDirtyBlocks() RedrawScreenRect(0, 0, _screen.width, _screen.height); Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { - w->flags &= ~(WF_DIRTY | WF_WIDGETS_DIRTY); + w->flags &= ~(WF_DIRTY | WF_WIDGETS_DIRTY | WF_DRAG_DIRTIED); } _whole_screen_dirty = false; } else { @@ -1562,6 +1562,7 @@ void DrawDirtyBlocks() Window *w; FOR_ALL_WINDOWS_FROM_BACK(w) { + w->flags &= ~WF_DRAG_DIRTIED; if (!MayBeShown(w)) continue; if (w->viewport != nullptr) w->viewport->is_drawn = false; diff --git a/src/window.cpp b/src/window.cpp index 0d0e9995d7..ea6988b6c0 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2244,7 +2244,10 @@ static EventState HandleWindowDragging() break; } - w->SetDirtyAsBlocks(); + if (!(w->flags & WF_DRAG_DIRTIED)) { + w->flags |= WF_DRAG_DIRTIED; + w->SetDirtyAsBlocks(); + } int x = _cursor.pos.x + _drag_delta.x; int y = _cursor.pos.y + _drag_delta.y; diff --git a/src/window_gui.h b/src/window_gui.h index a189715268..25fe48124b 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -254,6 +254,7 @@ enum WindowFlags : uint16 { WF_CENTERED = 1 << 10, ///< Window is centered and shall stay centered after ReInit. WF_DIRTY = 1 << 11, ///< Whole window is dirty, and requires repainting. WF_WIDGETS_DIRTY = 1 << 12, ///< One or more widgets are dirty, and require repainting. + WF_DRAG_DIRTIED = 1 << 13, ///< The window has already been marked dirty as blocks as part of the current drag operation }; DECLARE_ENUM_AS_BIT_SET(WindowFlags)