diff --git a/Windows/Debugger/Debugger_Lists.cpp b/Windows/Debugger/Debugger_Lists.cpp index 8870362516..97be390f59 100644 --- a/Windows/Debugger/Debugger_Lists.cpp +++ b/Windows/Debugger/Debugger_Lists.cpp @@ -307,7 +307,6 @@ void CtrlBreakpointList::reloadBreakpoints() // Update the items we're displaying from the debugger. displayedBreakPoints_ = CBreakPoints::GetBreakpoints(); displayedMemChecks_= CBreakPoints::GetMemChecks(); - Update(); for (int i = 0; i < GetRowCount(); i++) { @@ -321,6 +320,8 @@ void CtrlBreakpointList::reloadBreakpoints() else SetCheckState(i, displayedBreakPoints_[index].IsEnabled()); } + + Update(); } void CtrlBreakpointList::editBreakpoint(int itemIndex) diff --git a/Windows/W32Util/Misc.cpp b/Windows/W32Util/Misc.cpp index 2d7399f2e2..97f4e475e5 100644 --- a/Windows/W32Util/Misc.cpp +++ b/Windows/W32Util/Misc.cpp @@ -402,27 +402,36 @@ void GenericListControl::ProcessUpdate() { ListView_DeleteItem(handle,--items); } + for (auto &act : pendingActions_) { + switch (act.action) { + case Action::CHECK: + ListView_SetCheckState(handle, act.item, act.state ? TRUE : FALSE); + break; + + case Action::IMAGE: + ListView_SetItemState(handle, act.item, (act.state & 0xF) << 12, LVIS_STATEIMAGEMASK); + break; + } + } + pendingActions_.clear(); + ResizeColumns(); InvalidateRect(handle, nullptr, TRUE); - UpdateWindow(handle); ListView_RedrawItems(handle, 0, newRows - 1); + UpdateWindow(handle); updating = false; } -void GenericListControl::SetCheckState(int item, bool state) -{ - updating = true; - ListView_SetCheckState(handle,item,state ? TRUE : FALSE); - updating = false; +void GenericListControl::SetCheckState(int item, bool state) { + pendingActions_.push_back({ Action::CHECK, item, state ? 1 : 0 }); + Update(); } void GenericListControl::SetItemState(int item, uint8_t state) { - updating = true; - ListView_SetItemState(handle, item, (state & 0xF) << 12, LVIS_STATEIMAGEMASK); - ListView_RedrawItems(handle, item, item); - updating = false; + pendingActions_.push_back({ Action::IMAGE, item, (int)state }); + Update(); } void GenericListControl::ResizeColumns() diff --git a/Windows/W32Util/Misc.h b/Windows/W32Util/Misc.h index d20998fdc9..ddfaa0a893 100644 --- a/Windows/W32Util/Misc.h +++ b/Windows/W32Util/Misc.h @@ -105,4 +105,15 @@ private: volatile bool inResizeColumns; volatile bool updating; bool updateScheduled_ = false; + + enum class Action { + CHECK, + IMAGE, + }; + struct PendingAction { + Action action; + int item; + int state; + }; + std::vector pendingActions_; };