Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Touchscreen

Brew MP defines events to represent user interaction with a touchscreen device. Brew MP supports touchscreens that accept single or multiple touch events.

Use the /BREW/Display//TouchMode setting to determine the capabilities of the touchscreen, where is the class ID of the display to query. For example, for the primary display, the item is named:

/BREW/Display/010127d4/TouchMode

Currently defined values for this item are:

  • None - touchscreen is not supported
  • Singletouch - display is capable of 1 touch contact
  • Dualtouch - display is capable of 2 touch contacts
  • Multitouch - display is capable of 3 or more touch contacts

The following events represent touchscreen interaction:

  • EVT_POINTER_DOWN
  • EVT_POINTER_UP
  • EVT_POINTER_MOVE
  • EVT_POINTER_STALE_MOVE
  • EVT_POINTER_MT_DOWN
  • EVT_POINTER_MT_MOVE
  • EVT_POINTER_MT_UP
Event Description
EVT_POINTER_DOWN Sent when the single or primary pointing device comes in contact with the screen.
EVT_POINTER_UP Sent when the single or primary pointing device loses contact with the screen.
EVT_POINTER_MOVE Sent when the single or primary pointing device moves on the screen while maintaining contact with the screen.
EVT_POINTER_STALE_MOVE Sent by Brew MP instead of EVT_POINTER_MOVE when there is more than one EVT_POINTER_MOVE event already in the queue.
EVT_POINTER_MT_DOWN Multi-touch down event, same as EVT_POINTER_DOWN for pointer IDs other than 1.
EVT_POINTER_MT_MOVE Multi-touch move event, same as EVT_POINTER_MOVE for pointer IDs other than 1.
EVT_POINTER_MT_UP Multi-touch up event, same as EVT_POINTER_UP for pointer IDs other than 1.

Note: Pen events (EVT_PEN_DOWN, EVT_PEN_MOVE, EVT_PEN_UP and EVT_PEN_STALE_MOVE) are deprecated in Brew MP. Use the EVT_POINTER_MOVE, EVT_POINTER_UP, EVT_POINTER_DOWN, and EVT_POINTER_STALE_MOVE events instead. Pointer events are discussed in detail in the Pointer events use-case scenarios topic.

Handling multi-touch events

Each pointer is assigned an ID. For single touch events, and for the first pointer in a multitouch event, the pointer is set to ptrID=1; pointer IDs are incremented for each additional pointer.

EVT_POINTER_UP and EVT_POINTER_DOWN events are used for all ptrID=1 events, regardless of the number of pointers in play, and EVT_POINTER_MT_UP and EVT_POINTER_MT_DOWN are used for additional pointer IDs. Up and down events contain information about a single pointer per event.

If the multi-touch event includes ptrID=1, EVT_POINTER_MOVE is used for all move events; EVT_POINTER_MT_MOVE is only used for events that do not include prtID=1. Move events contain information about all pointers that are currently in contact with the display.

The format for a multi-touch event is an extension of the standard pointer event. For example:

"x=00000017,y=FFFFFFFB,time=00003456,clkcnt=2,modifiers=000000000000000
dispID=010127D4,ptrID=01,nextptr=0000007E,
x_02=00000022,y_02=00000001,nextptr_02=00000030,"
x_04=00000087,y_04=00000023,nextptr_04=00000000,"

Use the AEE_POINTER_GET_NEXT_POINTER(), AEE_POINTER_GET_MT_NEXT_POINTER(), and AEE_POINTER_GET_MT_XY_PTRID() functions to process these events.