~/bend-docscommunity

src/dev/pointer.bend checks

raw source on the hub · import 0x7fea7bfac3f0390a60760e0485feacff/src/dev/pointer.bend as Pointer

3 imports
import Base
import ../virtio/input.bend as In
import ./keymap.bend as Km

Definitions

def Ptr.pix source · line 16 · raw

@+v:F32 -> U32

A pixel position as a whole pixel (0 left of or above the window). The laws take the pixels from here on: the checker does not evaluate F32.

def Ptr.clamp source · line 20 · raw

@+p:U32 -> @+size:U32 -> U32

A pixel as a window coordinate, 0..size-1.

def Ptr.scale source · line 26 · raw

@+v:U32 -> @+size:U32 -> U32

A window coordinate (0..size-1) on the tablet's 0..32767 scale. v * 32767 fits a U32 below 131072; past that (a window wider than any framebuffer the host maps) the coordinate and the size lose their low 4 bits first.

def Ptr.button source · line 32 · raw

@+b:U32 -> Maybe<&2, U32>

A W3C button as the tablet's, if it has it.

def Ptr.press source · line 37 · raw

@b:Maybe<&2, U32> -> @down:Bool -> List<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/virtio/input.Hid>

def Ptr.at source · line 45 · raw

@+x:U32 -> @+y:U32 -> @+w:U32 -> @+h:U32 -> 0x7fea7bfac3f0390a60760e0485feacff/src/virtio/input.Hid

The tablet report for the pointer at pixel (x, y).

def Ptr.pressed source · line 49 · raw

@+x:U32 -> @+y:U32 -> @+w:U32 -> @+h:U32 -> @+b:U32 -> @down:Bool -> List<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/virtio/input.Hid>

A button (W3C's b) pressed or let go with the pointer at pixel (x, y).

def Ptr.hids source · line 54 · raw

@ev:Event -> @+w:U32 -> @+h:U32 -> List<&2, 0x7fea7bfac3f0390a60760e0485feacff/src/virtio/input.Hid>

The reports for one window event in a w x h window (none for Close, which the host handles, nor for Text, Scroll, Leave, Look and Focus).