Removed typedef for keyboard structures in gui-keyboard.h

This commit is contained in:
Sebastien Helleu 2008-02-04 10:36:16 +01:00
parent 763bb073b4
commit 155e689a26
5 changed files with 34 additions and 37 deletions

View File

@ -655,7 +655,7 @@ command_history (void *data, struct t_gui_buffer *buffer,
*/ */
void void
command_key_display (t_gui_key *key, int new_key) command_key_display (struct t_gui_key *key, int new_key)
{ {
char *expanded_name; char *expanded_name;
@ -696,7 +696,7 @@ command_key (void *data, struct t_gui_buffer *buffer,
{ {
char *args, *internal_code; char *args, *internal_code;
int i; int i;
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
t_gui_key_func *ptr_function; t_gui_key_func *ptr_function;
/* make C compiler happy */ /* make C compiler happy */

View File

@ -465,7 +465,7 @@ void
config_weechat_write_keys (void *data, struct t_config_file *config_file, config_weechat_write_keys (void *data, struct t_config_file *config_file,
char *section_name) char *section_name)
{ {
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
char *expanded_name, *function_name; char *expanded_name, *function_name;
/* make C compiler happy */ /* make C compiler happy */

View File

@ -176,7 +176,7 @@ weechat_display_key_functions ()
void void
weechat_display_keys () weechat_display_keys ()
{ {
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
char *expanded_name; char *expanded_name;
string_iconv_fprintf (stdout, string_iconv_fprintf (stdout,

View File

@ -40,8 +40,8 @@
#include "gui-window.h" #include "gui-window.h"
t_gui_key *gui_keys = NULL; /* key bindings */ struct t_gui_key *gui_keys = NULL; /* key bindings */
t_gui_key *last_gui_key = NULL; /* last key binding */ struct t_gui_key *last_gui_key = NULL; /* last key binding */
char gui_key_combo_buffer[128]; /* buffer used for combos */ char gui_key_combo_buffer[128]; /* buffer used for combos */
int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k) */ int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k) */
@ -57,7 +57,7 @@ int gui_keyboard_paste_lines = 0; /* number of lines for pending paste */
time_t gui_keyboard_last_activity_time = 0; /* last activity time (key) */ time_t gui_keyboard_last_activity_time = 0; /* last activity time (key) */
t_gui_key_function gui_key_functions[] = struct t_gui_key_function gui_key_functions[] =
{ { "return", gui_action_return, { { "return", gui_action_return,
N_("terminate line") }, N_("terminate line") },
{ "tab", gui_action_tab, { "tab", gui_action_tab,
@ -325,10 +325,10 @@ gui_keyboard_get_expanded_name (char *key)
* gui_keyboard_find_pos: find position for a key (for sorting keys list) * gui_keyboard_find_pos: find position for a key (for sorting keys list)
*/ */
t_gui_key * struct t_gui_key *
gui_keyboard_find_pos (t_gui_key *key) gui_keyboard_find_pos (struct t_gui_key *key)
{ {
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{ {
@ -343,9 +343,9 @@ gui_keyboard_find_pos (t_gui_key *key)
*/ */
void void
gui_keyboard_insert_sorted (t_gui_key *key) gui_keyboard_insert_sorted (struct t_gui_key *key)
{ {
t_gui_key *pos_key; struct t_gui_key *pos_key;
if (gui_keys) if (gui_keys)
{ {
@ -384,14 +384,15 @@ gui_keyboard_insert_sorted (t_gui_key *key)
* gui_keyboard_new: add a new key in keys list * gui_keyboard_new: add a new key in keys list
*/ */
t_gui_key * struct t_gui_key *
gui_keyboard_new (char *key, char *command, t_gui_key_func *function, char *args) gui_keyboard_new (char *key, char *command, t_gui_key_func *function,
char *args)
{ {
t_gui_key *new_key; struct t_gui_key *new_key;
char *internal_code; char *internal_code;
int length; int length;
if ((new_key = (t_gui_key *)malloc (sizeof (t_gui_key)))) if ((new_key = (struct t_gui_key *)malloc (sizeof (struct t_gui_key))))
{ {
internal_code = gui_keyboard_get_internal_code (key); internal_code = gui_keyboard_get_internal_code (key);
new_key->key = (internal_code) ? strdup (internal_code) : strdup (key); new_key->key = (internal_code) ? strdup (internal_code) : strdup (key);
@ -426,10 +427,10 @@ gui_keyboard_new (char *key, char *command, t_gui_key_func *function, char *args
* gui_keyboard_search: search a key * gui_keyboard_search: search a key
*/ */
t_gui_key * struct t_gui_key *
gui_keyboard_search (char *key) gui_keyboard_search (char *key)
{ {
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{ {
@ -463,10 +464,10 @@ gui_keyboard_cmp (char *key, char *search)
* gui_keyboard_search_part: search a key (maybe part of string) * gui_keyboard_search_part: search a key (maybe part of string)
*/ */
t_gui_key * struct t_gui_key *
gui_keyboard_search_part (char *key) gui_keyboard_search_part (char *key)
{ {
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{ {
@ -524,11 +525,11 @@ gui_keyboard_function_search_by_ptr (t_gui_key_func *function)
* gui_keyboard_bind: bind a key to a function (command or special function) * gui_keyboard_bind: bind a key to a function (command or special function)
*/ */
t_gui_key * struct t_gui_key *
gui_keyboard_bind (char *key, char *command) gui_keyboard_bind (char *key, char *command)
{ {
t_gui_key_func *ptr_function; t_gui_key_func *ptr_function;
t_gui_key *new_key; struct t_gui_key *new_key;
char *command2, *ptr_args; char *command2, *ptr_args;
if (!key || !command) if (!key || !command)
@ -589,7 +590,7 @@ gui_keyboard_bind (char *key, char *command)
int int
gui_keyboard_unbind (char *key) gui_keyboard_unbind (char *key)
{ {
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
char *internal_code; char *internal_code;
internal_code = gui_keyboard_get_internal_code (key); internal_code = gui_keyboard_get_internal_code (key);
@ -614,7 +615,7 @@ int
gui_keyboard_pressed (char *key_str) gui_keyboard_pressed (char *key_str)
{ {
int first_key; int first_key;
t_gui_key *ptr_key; struct t_gui_key *ptr_key;
char *buffer_before_key; char *buffer_before_key;
char **commands, **ptr_cmd; char **commands, **ptr_cmd;
@ -684,7 +685,7 @@ gui_keyboard_pressed (char *key_str)
*/ */
void void
gui_keyboard_free (t_gui_key *key) gui_keyboard_free (struct t_gui_key *key)
{ {
/* free memory */ /* free memory */
if (key->key) if (key->key)

View File

@ -26,20 +26,16 @@
typedef void (t_gui_key_func)(char *args); typedef void (t_gui_key_func)(char *args);
typedef struct t_gui_key t_gui_key;
struct t_gui_key struct t_gui_key
{ {
char *key; /* key combo (ex: a, ^W, ^W^C, meta-a) */ char *key; /* key combo (ex: a, ^W, ^W^C, meta-a) */
char *command; /* associated command (may be NULL) */ char *command; /* associated command (may be NULL) */
t_gui_key_func *function; /* associated function (if cmd is NULL) */ t_gui_key_func *function; /* associated function (if cmd is NULL) */
char *args; /* args for function (if cmd is NULL) */ char *args; /* args for function (if cmd is NULL) */
t_gui_key *prev_key; /* link to previous key */ struct t_gui_key *prev_key; /* link to previous key */
t_gui_key *next_key; /* link to next key */ struct t_gui_key *next_key; /* link to next key */
}; };
typedef struct t_gui_key_function t_gui_key_function;
struct t_gui_key_function struct t_gui_key_function
{ {
char *function_name; /* name of function */ char *function_name; /* name of function */
@ -49,9 +45,9 @@ struct t_gui_key_function
/* keyboard variables */ /* keyboard variables */
extern t_gui_key *gui_keys; extern struct t_gui_key *gui_keys;
extern t_gui_key *last_gui_key; extern struct t_gui_key *last_gui_key;
extern t_gui_key_function gui_key_functions[]; extern struct t_gui_key_function gui_key_functions[];
extern char gui_key_combo_buffer[]; extern char gui_key_combo_buffer[];
extern int gui_key_grab; extern int gui_key_grab;
extern int gui_key_grab_count; extern int gui_key_grab_count;
@ -67,13 +63,13 @@ extern void gui_keyboard_grab_init ();
extern void gui_keyboard_grab_end (); extern void gui_keyboard_grab_end ();
extern char *gui_keyboard_get_internal_code (char *key); extern char *gui_keyboard_get_internal_code (char *key);
extern char *gui_keyboard_get_expanded_name (char *key); extern char *gui_keyboard_get_expanded_name (char *key);
extern t_gui_key *gui_keyboard_search (char *key); extern struct t_gui_key *gui_keyboard_search (char *key);
extern t_gui_key_func *gui_keyboard_function_search_by_name (char *name); extern t_gui_key_func *gui_keyboard_function_search_by_name (char *name);
extern char *gui_keyboard_function_search_by_ptr (t_gui_key_func *function); extern char *gui_keyboard_function_search_by_ptr (t_gui_key_func *function);
extern t_gui_key *gui_keyboard_bind (char *key, char *command); extern struct t_gui_key *gui_keyboard_bind (char *key, char *command);
extern int gui_keyboard_unbind (char *key); extern int gui_keyboard_unbind (char *key);
extern int gui_keyboard_pressed (char *key_str); extern int gui_keyboard_pressed (char *key_str);
extern void gui_keyboard_free (t_gui_key *key); extern void gui_keyboard_free (struct t_gui_key *key);
extern void gui_keyboard_free_all (); extern void gui_keyboard_free_all ();
extern void gui_keyboard_buffer_reset (); extern void gui_keyboard_buffer_reset ();
extern void gui_keyboard_buffer_add (int key); extern void gui_keyboard_buffer_add (int key);