---
title: "AwaitPointerEventScope"
description: "Receiver scope for awaiting pointer events in a call to
[PointerInputScope.awaitPointerEventScope].

This is a restricted suspension scope. Code in this scope is always called un-dispatched and may
only suspend for calls to [awaitPointerEvent]. These functions resume synchronously and the
caller may mutate the result **before** the next await call to affect the next stage of the input
processing pipeline."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
@RestrictsSuspension
@JvmDefaultWithCompatibility
interface AwaitPointerEventScope : Density
```


Receiver scope for awaiting pointer events in a call to
`PointerInputScope.awaitPointerEventScope`.

This is a restricted suspension scope. Code in this scope is always called un-dispatched and may
only suspend for calls to `awaitPointerEvent`. These functions resume synchronously and the
caller may mutate the result **before** the next await call to affect the next stage of the input
processing pipeline.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val size: IntSize
```


The measured size of the pointer input region. Input events will be reported with a
coordinate space of (0, 0) to (size.width, size,height) as the input region, with (0, 0)
indicating the upper left corner.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val extendedTouchPadding: Size
```


<div class='sourceset sourceset-common'>Common</div>


```kotlin
val currentEvent: PointerEvent
```


The `PointerEvent` from the most recent touch event.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val viewConfiguration: ViewConfiguration
```


The `ViewConfiguration` used to tune gesture detectors.



## Functions

```kotlin
suspend fun awaitPointerEvent(pass: PointerEventPass = PointerEventPass.Main): PointerEvent
```


Suspend until a `PointerEvent` is reported to the specified input `pass`. `pass` defaults to
`PointerEventPass.Main`.

`awaitPointerEvent` resumes **synchronously** in the restricted suspension scope. This means
that callers can react immediately to input after `awaitPointerEvent` returns and affect both
the current frame and the next handler or phase of the input processing pipeline. Callers
should mutate the returned `PointerEvent` before awaiting another event to consume aspects of
the event before the next stage of input processing runs.


```kotlin
suspend fun <T> withTimeoutOrNull(
        timeMillis: Long,
        block: suspend AwaitPointerEventScope.() -> T,
    ): T?
```


Runs `block` and returns the result of `block` or `null` if `timeMillis` has passed before
`timeMillis`.


```kotlin
suspend fun <T> withTimeout(
        timeMillis: Long,
        block: suspend AwaitPointerEventScope.() -> T,
    ): T
```


Runs `block` and returns its results. An `PointerEventTimeoutCancellationException` is thrown
if `timeMillis` has passed before `block` completes.



