Now I had some time to think about this (was tracking another bug ;) )... I think if I go with this idea, I'll have to revamp the patch and not check that within UpdateSize itself, since UpdatePage may have to be called even if width & height don't change. To avoid calling GetClientRect twice, I thought of factoring it like this:
First, take out the GetClientRect from UpdateSize (and add two parameters to it, the width & height). Of course, at WM_SIZE do the GetClientRect portion and pass that to UpdateSize, so it will be identical to before (in behavior).
Second, in SetColumnWidth, use GetClientRect and check if width & height changed at all; if they did, set the column_width and call UpdateSize. If they did not, then check if column_width changed and call UpdatePage (i.e. the original code's behavior).
Would that be better? Or am I overcomplicating it and the current patch is fine here?
On Tue, Aug 21, 2018 at 5:09 PM, Gabriel Ivăncescu gabrielopcode@gmail.com wrote:
Actually, I thought of something else: why not just add a check in LISTBOX_UpdateSize itself to see if width and height have changed at all? And if they haven't, just return early?
This should alleviate any issues since in this case, calling UpdateSize from SetColumnWidth when the size itself hasn't changed shouldn't do a thing (it will return early from it and not invalidate anything).
If that's ok, I will prepare a patch for that. (obviously, it will be a separate patch, this one is still valid in this case)