Instruction set reference
HIPE_OP_EVENT
Generated by the server and sent to the client when a requested GUI event occurs.
- location: The tag element that the user interacted with
- arg[0]: The type of event (in the same form as in the event request)
- arg[1]: Detail about the event. This varies depending on the event type (see the table below). (E.g. for a "click" event, this will be the mouse button that generated the click, followed by the modifier keys held.)
- requestor: Sends back the user-defined value that was passed to Hipe in the HIPE_OP_EVENT_REQUEST call that set up these particular events.
Event details
The detail in arg[1] is a comma-separated list of numbers:
| Event | arg[1] |
|---|---|
| keydown, keyup | keyCode,modifiers |
| keypress | charCode (the character typed; no modifiers) |
| click | button,modifiers |
| mousedown, mouseup, mousemove, mouseenter, mouseleave, mouseover, mouseout | button,pageX,pageY,offsetX,offsetY,modifiers |
| dblclick, contextmenu | button,pageX,pageY,offsetX,offsetY,modifiers |
| wheel | deltaX,deltaY,deltaMode,modifiers (deltaMode: 0 = pixels, 1 = lines, 2 = pages) |
| Other events | 0 |
button is 1 for the left mouse button, 2 for the middle and 3 for the right.
modifiers is always present, and is 0 when no modifier keys are held. Otherwise it's the sum of: 1 = Shift, 2 = Alt, 4 = Ctrl, 8 = Meta. For example, Ctrl+S gives a keydown detail of 83,4, and Shift+Tab gives 9,1. On the keyup of a modifier key itself, that modifier is already released, so it isn't included.
Notes
Events that can arrive in fast bursts are combined before they are sent, so that a client isn't flooded with them. Each request gets its own combined stream. Such events are sent a few tens of milliseconds after they occur, at most:
- mousemove, scroll and resize: only the latest event of a burst is sent, since each one describes the current state.
- wheel: the deltas of a burst are added up and sent as one event, so no wheel travel is lost. For example, a quick spin of six notches of 60 pixels each arrives as a single event with a deltaY of 360. Events with a different deltaMode or modifier mask (e.g. Ctrl pressed during the spin) aren't combined with each other. Clients should therefore act on the size of the deltas (for example, zoom in proportion to the wheel travel) rather than treating each event as one notch: a single notch of some mice also arrives as several smaller deltas, which may or may not be combined.
The event detail provided in arg[1] may be inadequate for what you require. In this case, it may be necessary to use HIPE_OP_GET_ATTRIBUTE in order to obtain further information about how the tag has changed following the user's interaction.
