2.2.3.7.1.1 RDPINPUT_PEN_CONTACT

The RDPINPUT_PEN_CONTACT structure describes the characteristics of a contact that is encapsulated in an RDPINPUT_PEN_FRAME (section 2.2.3.7.1) structure.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

deviceId

fieldsPresent (variable)

...

x (variable)

...

y (variable)

...

contactFlags (variable)

...

penFlags (variable)

...

pressure (variable)

...

rotation (variable)

...

tiltX (variable)

...

tiltY (variable)

...

deviceId (1 byte): An 8-bit unsigned integer that specifies the ID assigned to the pen device. If the simultaneous injection of pen input was not negotiated using the RDPINPUT_SC_READY_PDU (section 2.2.3.1) and RDPINPUT_CS_READY_PDU (section 2.2.3.2) structures, then this ID MUST be set to zero.

fieldsPresent (variable): A TWO_BYTE_UNSIGNED_INTEGER (section 2.2.2.1) structure that specifies the presence of the optional penFlags, pressure, rotation, tiltX, and tiltY fields.

Flag

Meaning

PEN_CONTACT_PENFLAGS_PRESENT

0x0001

The optional penFlags field is present.

PEN_CONTACT_PRESSURE_PRESENT

0x0002

The optional pressure field is present.

PEN_CONTACT_ROTATION_PRESENT

0x0004

The optional rotation field is present.

PEN_CONTACT_TILTX_PRESENT

0x0008

The optional tiltX field is present.

PEN_CONTACT_TILTY_PRESENT

0x0010

The optional tiltY field is present.

x (variable):  A FOUR_BYTE_SIGNED_INTEGER (section 2.2.2.4) structure that specifies the x-coordinate (relative to the virtual-desktop origin) of the contact.

y (variable):  A FOUR_BYTE_SIGNED_INTEGER structure that specifies the y-coordinate (relative to the virtual-desktop origin) of the contact.

contactFlags (variable):  A FOUR_BYTE_UNSIGNED_INTEGER (section 2.2.2.3) structure that specifies the current state of the contact.

Flag

Meaning

CONTACT_FLAG_DOWN

0x0001

The contact transitioned to the engaged state (made contact).

CONTACT_FLAG_UPDATE

0x0002

Contact update.

CONTACT_FLAG_UP

0x0004

The contact transitioned from the engaged state (broke contact).

CONTACT_FLAG_INRANGE

0x0008

The contact has not departed and is still in range.

CONTACT_FLAG_INCONTACT

0x0010

The contact is in the engaged state.

CONTACT_FLAG_CANCELED

0x0020

The contact has been canceled.

This field MUST contain one of the following combinations of the contact state flags and MUST NOT contain any other combination:

  • UP

  • UP | CANCELED

  • UPDATE

  • UPDATE | CANCELED

  • DOWN | INRANGE | INCONTACT

  • UPDATE | INRANGE | INCONTACT

  • UP | INRANGE

  • UPDATE | INRANGE

The figure "Lifetime of a touch or pen contact" in section 3.1.1.1 describes the states through which a contact involved in a pen transaction can transition.

penFlags (variable): A FOUR_BYTE_UNSIGNED_INTEGER structure that specifies the current state of the pen.

Flag

Meaning

PEN_FLAG_BARREL_PRESSED

0x0001

Indicates that the barrel button is in the pressed state.

PEN_FLAG_ERASER_PRESSED

0x0002

Indicates that the eraser button is in the pressed state.

PEN_FLAG_INVERTED

0x0004

Indicates that the pen is inverted.

The presence of this field is indicated by the PEN_CONTACT_PENFLAGS_PRESENT (0x0001) flag in the fieldsPresent field.

pressure (variable):  An optional FOUR_BYTE_UNSIGNED_INTEGER structure that specifies the pressure applied to the pen. This value MUST be normalized in the range 0x00000000 to 0x00000400 (1024), inclusive. The presence of this field is indicated by the PEN_CONTACT_PRESSURE_PRESENT (0x0002) flag in the fieldsPresent field.

rotation (variable):  An optional TWO_BYTE_UNSIGNED_INTEGER structure that specifies the clockwise rotation (or twist) of the pen. This value MUST be in the range 0x00000000 to 0x00000167 (359), inclusive. The presence of this field is indicated by the PEN_CONTACT_ROTATION_PRESENT (0x0004) flag in the fieldsPresent field.

tiltX (variable):  An optional TWO_BYTE_SIGNED_INTEGER structure that specifies the angle of tilt of the pen along the x-axis. This value MUST be in the range -0x0000005A (-90) to 0x000005A (90), inclusive: a positive value indicates a tilt to the right. The presence of this field is indicated by the PEN_CONTACT_TILTX_PRESENT (0x0008) flag in the fieldsPresent field.

tiltY (variable):  An optional TWO_BYTE_SIGNED_INTEGER structure that specifies the angle of tilt of the pen along the y-axis. This value MUST be in the range -0x0000005A (-90) to 0x000005A (90), inclusive: a positive value indicates a tilt toward the user. The presence of this field is indicated by the PEN_CONTACT_TILTY_PRESENT (0x0010) flag in the fieldsPresent field.