file
vtouchpad.cMain file.
Contents
- Reference
Functions
-
auto parse_event(const char* ev,
int* error) -> struct mouse_
event - Given a string
ev
containing a single event, parses it as expected. -
void onopen(ws_
cli_ conn_ t* client) - On open event, just signals that a new client has been connected.
-
void onclose(ws_
cli_ conn_ t* client) - On close event, just signals that a client has been disconnected.
-
void onmessage(ws_
cli_ conn_ t* client, const unsigned char* msg, uint64_t size, int type) - For each new event, parses the string as expected all call the appropriate routines.
Function documentation
struct mouse_ event parse_event(const char* ev,
int* error)
Given a string ev
containing a single event, parses it as expected.
Parameters | |
---|---|
ev | String representing the event. |
error | Set to 1 if an error was found, 0 otherwise. |
Returns | Returns a mouse_ |
The event can be (D stands to 'delimiter', currently ';'): (Mouse Movement): mouse_move D off_X D off_Y, where the offset is an integer type that represents the amount of pixels the mouse have to move. Example: mouse_move;10;-20.
Negative offsets represents movement to the left and to the top. Positive offsets are the opposite.
(Mouse Button Press): Represents if a mouse button has been pressed or released.
Valid events are: a) mouse_btn_left_down (left button press) b) mouse_btn_left_up (left button release) c) mouse_btn_right_down d) mouse_btn_right_up
void onopen(ws_ cli_ conn_ t* client)
On open event, just signals that a new client has been connected.
Parameters | |
---|---|
client | Client connection. |
void onclose(ws_ cli_ conn_ t* client)
On close event, just signals that a client has been disconnected.
Parameters | |
---|---|
client | Client connection. |
void onmessage(ws_ cli_ conn_ t* client,
const unsigned char* msg,
uint64_t size,
int type)
For each new event, parses the string as expected all call the appropriate routines.
Parameters | |
---|---|
client | Client connection. (ignored) |
msg | Received message/event. |
size | Message size (in bytes). (ignored) |
type | Message type. (ignored) |