Compress calls to `updateSize`

Authored by hein on Nov 19 2018, 7:25 AM.



Repeater+Flow has no reliable way to transactionize/batch insertion,
e.g. Flow.positionCompleted is useless in a function that can change
the Flow's size, and transition events like populated and similar
aren't available. Refactoring this to be a ListView isn't appealing
because it would mean the code loses the property of being reused for
both the bar and the popup, and therefore is well-tested already.

This brings down the number of updateSize calls when opening the
dialog for a group of five from five to one.


Diff Detail

R119 Plasma Desktop
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
hein created this revision.Nov 19 2018, 7:25 AM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 19 2018, 7:25 AM
hein requested review of this revision.Nov 19 2018, 7:25 AM
davidedmundson accepted this revision.Nov 19 2018, 8:59 AM

Use of callLater seems like a neat solution, does it make aboutToPopulate redundant?


I remember looking into this.

I was thinking this should be:

(!groupRepeater.aboutToPopulate && visualParent.childCount == groupRepeater.count)

As if we're still aboutToPopulate then we shouldn't be doing anything.

But then I changed it and it didn't immediately work so I did nothing.

This revision is now accepted and ready to land.Nov 19 2018, 8:59 AM
hein added inline comments.Nov 19 2018, 9:36 AM

The suggested code is the same as the present code, so not sure ... can you clarify?

The aboutToPopulate thing is done for the focus-active-task. I'm not sure I want to replace this with callLater, since callLater has weakly defined semantics for me tastes. For the updateSize case only eventual consistency counts. If it was executed too early and then later again it'd at worst be more like the old performance, but not break things. With the focus-active-task code, though, it could break things.

davidedmundson added inline comments.Nov 19 2018, 9:37 AM

My line changes

|| -> &&
This revision was automatically updated to reflect the committed changes.

Now the group looks like this.
After clicking on it, the plasmashell falls.
You can check it on unstable KDE
after updating from;O=D