examples/vtouchpad/mouse_x11.c file

Mouse X11 implementation.

Contents

Classes

struct mouse

Functions

auto mouse_new(void) -> mouse_t*
Allocates a new mouse data structure.
auto mouse_free(mouse_t* mouse) -> void*
Frees a previously allocated mouse_t pointer.
auto mouse_move_relative(mouse_t* mouse, int x_off, int y_off) -> int
Moves the mouse pointed by mouse to the offsets x_off and y_off.
auto mouse_down(mouse_t* mouse, int button) -> int
Makes a 'button press' event according to the mouse pointer and the button (left or right).
auto mouse_up(mouse_t* mouse, int button) -> int
Makes a 'button release' event according to the mouse pointer and the button (left or right).

Function documentation

mouse_t* mouse_new(void)

Allocates a new mouse data structure.

Returns Returns a new mouse_t pointer object.

Do nothing, stub.

void* mouse_free(mouse_t* mouse)

Frees a previously allocated mouse_t pointer.

Returns Always NULL.

Do nothing, stub.

int mouse_move_relative(mouse_t* mouse, int x_off, int y_off)

Moves the mouse pointed by mouse to the offsets x_off and y_off.

Parameters
mouse Mouse structure pointer.
x_off X-coordinate offset.
y_off Y-coordinate offset.
Returns Returns 0 if success, 1 otherwise.

int mouse_down(mouse_t* mouse, int button)

Makes a 'button press' event according to the mouse pointer and the button (left or right).

Parameters
mouse Mouse structure pointer.
button Which button was pressed (either MOUSE_BTN_LEFT or MOUSE_BTN_RIGHT).
Returns Returns 0 if success, 1 otherwise.

int mouse_up(mouse_t* mouse, int button)

Makes a 'button release' event according to the mouse pointer and the button (left or right).

Parameters
mouse Mouse structure pointer.
button Which button was released (either MOUSE_BTN_LEFT or MOUSE_BTN_RIGHT).
Returns Returns 0 if success, 1 otherwise.