Skip to content

Commit

Permalink
Don't explicitly invalidate the scene when the input handler needs to…
Browse files Browse the repository at this point in the history
… send synthetic events, as that now happens automatically via recomposer.hasPendingWork
  • Loading branch information
m-sasha committed Apr 10, 2024
1 parent 6e996ee commit c653da1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ internal abstract class BaseComposeScene(
private var hasPendingDraws = true
protected fun invalidateIfNeeded() {
hasPendingDraws = frameClock.hasAwaiters ||
snapshotInvalidationTracker.hasInvalidations ||
inputHandler.hasInvalidations
snapshotInvalidationTracker.hasInvalidations
if (hasPendingDraws && !isInvalidationDisabled && !isClosed && composition != null) {
invalidate()
}
Expand Down Expand Up @@ -163,7 +162,7 @@ internal abstract class BaseComposeScene(
doLayout() // Layout

// Schedule synthetic events to be sent after `render` completes
if (inputHandler.hasInvalidations) {
if (inputHandler.needUpdatePointerPosition) {
recomposer.scheduleAsEffect(updatePointerPosition)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ internal class ComposeSceneInputHandler(
get() = pointerPositions.values.firstOrNull()

/**
* Indicates if there were invalidations and triggering [BaseComposeScene.measureAndLayout]
* is now required.
* Indicates whether [updatePointerPosition] needs to be called.
*/
val hasInvalidations: Boolean
val needUpdatePointerPosition: Boolean
get() = syntheticEventSender.needUpdatePointerPosition

fun onPointerEvent(
Expand Down

0 comments on commit c653da1

Please sign in to comment.