libdom
Loading...
Searching...
No Matches
Functions
keyboard_event.c File Reference
#include <stdlib.h>
#include <string.h>
#include "events/keyboard_event.h"
#include "core/document.h"
#include "utils/utils.h"

Functions

dom_exception _dom_keyboard_event_create (struct dom_keyboard_event **evt)
 
void _dom_keyboard_event_destroy (struct dom_keyboard_event *evt)
 
dom_exception _dom_keyboard_event_initialise (struct dom_keyboard_event *evt)
 
void _dom_keyboard_event_finalise (struct dom_keyboard_event *evt)
 
dom_exception _dom_keyboard_event_get_key (dom_keyboard_event *evt, dom_string **key)
 
dom_exception _dom_keyboard_event_get_code (dom_keyboard_event *evt, dom_string **code)
 
dom_exception _dom_keyboard_event_get_location (dom_keyboard_event *evt, dom_key_location *location)
 
dom_exception _dom_keyboard_event_get_ctrl_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_shift_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_alt_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_meta_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_modifier_state (dom_keyboard_event *evt, dom_string *m, bool *state)
 
dom_exception _dom_keyboard_event_init (dom_keyboard_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key, dom_string *code, dom_key_location location, bool ctrl_key, bool shift_key, bool alt_key, bool meta_key, bool repeat, bool is_composing)
 
dom_exception _dom_keyboard_event_init_ns (dom_keyboard_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key, dom_string *code, dom_key_location location, bool ctrl_key, bool shift_key, bool alt_key, bool meta_key, bool repeat, bool is_composing)
 
dom_exception _dom_parse_modifier_list (dom_string *modifier_list, uint32_t *modifier_state)
 

Function Documentation

◆ _dom_keyboard_event_create()

dom_exception _dom_keyboard_event_create ( struct dom_keyboard_event ** evt)

◆ _dom_keyboard_event_destroy()

void _dom_keyboard_event_destroy ( struct dom_keyboard_event * evt)

◆ _dom_keyboard_event_finalise()

void _dom_keyboard_event_finalise ( struct dom_keyboard_event * evt)

◆ _dom_keyboard_event_get_alt_key()

dom_exception _dom_keyboard_event_get_alt_key ( dom_keyboard_event * evt,
bool * key )

Get the alt key state

Parameters
evtThe Event object
keyWhether the Alt key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_code()

dom_exception _dom_keyboard_event_get_code ( dom_keyboard_event * evt,
dom_string ** code )

Get the code

Parameters
evtThe Event object
codeThe returned code
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_ctrl_key()

dom_exception _dom_keyboard_event_get_ctrl_key ( dom_keyboard_event * evt,
bool * key )

Get the ctrl key state

Parameters
evtThe Event object
keyWhether the Control key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_key()

dom_exception _dom_keyboard_event_get_key ( dom_keyboard_event * evt,
dom_string ** key )

Get the key

Parameters
evtThe Event object
keyThe returned key
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_location()

dom_exception _dom_keyboard_event_get_location ( dom_keyboard_event * evt,
dom_key_location * location )

Get the key location

Parameters
evtThe Event object
locationThe returned key location
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_meta_key()

dom_exception _dom_keyboard_event_get_meta_key ( dom_keyboard_event * evt,
bool * key )

Get the meta key state

Parameters
evtThe Event object
keyWhether the Meta key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_modifier_state()

dom_exception _dom_keyboard_event_get_modifier_state ( dom_keyboard_event * evt,
dom_string * m,
bool * state )

Query the state of a modifier using a key identifier

Parameters
evtThe event object
mlThe modifier identifier, such as "Alt", "Control", "Meta", "AltGraph", "CapsLock", "NumLock", "Scroll", "Shift".
stateWhether the modifier key is pressed
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.
Note
: If an application wishes to distinguish between right and left modifiers, this information could be deduced using keyboard events and KeyboardEvent.keyLocation.

◆ _dom_keyboard_event_get_shift_key()

dom_exception _dom_keyboard_event_get_shift_key ( dom_keyboard_event * evt,
bool * key )

Get the shift key state

Parameters
evtThe Event object
keyWhether the Shift key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_init()

dom_exception _dom_keyboard_event_init ( dom_keyboard_event * evt,
dom_string * type,
bool bubble,
bool cancelable,
struct dom_abstract_view * view,
dom_string * key,
dom_string * code,
dom_key_location location,
bool ctrl_key,
bool shift_key,
bool alt_key,
bool meta_key,
bool repeat,
bool is_composing )

Initialise the keyboard event with namespace

Parameters
evtThe Event object
typeThe event's type
bubbleWhether this is a bubbling event
cancelableWhether this is a cancelable event
viewThe AbstractView associated with this event
keyThe key identifier of pressed key
codeThe code identifier of pressed key
locationThe key location of the preesed key
ctrl_keyWhether the ctrl_key is pressed
shift_keyWhether the shift_key is pressed
alt_keyWhether the alt_key is pressed
meta_keyWhether the ctrl_key is pressed
repeatWhether this is a repeat press from a held key
is_composingWhether the input is being composed
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.

◆ _dom_keyboard_event_init_ns()

dom_exception _dom_keyboard_event_init_ns ( dom_keyboard_event * evt,
dom_string * namespace,
dom_string * type,
bool bubble,
bool cancelable,
struct dom_abstract_view * view,
dom_string * key,
dom_string * code,
dom_key_location location,
bool ctrl_key,
bool shift_key,
bool alt_key,
bool meta_key,
bool repeat,
bool is_composing )

Initialise the keyboard event with namespace

Parameters
evtThe Event object
namespaceThe namespace of this event
typeThe event's type
bubbleWhether this is a bubbling event
cancelableWhether this is a cancelable event
viewThe AbstractView associated with this event
keyThe key identifier of pressed key
codeThe code identifier of pressed key
locationThe key location of the preesed key
ctrl_keyWhether the ctrl_key is pressed
shift_keyWhether the shift_key is pressed
alt_keyWhether the alt_key is pressed
meta_keyWhether the ctrl_key is pressed
repeatWhether this is a repeat press from a held key
is_composingWhether the input is being composed
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.

◆ _dom_keyboard_event_initialise()

dom_exception _dom_keyboard_event_initialise ( struct dom_keyboard_event * evt)

◆ _dom_parse_modifier_list()

dom_exception _dom_parse_modifier_list ( dom_string * modifier_list,
uint32_t * modifier_state )

Parse the modifier list string to corresponding bool variable state

Parameters
modifier_listThe modifier list string
modifier_stateThe returned state
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.