![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
An (input) event layer. More...
#include <stdint.h>#include <string.h>#include <utils/gp_types.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_key |
| A key press/release/repeat event. More... | |
| struct | gp_ev_sys_resize |
| A value for the GP_EV_SYS_RENDER_RESIZE event. 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, ...) |
| Checks for any key from a set to be pressed. | |
| #define | gp_ev_all_keys_pressed(ev, ...) |
| 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_FD = 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_RENDER_RESIZE = 1 , GP_EV_SYS_CLIPBOARD = 2 , GP_EV_SYS_BACKLIGHT = 3 , GP_EV_SYS_FOCUS = 4 , GP_EV_SYS_RENDER_STOP = 5 , GP_EV_SYS_RENDER_START = 6 , GP_EV_SYS_RENDER_PIXEL_TYPE = 7 } |
| System events. More... | |
| enum | gp_ev_sys_focus_val { GP_EV_SYS_FOCUS_OUT = 0 , GP_EV_SYS_FOCUS_IN = 1 } |
| Values for the GP_EV_SYS_FOCUS event. More... | |
Functions | |
| static int | gp_ev_utf_is_ctrl (const 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 (const 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 (const gp_event *ev, uint32_t key) |
| Checks if key is being pressed. | |
| void | gp_ev_dump (const 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, | |
| ... ) |
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 359 of file gp_event.h.
| #define gp_ev_any_key_pressed | ( | ev, | |
| ... ) |
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 349 of file gp_event.h.
Referenced by gp_widget_key_mod_pressed().
| enum gp_ev_abs_code |
An absolute event type.
| Enumerator | |
|---|---|
| GP_EV_ABS_POS | An absolute position. |
Definition at line 66 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 44 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 58 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_RENDER_RESIZE | The backend was resized. The rendering is stopped with GP_EV_SYS_RENDER_STOP and the gp_backend::pixmap is resized only after the rendering stop was acknowledged by the application by calling the gp_backend_render_stopped(). Once the gp_backend::pixmap has been resized the this event is send followed by GP_EV_SYS_RENDER_START. |
| 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. |
| GP_EV_SYS_BACKLIGHT | Backlight brightness change. When backend brightness was changed the new brightness in percents is stored in the val. |
| GP_EV_SYS_FOCUS | A focus in or focus out event. The event val is set to enum gp_ev_sys_focus_val. |
| GP_EV_SYS_RENDER_STOP | Stops rendering. Application must stop rendering into the gp_backend::pixmap when it receives GP_EV_SYS_RENDER_STOP and acknowledge to the backend that rendering has been stopped by calling the gp_backend_render_stopped(). During the time rendering is stopped the gp_backend::pixmap pointer is NULL. |
| GP_EV_SYS_RENDER_START | Starts rendering. The gp_backend::pixmap pointer is valid again. |
| GP_EV_SYS_RENDER_PIXEL_TYPE | Pixel type for the rendering. This event is send before first GP_EV_SYS_RENDER_START so that application can prepare colors for the rendering. |
Definition at line 72 of file gp_event.h.
| enum gp_ev_sys_focus_val |
Values for the GP_EV_SYS_FOCUS event.
Application starts in focused out state and should expect to be notified when it gains focus.
| Enumerator | |
|---|---|
| GP_EV_SYS_FOCUS_OUT | Application was focused out. |
| GP_EV_SYS_FOCUS_IN | Appliaction was focused in. |
Definition at line 152 of file gp_event.h.
| enum gp_ev_type |
An event type.
Definition at line 26 of file gp_event.h.
| void gp_ev_dump | ( | const 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 333 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 263 of file gp_event.h.
References gp_event::key, and gp_ev_key::utf.
|
inlinestatic |
Helper to set key bit in the event state.
| self | An event state. |
| key | A key value to press. |
Definition at line 277 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 293 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 307 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 320 of file gp_event.h.
References gp_events_state::keys_pressed.