Crossfire Client, Trunk
|
#include "client.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "main.h"
#include "proto.h"
#include "image.h"
#include "gtk2proto.h"
#include "p_cmd.h"
Go to the source code of this file.
Data Structures | |
struct | keybind |
Enumerations | |
KList Enum | |
EndOf UI Widgets Changed to KLIST_* to avoid conflicts in Win2000 and up | |
enum | { KLIST_ENTRY, KLIST_KEY, KLIST_MODS, KLIST_SCOPE, KLIST_EDIT, KLIST_COMMAND, KLIST_KEY_ENTRY } |
Functions | |
static int | keybind_overwrite_confirm (struct keybind *kb) |
static void | keybinding_get_data (guint32 *keysym, guint8 *flags, const char **command) |
gboolean | keybinding_selection_func (GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer userdata) |
void | on_kb_scope_togglebutton_character_toggled (GtkToggleButton *toggle_button, gpointer user_data) |
void | on_kb_scope_togglebutton_global_toggled (GtkToggleButton *toggle_button, gpointer user_data) |
void | on_keybinding_button_bind_clicked (GtkButton *button, gpointer user_data) |
void | on_keybinding_button_clear_clicked (GtkButton *button, gpointer user_data) |
void | on_keybinding_button_close_clicked (GtkButton *button, gpointer user_data) |
void | on_keybinding_button_remove_clicked (GtkButton *button, gpointer user_data) |
void | on_keybinding_button_update_clicked (GtkButton *button, gpointer user_data) |
void | on_keybinding_checkbutton_any_clicked (GtkCheckButton *cb, gpointer user_data) |
gboolean | on_keybinding_entry_key_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) |
void | on_keybindings_activate (GtkMenuItem *menuitem, gpointer user_data) |
void | reset_keybinding_status (void) |
void | toggle_buttons_scope (int scope) |
void | toggle_keybind_scope (int scope, struct keybind *kb) |
void | update_keybinding_list (void) |
Variables | |
UI Widgets | |
Widgets for the keybinding dialog | |
GtkWidget * | entry_commands |
static GtkWidget * | fire_label |
static GtkWidget * | kb_scope_togglebutton_character |
static GtkWidget * | kb_scope_togglebutton_global |
static GtkWidget * | keybinding_button_bind |
static GtkWidget * | keybinding_button_remove |
static GtkWidget * | keybinding_button_update |
static GtkWidget * | keybinding_checkbutton_alt |
static GtkWidget * | keybinding_checkbutton_any |
static GtkWidget * | keybinding_checkbutton_control |
static GtkWidget * | keybinding_checkbutton_edit |
static GtkWidget * | keybinding_checkbutton_meta |
static GtkWidget * | keybinding_checkbutton_shift |
static GtkWidget * | keybinding_entry_command |
static GtkWidget * | keybinding_entry_key |
static GtkTreeSelection * | keybinding_selection |
static GtkListStore * | keybinding_store |
static GtkWidget * | keybinding_treeview |
static GtkWidget * | keybinding_window |
static GtkWidget * | run_label |
GtkWidget * | spinbutton_count |
Bind Log | |
static int | cur_history_position = 0 |
char | history [MAX_HISTORY][MAX_COMMAND_LEN] |
#define | MAX_COMMAND_LEN 256 |
#define | MAX_HISTORY 50 |
static int | scroll_history_position = 0 |
key_entry struct | |
A keybinding hash record structure. | |
static guint32 | altkeysym [2] |
static char | bind_buf [MAX_BUF] |
static int | bind_flags = 0 |
void | bind_key (char *params) |
static guint32 * | bind_keysym |
static guint32 | cancelkeysym |
static guint32 | commandkeysym |
static guint32 | completekeysym |
static void | configure_keys (guint32 keysym) |
static bool | debounce = false |
const char *const | directions [9] |
void | draw_prompt (const char *str) |
#define | EKEYBIND_NOMEM 1 |
static guint32 | firekeysym [2] |
void | focusoutfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
static char * | get_key_info (struct keybind *kb, int save_mode) |
static void | get_key_modchars (struct keybind *kb, int save_mode, char *buf) |
void | gtk_command_history (int direction) |
void | gtk_complete_command (void) |
static void | init_default_keybindings () |
static struct keybind * | keybind_find (guint32 keysym, unsigned int flags, int scope) |
static void | keybind_free (struct keybind **entry) |
static int | keybind_insert (guint32 keysym, unsigned int flags, const char *command) |
static int | keybind_remove (struct keybind *entry) |
void | keybindings_init (const char *character_name) |
#define | KEYF_ANY (1 << 4) |
#define | KEYF_EDIT (1 << 5) |
#define | KEYF_MOD_ALT (1 << 2) |
#define | KEYF_MOD_CTRL (1 << 1) |
#define | KEYF_MOD_MASK |
#define | KEYF_MOD_META (1 << 3) |
#define | KEYF_MOD_SHIFT (1 << 0) |
#define | KEYF_R_CHAR (1 << 7) |
#define | KEYF_R_GLOBAL (1 << 6) |
void | keyfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
#define | KEYHASH 257 |
void | keyrelfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
static struct keybind * | keys_char [KEYHASH] |
static struct keybind * | keys_global [KEYHASH] |
void | keys_init (GtkWidget *window_root) |
static guint32 | metakeysym [2] |
static guint32 | nextkeysym |
static void | on_count_changed (GtkSpinButton *spinbutton, gpointer *data) |
void | on_entry_commands_activate (GtkEntry *entry, gpointer user_data) |
static void | parse_key (char key, guint32 keysym) |
static void | parse_key_release (guint32 keysym) |
static void | parse_keybind_line (char *buf, int line, unsigned int scope_flag) |
static int | parse_keys_file (GInputStream *in, unsigned int scope_flag) |
static guint32 | prevkeysym |
static guint32 | runkeysym [2] |
static void | save_individual_key (FILE *fp, struct keybind *kb, KeyCode kc) |
static void | save_keys (void) |
static void | show_keys (void) |
void | unbind_key (const char *params) |
static void | unbind_usage (void) |
void | x_set_echo (void) |
Handles most of the keyboard related functions - binding and unbinding keys, and handling keypresses and looking up the keys.
Definition in file keys.c.
#define KEYF_MOD_MASK |
anonymous enum |
|
static |
Definition at line 120 of file keys.c.
Referenced by bind_key(), configure_keys(), keybindings_init(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
|
static |
Definition at line 124 of file keys.c.
Referenced by bind_key(), configure_keys(), get_key_info(), keybinding_get_data(), and parse_keybind_line().
|
static |
Definition at line 123 of file keys.c.
Referenced by bind_key(), and configure_keys().
|
static |
Definition at line 119 of file keys.c.
Referenced by bind_key(), and configure_keys().
|
static |
Definition at line 121 of file keys.c.
Referenced by keybindings_init(), and keyfunc().
|
static |
Definition at line 119 of file keys.c.
Referenced by bind_key(), keybindings_init(), parse_key(), parse_keybind_line(), and show_keys().
|
static |
Definition at line 120 of file keys.c.
Referenced by bind_key(), keybindings_init(), keyfunc(), parse_keybind_line(), save_keys(), and show_keys().
|
static |
Definition at line 89 of file keys.c.
Referenced by gtk_command_history(), and on_entry_commands_activate().
const char* const directions[9] |
256-length array to keep track of when commands were sent to the server Array for direction strings for each numeric direction.
Definition at line 41 of file player.c.
Referenced by command_to_direction(), dir_to_command(), and keybind_insert().
GtkWidget* entry_commands |
Definition at line 63 of file keys.c.
Referenced by draw_prompt(), gtk_command_history(), gtk_complete_command(), keyfunc(), keyrelfunc(), keys_init(), parse_key(), and x_set_echo().
|
static |
Definition at line 49 of file keys.c.
Referenced by focusoutfunc(), keyfunc(), keys_init(), parse_key(), and parse_key_release().
|
static |
Definition at line 119 of file keys.c.
Referenced by bind_key(), configure_keys(), keybindings_init(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
char history[MAX_HISTORY][MAX_COMMAND_LEN] |
Definition at line 87 of file keys.c.
Referenced by gtk_command_history(), keybindings_init(), and on_entry_commands_activate().
|
static |
Definition at line 50 of file keys.c.
Referenced by keys_init(), on_kb_scope_togglebutton_character_toggled(), and toggle_buttons_scope().
|
static |
Definition at line 50 of file keys.c.
Referenced by keybinding_get_data(), keys_init(), on_kb_scope_togglebutton_global_toggled(), and toggle_buttons_scope().
|
static |
Definition at line 57 of file keys.c.
Referenced by keys_init().
|
static |
Definition at line 56 of file keys.c.
Referenced by keybinding_selection_func(), keys_init(), and reset_keybinding_status().
|
static |
Definition at line 56 of file keys.c.
Referenced by keybinding_selection_func(), keys_init(), and reset_keybinding_status().
|
static |
Definition at line 53 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), on_keybinding_checkbutton_any_clicked(), on_keybinding_entry_key_key_press_event(), and reset_keybinding_status().
|
static |
Definition at line 51 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), and reset_keybinding_status().
|
static |
Definition at line 52 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), on_keybinding_checkbutton_any_clicked(), on_keybinding_entry_key_key_press_event(), and reset_keybinding_status().
|
static |
Definition at line 54 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), and reset_keybinding_status().
|
static |
Definition at line 53 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), on_keybinding_checkbutton_any_clicked(), on_keybinding_entry_key_key_press_event(), and reset_keybinding_status().
|
static |
Definition at line 52 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), on_keybinding_checkbutton_any_clicked(), on_keybinding_entry_key_key_press_event(), and reset_keybinding_status().
|
static |
Definition at line 55 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), and reset_keybinding_status().
|
static |
Definition at line 54 of file keys.c.
Referenced by keybinding_get_data(), keybinding_selection_func(), keys_init(), on_keybinding_entry_key_key_press_event(), and reset_keybinding_status().
|
static |
Definition at line 60 of file keys.c.
Referenced by keys_init(), on_kb_scope_togglebutton_character_toggled(), on_kb_scope_togglebutton_global_toggled(), on_keybinding_button_clear_clicked(), on_keybinding_button_remove_clicked(), and on_keybinding_button_update_clicked().
|
static |
Bound key list for bind dialog.
Definition at line 59 of file keys.c.
Referenced by keys_init(), and update_keybinding_list().
|
static |
Definition at line 55 of file keys.c.
Referenced by keys_init().
|
static |
Definition at line 49 of file keys.c.
Referenced by keybind_overwrite_confirm(), keys_init(), on_keybinding_button_close_clicked(), and on_keybindings_activate().
Definition at line 166 of file keys.c.
Referenced by keybind_find(), keybind_insert(), keybind_remove(), keybindings_init(), keys_init(), save_keys(), show_keys(), unbind_key(), and update_keybinding_list().
Will hold the keybindings into two separate hashes depending on the scope they afect (global or character). This allows editting both scopes at the same time and switch scopes for a certain binding with ease.
Platform independence defines that we can't use keycodes. Instead, make it a hash, and set KEYHASH to a prime number for this purpose.
Definition at line 166 of file keys.c.
Referenced by keybind_find(), keybind_insert(), keybind_remove(), keybindings_init(), keys_init(), save_keys(), show_keys(), toggle_keybind_scope(), unbind_key(), and update_keybinding_list().
|
static |
Definition at line 120 of file keys.c.
Referenced by bind_key(), configure_keys(), keybindings_init(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
|
static |
Definition at line 120 of file keys.c.
Referenced by bind_key(), keybindings_init(), keyfunc(), parse_keybind_line(), save_keys(), and show_keys().
|
static |
Definition at line 120 of file keys.c.
Referenced by bind_key(), keybindings_init(), keyfunc(), parse_keybind_line(), save_keys(), and show_keys().
|
static |
Definition at line 49 of file keys.c.
Referenced by focusoutfunc(), keyfunc(), keys_init(), parse_key(), and parse_key_release().
|
static |
Definition at line 119 of file keys.c.
Referenced by bind_key(), configure_keys(), keybindings_init(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
|
static |
Definition at line 89 of file keys.c.
Referenced by gtk_command_history(), and on_entry_commands_activate().
GtkWidget* spinbutton_count |
Definition at line 62 of file keys.c.
Referenced by keys_init(), list_item_drop(), and parse_key().