bx-lib : the Basic X11 Library tuned for C beginners  1.0
Functions
Actively reading the current state of the mouse
Input Control (how to deal with mouse and keyboard)

Functions

bx_mouse bx_read_mouse (bx_window win)
int bx_mouse_x (bx_mouse mouse)
int bx_mouse_xcanvas (bx_mouse mouse)
int bx_mouse_xscreen (bx_mouse mouse)
int bx_mouse_xwindow (bx_mouse mouse)
int bx_mouse_y (bx_mouse mouse)
int bx_mouse_ycanvas (bx_mouse mouse)
int bx_mouse_yscreen (bx_mouse mouse)
int bx_mouse_ywindow (bx_mouse mouse)
int bx_mouse_b1 (bx_mouse mouse)
int bx_mouse_b2 (bx_mouse mouse)
int bx_mouse_b3 (bx_mouse mouse)
int bx_mouse_b4 (bx_mouse mouse)
int bx_mouse_b5 (bx_mouse mouse)
int bx_mouse_b (bx_mouse mouse, int b)
int bx_mouse_shift (bx_mouse mouse)
int bx_mouse_ctrl (bx_mouse mouse)
int bx_mouse_alt (bx_mouse mouse)
int bx_mouse_altgr (bx_mouse mouse)

Detailed Description

Function Documentation

bx_mouse bx_read_mouse ( bx_window  win)

Takes a snapshot of the current state of the mouse (location and buttons).

Parameters
winthe window to use as referential for the mouse location.
Returns
a instantaneous snapshot of the mouse state
int bx_mouse_x ( bx_mouse  mouse)
int bx_mouse_xcanvas ( bx_mouse  mouse)

Gets the x-location of the mouse, relative to the canvas of the referential window

Parameters
mousea snapshot of the state of the mouse.
Returns
the x-location.
int bx_mouse_xscreen ( bx_mouse  mouse)

Gets the x-location of the mouse, relative to the top left corner of screen

Parameters
mousea snapshot of the state of the mouse.
Returns
the x-location.
int bx_mouse_xwindow ( bx_mouse  mouse)

Gets the x-location of the mouse, relative to the referential window

Parameters
mousea snapshot of the state of the mouse.
Returns
the x-location.
int bx_mouse_y ( bx_mouse  mouse)
int bx_mouse_ycanvas ( bx_mouse  mouse)

Gets the y-location of the mouse, relative to the canvas of the referential window

Parameters
mousea snapshot of the state of the mouse.
Returns
the y-location.
int bx_mouse_yscreen ( bx_mouse  mouse)

Gets the y-location of the mouse, relative to the top left corner of screen.

Parameters
mousea snapshot of the state of the mouse.
Returns
the y-location.
int bx_mouse_ywindow ( bx_mouse  mouse)

Gets the y-location of the mouse, relative to the referential window.

Parameters
mousea snapshot of the state of the mouse
Returns
the y-location.
int bx_mouse_b1 ( bx_mouse  mouse)

Gets the state of mouse button no 1 (usually left),

Parameters
mousea snapshot of the state of the mouse.
Returns
the state of the button.
int bx_mouse_b2 ( bx_mouse  mouse)

Gets the state of mouse button no 2 (middle),

Parameters
mousea snapshot of the state of the mouse.
Returns
the state of the button.
int bx_mouse_b3 ( bx_mouse  mouse)

Gets the state of mouse button no 3 (usually right),

Parameters
mousea snapshot of the state of the mouse.
Returns
the state of the button.
int bx_mouse_b4 ( bx_mouse  mouse)

Gets the state of mouse button no 4 (forward roll of mousewheel),

Parameters
mousea snapshot of the state of the mouse.
Returns
the state of the button.
Remarks
  • A mousewheel roll is simulated by X11 by a instantaneous couple of "press" + "release" events such that the press state can never be caught by a snapshot via bx_read_mouse(). Therefore, the use of notification of events is necessary to catch a mousewheel roll.
int bx_mouse_b5 ( bx_mouse  mouse)

Gets the state of mouse button no 5 (backward roll of mousewheel),

Parameters
mousea snapshot of the state of the mouse.
Returns
the state of the button.
Remarks
  • A mousewheel roll is simulated by X11 by a instantaneous couple of "press" + "release" events such that the press state can never be caught by a snapshot via bx_read_mouse(). Therefore, the use of notification of events is necessary to catch a mousewheel roll.
int bx_mouse_b ( bx_mouse  mouse,
int  b 
)

Gets the state of mouse button number b.

Parameters
mousea snapshot of the state of the mouse
ba number of mouse button in the range from 1 to 5
Returns
the state of the button.
int bx_mouse_shift ( bx_mouse  mouse)

Gets the state of the Shift key at the time of the snapshot of the state of the mouse.

Parameters
mousea snapshot of the state of the mouse
Returns
the state of the Shift key.
int bx_mouse_ctrl ( bx_mouse  mouse)

Gets the state of the Ctrl key at the time of the snapshot of the state of the mouse.

Parameters
mousea snapshot of the state of the mouse
Returns
the state of the Ctrl key.
int bx_mouse_alt ( bx_mouse  mouse)

Gets the state of the Alt key at the time of the snapshot of the state of the mouse.

Parameters
mousea snapshot of the state of the mouse
Returns
the state of the Alt key.
int bx_mouse_altgr ( bx_mouse  mouse)

Gets the state of the AltGr key at the time of the snapshot of the state of the mouse.

Parameters
mousea snapshot of the state of the mouse
Returns
the state of the AltGr key.