Use a Timer to switch on hover event handling and do the initial geo export.
ClosedPublic

Authored by hein on Aug 3 2016, 8:59 PM.

Details

Summary

Different versions of Qt (or maybe it's the position of Jupiter-vs-
Saturn) seem to behave differently with regard to whether delegates
in a Repeater+Flow package initially appear at 0,0 and then get moved
into position, or directly appear at target geometry. This is despite
the fact that we already layout before changing delegate visibility
to true.

The former behavior causes various problems. One of them is that after
clicking a launcher, a new task delegate can be under the mouse cursor
initially (even though it never shows up in a rendered frame - this
only matters for event checks) causing containsMouse to be true and
then never to go false as the item is moved from under the cursor
(which Qt Quick's hover handling famously can't handle). Another is
that we export delegate geometry in global coordinates to kwin so it
knows where to animate window minimization to, and this needs to be
the correct (i.e. 'final-initial') geometry.

Previously, we tried to handle this by only enabling hover event
handling and doing the initial geometry export on two triggers:

  • onVisibleChanged(true) && index == 0 + boolean fence=false
  • onXChanged + boolean fence=false

This worked, but breaks the case where an item actually appears at
the desired final-initial geometry directly, so not causing an
onXChanged.

After brainstorming we couldn't come up with a better alternative
than a trigger. Exploiting Flow's add transition seems to error-
prone given various gotchas mentioned in the docs, and delaying
things by one event loop iteration is too brittle, since we don't
know exactly how this interacts with scene graph positioning.

So this changes things to a singleshot timer, which is created and
started whenever a task is completed or changes its type to window
(the latter for the geo export). The duration matches what the
Flow move animation is set to (now ported to units) to make sure
it can't interfere.

Diff Detail

Repository
R119 Plasma Desktop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hein updated this revision to Diff 5659.Aug 3 2016, 8:59 PM
hein retitled this revision from to Use a Timer to switch on hover event handling and do the initial geo export..
hein updated this object.
hein edited the test plan for this revision. (Show Details)
hein added reviewers: Plasma, mart.
hein added a subscriber: plasma-devel.
Restricted Application added a project: Plasma. · View Herald TranscriptAug 3 2016, 8:59 PM
mart accepted this revision.Aug 4 2016, 9:04 PM
mart edited edge metadata.

this approach is a bit unfortunate, however, i can't think of any better solution for the problem, so +2 from me

This revision is now accepted and ready to land.Aug 4 2016, 9:04 PM
This revision was automatically updated to reflect the committed changes.