From ad652706d66ac2d5d2654b650ae13b87b5248a07 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Tue, 3 May 2016 00:39:31 +0100 Subject: [PATCH] debugger:windows: Fix vanishing breakpoints when scrollbar disappears On Windows, it seems that if you resize the columns in the size event handler when the scrollbar disappears, the listview contents may decide to disappear as well. So let's avoid the resize for this case. --- pcsx2/gui/Debugger/DebuggerLists.cpp | 10 ++++++++-- pcsx2/gui/Debugger/DebuggerLists.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pcsx2/gui/Debugger/DebuggerLists.cpp b/pcsx2/gui/Debugger/DebuggerLists.cpp index 1af111b9c9..a59608e91d 100644 --- a/pcsx2/gui/Debugger/DebuggerLists.cpp +++ b/pcsx2/gui/Debugger/DebuggerLists.cpp @@ -31,6 +31,7 @@ GenericListView::GenericListView(wxWindow* parent, GenericListViewColumn* column : wxListView(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_VIRTUAL|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER) { m_isInResizeColumn = false; + dontResizeColumnsInSizeEventHandler = false; insertColumns(columns, columnCount); } @@ -72,7 +73,12 @@ void GenericListView::resizeColumns(int totalWidth) void GenericListView::sizeEvent(wxSizeEvent& evt) { - resizeColumns(GetClientSize().x); + // HACK: On Windows, it seems that if you resize the columns in the size + // event handler when the scrollbar disappears, the listview contents may + // decide to disappear as well. So let's avoid the resize for this case. + if (!dontResizeColumnsInSizeEventHandler) + resizeColumns(GetClientSize().x); + dontResizeColumnsInSizeEventHandler = false; evt.Skip(); } @@ -110,7 +116,7 @@ void GenericListView::update() // make the scrollbar go away, so let's make it recalculate if it needs it SetItemCount(newRows); } - + dontResizeColumnsInSizeEventHandler = true; Refresh(); } diff --git a/pcsx2/gui/Debugger/DebuggerLists.h b/pcsx2/gui/Debugger/DebuggerLists.h index 7f0d1efa10..cbb628e9c3 100644 --- a/pcsx2/gui/Debugger/DebuggerLists.h +++ b/pcsx2/gui/Debugger/DebuggerLists.h @@ -65,6 +65,7 @@ private: GenericListViewColumn* columns; wxPoint clickPos; + bool dontResizeColumnsInSizeEventHandler; }; class BreakpointList: public GenericListView