(input_keyboard.c) Refactor more functions into static functions

This commit is contained in:
twinaphex 2016-03-24 03:45:16 +01:00
parent ce9573e4c3
commit d04940a159
2 changed files with 12 additions and 52 deletions

View File

@ -110,7 +110,7 @@ static input_keyboard_line_t *input_keyboard_line_new(void *userdata,
*
* Returns: true (1) on success, otherwise false (0).
**/
bool input_keyboard_line_event(
static bool input_keyboard_line_event(
input_keyboard_line_t *state, uint32_t character)
{
char c = character >= 128 ? '?' : character;
@ -157,24 +157,6 @@ bool input_keyboard_line_event(
return false;
}
/**
* input_keyboard_line_get_buffer:
* @state : Input keyboard line handle.
*
* Gets the underlying buffer of the keyboard line.
*
* The underlying buffer can be reallocated at any time
* (or be NULL), but the pointer to it remains constant
* throughout the objects lifetime.
*
* Returns: pointer to string.
**/
const char **input_keyboard_line_get_buffer(
const input_keyboard_line_t *state)
{
return (const char**)&state->buffer;
}
/**
* input_keyboard_start_line:
* @userdata : Userdata.
@ -182,8 +164,11 @@ const char **input_keyboard_line_get_buffer(
*
* Sets function pointer for keyboard line handle.
*
* Returns: underlying buffer returned by
* input_keyboard_line_get_buffer().
* The underlying buffer can be reallocated at any time
* (or be NULL), but the pointer to it remains constant
* throughout the objects lifetime.
*
* Returns: underlying buffer of the keyboard line.
**/
const char **input_keyboard_start_line(void *userdata,
input_keyboard_line_complete_t cb)
@ -195,7 +180,7 @@ const char **input_keyboard_start_line(void *userdata,
/* While reading keyboard line input, we have to block all hotkeys. */
input_driver_keyboard_mapping_set_block(true);
return input_keyboard_line_get_buffer(g_keyboard_line);
return (const char**)&g_keyboard_line->buffer;
}
/**

View File

@ -66,34 +66,6 @@ typedef struct input_keyboard_ctx_wait
input_keyboard_press_t cb;
} input_keyboard_ctx_wait_t;
/**
* input_keyboard_line_event:
* @state : Input keyboard line handle.
* @character : Inputted character.
*
* Called on every keyboard character event.
*
* Returns: true (1) on success, otherwise false (0).
**/
bool input_keyboard_line_event(input_keyboard_line_t *state,
uint32_t character);
/**
* input_keyboard_line_get_buffer:
* @state : Input keyboard line handle.
*
* Gets the underlying buffer of the keyboard line.
*
* The underlying buffer can be reallocated at any time
* (or be NULL), but the pointer to it remains constant
* throughout the objects lifetime.
*
* Returns: pointer to string.
**/
const char **input_keyboard_line_get_buffer(
const input_keyboard_line_t *state);
/**
* input_keyboard_event:
* @down : Keycode was pressed down?
@ -114,8 +86,11 @@ void input_keyboard_event(bool down, unsigned code, uint32_t character,
*
* Sets function pointer for keyboard line handle.
*
* Returns: underlying buffer returned by
* input_keyboard_line_get_buffer().
* The underlying buffer can be reallocated at any time
* (or be NULL), but the pointer to it remains constant
* throughout the objects lifetime.
*
* Returns: underlying buffer of the keyboard line.
**/
const char **input_keyboard_start_line(void *userdata,
input_keyboard_line_complete_t cb);