GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
An (input) event layer. More...
#include <stdint.h>
#include <string.h>
#include <input/gp_types.h>
#include <input/gp_keys.h>
#include <input/gp_event_keys.h>
Go to the source code of this file.
Data Structures | |
struct | gp_ev_pos_rel |
A relative cursor position change. More... | |
struct | gp_ev_pos_abs |
An absolute cursor position. More... | |
struct | gp_ev_sys |
An system event value. More... | |
struct | gp_ev_utf |
An unicode event value. More... | |
struct | gp_events_state |
An input events state. More... | |
struct | gp_event |
An input event. More... | |
Macros | |
#define | gp_ev_any_key_pressed(ev, ...) gp_ev_any_key_pressed_(ev, __VA_ARGS__, 0) |
Checks for any key from a set to be pressed. | |
#define | gp_ev_all_keys_pressed(ev, ...) gp_ev_all_keys_pressed_(ev, __VA_ARGS__, 0) |
Checks for all key from a set to be pressed. | |
Enumerations | |
enum | gp_ev_type { GP_EV_KEY = 1 , GP_EV_REL = 2 , GP_EV_ABS = 3 , GP_EV_SYS = 4 , GP_EV_TMR = 5 , GP_EV_UTF = 6 , GP_EV_MAX = 6 } |
An event type. More... | |
enum | gp_ev_key_code { GP_EV_KEY_UP = 0 , GP_EV_KEY_DOWN = 1 , GP_EV_KEY_REPEAT = 2 } |
A key event type. More... | |
enum | gp_ev_rel_code { GP_EV_REL_POS = 0 , GP_EV_REL_WHEEL = 8 } |
A relative event type. More... | |
enum | gp_ev_abs_code { GP_EV_ABS_POS = 0 } |
An absolute event type. More... | |
enum | gp_ev_sys_code { GP_EV_SYS_QUIT = 0 , GP_EV_SYS_RESIZE = 1 , GP_EV_SYS_CLIPBOARD = 2 } |
System events. More... | |
Functions | |
static int | gp_ev_utf_is_ctrl (gp_event *ev) |
Checks if a character is not printable. | |
static void | gp_events_state_press (gp_events_state *self, uint32_t key) |
Helper to set key bit in the event state. | |
static int | gp_events_state_pressed (gp_events_state *self, uint32_t key) |
Helper to get key bit from the event state. | |
static void | gp_events_state_release (gp_events_state *self, uint32_t key) |
Helper to reset key bit in the event state. | |
static void | gp_events_state_release_all (gp_events_state *self) |
Helper to reset all key bits in the event state. | |
static int | gp_ev_key_pressed (gp_event *ev, uint32_t key) |
Checks if key is being pressed. | |
void | gp_ev_dump (gp_event *ev) |
Dumps event into a stdout. | |
An (input) event layer.
Input events combine events from HID devices, such as keyboard or mouse as well as other types of events such as timers, window resize, clipboard, etc.
Definition in file gp_event.h.
#define gp_ev_all_keys_pressed | ( | ev, | |
... | |||
) | gp_ev_all_keys_pressed_(ev, __VA_ARGS__, 0) |
Checks for all key from a set to be pressed.
ev | An input event. |
... | A list of key values to check for. |
Definition at line 282 of file gp_event.h.
#define gp_ev_any_key_pressed | ( | ev, | |
... | |||
) | gp_ev_any_key_pressed_(ev, __VA_ARGS__, 0) |
Checks for any key from a set to be pressed.
ev | An input event. |
... | A list of key values to check for. |
Definition at line 272 of file gp_event.h.
enum gp_ev_abs_code |
An absolute event type.
Enumerator | |
---|---|
GP_EV_ABS_POS | An absolute position. |
Definition at line 65 of file gp_event.h.
enum gp_ev_key_code |
A key event type.
Enumerator | |
---|---|
GP_EV_KEY_UP | Key released. |
GP_EV_KEY_DOWN | Key pressed. |
GP_EV_KEY_REPEAT | Key repeated. Key is pressed for some time and repeat event is generated. |
Definition at line 43 of file gp_event.h.
enum gp_ev_rel_code |
A relative event type.
Enumerator | |
---|---|
GP_EV_REL_POS | A relative position. |
GP_EV_REL_WHEEL | A mouse wheel. |
Definition at line 57 of file gp_event.h.
enum gp_ev_sys_code |
System events.
Enumerator | |
---|---|
GP_EV_SYS_QUIT | User requested application to quit. This event is usually generated when user clicks on the button to close an application window. |
GP_EV_SYS_RESIZE | User resized the applicaton window. This event has to be handled and the resize has to be acked by gp_backend_resize_ack() in order to resize the backend pixmap to match the window size. |
GP_EV_SYS_CLIPBOARD | Clipboard request is ready. When application requests clipboard data by gp_backend_clipboard_request() the data are fetched and this event arrives to the appliction once the data are ready. |
Definition at line 71 of file gp_event.h.
enum gp_ev_type |
An event type.
Definition at line 25 of file gp_event.h.
void gp_ev_dump | ( | gp_event * | ev | ) |
Dumps event into a stdout.
ev | A pointer to an input event. |
|
inlinestatic |
Checks if key is being pressed.
ev | An input event. |
key | A key value to check for. |
Definition at line 256 of file gp_event.h.
References gp_events_state_pressed(), and gp_event::st.
|
inlinestatic |
Checks if a character is not printable.
ev | A key input event. |
Definition at line 189 of file gp_event.h.
References gp_ev_utf::ch, and gp_event::utf.
|
inlinestatic |
Helper to set key bit in the event state.
self | An event state. |
key | A key value to press. |
Definition at line 200 of file gp_event.h.
References gp_events_state::keys_pressed.
|
inlinestatic |
Helper to get key bit from the event state.
self | An event state. |
key | A key value to get the state for. |
Definition at line 216 of file gp_event.h.
References gp_events_state::keys_pressed.
Referenced by gp_ev_key_pressed().
|
inlinestatic |
Helper to reset key bit in the event state.
self | An event state. |
key | A key value to release. |
Definition at line 230 of file gp_event.h.
References gp_events_state::keys_pressed.
|
inlinestatic |
Helper to reset all key bits in the event state.
self | An event state. |
Definition at line 243 of file gp_event.h.
References gp_events_state::keys_pressed.