Crossfire Client, Branch
R11627
|
Handles most of the GTK V1 client keyboard related functions. More...
#include <config.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include "client-types.h"
#include "gx11.h"
#include "client.h"
#include "p_cmd.h"
#include "def-keys.h"
#include "gtkproto.h"
Go to the source code of this file.
Data Structures | |
struct | Keys |
Defines | |
#define | KEYF_EDIT 0x08 /* Line editor */ |
#define | KEYF_FIRE 0x02 /* Used in fire mode */ |
#define | KEYF_MODIFIERS 0x07 /* Mask for actual keyboard modifiers, */ |
#define | KEYF_NORMAL 0x01 /* Used in normal mode */ |
#define | KEYF_RUN 0x04 /* Used in run mode */ |
#define | KEYF_STANDARD 0x10 /* For standard (built in) key definitions */ |
#define | KEYHASH 257 |
Typedefs | |
typedef struct Keys | Key_Entry |
Functions | |
void | bind_callback (GtkWidget *gtklist, GdkEventButton *event) |
void | bind_key (const char *params) |
void | ckeyclear (void) |
void | ckeyentry_callback (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
void | ckeyunbind (GtkWidget *gtklist, GdkEventButton *event) |
static void | configure_keys (uint32 keysym) |
void | disconnect (GtkWidget *) |
void | draw_keybindings (GtkWidget *keylist) |
static char * | get_key_info (Key_Entry *key, int save_mode) |
static void | init_default_keybindings (void) |
void | init_keys (void) |
static void | insert_key (uint32 keysym, int flags, const char *command) |
void | keyfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
void | keyrelfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
static void | parse_key (char key, uint32 keysym) |
static void | parse_key_release (uint32 ks) |
static void | parse_keybind_line (char *buf, int line, int standard) |
static void | save_individual_key (FILE *fp, Key_Entry *key, KeyCode kc) |
static void | save_keys (void) |
static void | show_keys (int allbindings) |
void | unbind_key (const char *params) |
static void | unbind_usage (void) |
Variables | |
static char | bind_buf [MAX_BUF] |
static int | bind_flags = 0 |
static uint32 * | bind_keysym |
static uint32 | cancelkeysym |
static uint32 | commandkeysym |
static uint32 | completekeysym |
const char *const | directions [9] |
static uint32 | firekeysym [2] |
static Key_Entry * | keys [KEYHASH] |
static uint32 | nextkeysym |
static uint32 | prevkeysym |
const char *const | rcsid_gtk_keys_c = "$Id: keys.c 10997 2008-12-17 03:36:53Z kbulgrien $" |
static uint32 | runkeysym [2] |
Handles most of the GTK V1 client keyboard related functions.
This includes binding and unbinding keys, handling keypresses, and looking up the keys.
Definition in file keys.c.
#define KEYF_EDIT 0x08 /* Line editor */ |
Definition at line 97 of file keys.c.
Referenced by bind_key(), draw_keybindings(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_FIRE 0x02 /* Used in fire mode */ |
Definition at line 93 of file keys.c.
Referenced by bind_callback(), bind_key(), configure_keys(), draw_keybindings(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_MODIFIERS 0x07 /* Mask for actual keyboard modifiers, */ |
Definition at line 95 of file keys.c.
Referenced by bind_callback(), bind_key(), configure_keys(), draw_keybindings(), get_key_info(), and parse_key().
#define KEYF_NORMAL 0x01 /* Used in normal mode */ |
Definition at line 92 of file keys.c.
Referenced by bind_key(), draw_keybindings(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_RUN 0x04 /* Used in run mode */ |
Definition at line 94 of file keys.c.
Referenced by bind_callback(), bind_key(), configure_keys(), draw_keybindings(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_STANDARD 0x10 /* For standard (built in) key definitions */ |
Definition at line 98 of file keys.c.
Referenced by draw_keybindings(), get_key_info(), parse_keybind_line(), show_keys(), and unbind_key().
#define KEYHASH 257 |
Definition at line 106 of file keys.c.
Referenced by draw_keybindings(), init_keys(), insert_key(), parse_key(), save_keys(), show_keys(), and unbind_key().
void bind_callback | ( | GtkWidget * | gtklist, |
GdkEventButton * | event | ||
) |
Definition at line 1181 of file keys.c.
References bind_flags, cclist, ckentrytext, ckeyentrytext, cmodentrytext, draw_info(), draw_keybindings(), insert_key(), KEYF_FIRE, KEYF_MODIFIERS, KEYF_RUN, Keys::keysym, MAX_BUF, NDI_BLACK, and save_keys().
Referenced by configdialog().
void ckeyclear | ( | void | ) |
Definition at line 1251 of file keys.c.
References ckentrytext, ckeyentrytext, cmodentrytext, and cnumentrytext.
Referenced by configdialog().
void ckeyentry_callback | ( | GtkWidget * | widget, |
GdkEventKey * | event, | ||
GtkWidget * | window | ||
) |
Definition at line 1233 of file keys.c.
References ckeyentrytext, and cmodentrytext.
Referenced by configdialog().
void ckeyunbind | ( | GtkWidget * | gtklist, |
GdkEventButton * | event | ||
) |
Definition at line 1214 of file keys.c.
References cclist, draw_keybindings(), and unbind_key().
Referenced by configdialog().
static void configure_keys | ( | uint32 | keysym | ) | [static] |
Definition at line 855 of file keys.c.
References bind_buf, bind_flags, bind_keysym, cpl, draw_info(), draw_message_window(), Player_Struct::fire_on, firekeysym, Player_Struct::input_state, insert_key(), KEYF_FIRE, KEYF_MODIFIERS, KEYF_RUN, Keys::keysym, MAX_BUF, NDI_BLACK, Playing, Player_Struct::run_on, runkeysym, and save_keys().
Referenced by do_key_press(), and keyfunc().
void disconnect | ( | GtkWidget * | ) |
Definition at line 2773 of file gx11.c.
References cleanup_textmanagers(), csocket, csocket_fd, and ClientSocket::fd.
void draw_keybindings | ( | GtkWidget * | keylist | ) |
static char* get_key_info | ( | Key_Entry * | key, |
int | save_mode | ||
) | [static] |
Definition at line 544 of file keys.c.
References bind_buf, Keys::command, Keys::flags, KEYF_EDIT, KEYF_FIRE, KEYF_MODIFIERS, KEYF_NORMAL, KEYF_RUN, KEYF_STANDARD, Keys::keysym, and MAX_BUF.
Referenced by save_individual_key(), show_keys(), and unbind_key().
static void init_default_keybindings | ( | void | ) | [static] |
Definition at line 285 of file keys.c.
References def_keys, MAX_BUF, and parse_keybind_line().
Referenced by init_keys().
static void insert_key | ( | uint32 | keysym, |
int | flags, | ||
const char * | command | ||
) | [static] |
Definition at line 116 of file keys.c.
References Keys::command, Keys::direction, directions, Keys::flags, KEYHASH, Keys::keysym, Keys::next, and strdup_local().
Referenced by bind_callback(), configure_keys(), and parse_keybind_line().
void keyfunc | ( | GtkWidget * | widget, |
GdkEventKey * | event, | ||
GtkWidget * | window | ||
) |
void keyrelfunc | ( | GtkWidget * | widget, |
GdkEventKey * | event, | ||
GtkWidget * | window | ||
) |
Definition at line 437 of file keys.c.
References Keys::command, Command_Mode, commandkeysym, CONFIG_ECHO, CONFIG_SPLITWIN, Player_Struct::count, counttext, cpl, Keys::direction, draw_info(), entrytext, extended_command(), FALSE, fire_dir(), fire_label, Player_Struct::fire_on, firekeysym, Keys::flags, gtkwin_info, Player_Struct::input_state, Player_Struct::input_text, KEYF_EDIT, KEYF_FIRE, KEYF_MODIFIERS, KEYF_NORMAL, KEYF_RUN, KEYHASH, Keys::keysym, MAX_BUF, NDI_BLACK, Keys::next, Player_Struct::no_echo, run_dir(), run_label, Player_Struct::run_on, runkeysym, and use_config.
Referenced by do_key_press(), and keyfunc().
static void parse_key_release | ( | uint32 | ks | ) | [static] |
Definition at line 407 of file keys.c.
References clear_fire(), clear_run(), CONFIG_ECHO, cpl, draw_info(), fire_label, Player_Struct::fire_on, firekeysym, NDI_BLACK, run_label, Player_Struct::run_on, runkeysym, and use_config.
Referenced by check_x_events(), and keyrelfunc().
static void parse_keybind_line | ( | char * | buf, |
int | line, | ||
int | standard | ||
) | [static] |
Definition at line 156 of file keys.c.
References bind_buf, commandkeysym, completekeysym, firekeysym, Keys::flags, insert_key(), KEYF_EDIT, KEYF_FIRE, KEYF_NORMAL, KEYF_RUN, KEYF_STANDARD, Keys::keysym, LOG(), LOG_WARNING, nextkeysym, prevkeysym, and runkeysym.
Referenced by init_default_keybindings(), init_keys(), and keys_init().
static void save_individual_key | ( | FILE * | fp, |
Key_Entry * | key, | ||
KeyCode | kc | ||
) | [static] |
Definition at line 781 of file keys.c.
References get_key_info(), and Keys::next.
Referenced by save_keys().
static void save_keys | ( | void | ) | [static] |
Definition at line 788 of file keys.c.
References commandkeysym, completekeysym, cpl, draw_info(), firekeysym, KEYHASH, LOG(), LOG_WARNING, make_path_to_file(), MAX_BUF, Player_Struct::name, NDI_BLACK, nextkeysym, prevkeysym, runkeysym, and save_individual_key().
Referenced by bind_callback(), configure_keys(), and unbind_key().
static void show_keys | ( | int | allbindings | ) | [static] |
Definition at line 599 of file keys.c.
References bind_buf, commandkeysym, completekeysym, draw_info(), firekeysym, Keys::flags, get_key_info(), KEYF_STANDARD, KEYHASH, MAX_BUF, NDI_BLACK, Keys::next, nextkeysym, prevkeysym, and runkeysym.
Referenced by unbind_key().
void unbind_key | ( | const char * | params | ) |
static void unbind_usage | ( | void | ) | [static] |
Definition at line 910 of file keys.c.
References draw_info(), and NDI_BLACK.
Referenced by unbind_key().
Definition at line 90 of file keys.c.
Referenced by bind_key(), configure_keys(), get_key_info(), parse_keybind_line(), show_keys(), and unbind_key().
int bind_flags = 0 [static] |
Definition at line 89 of file keys.c.
Referenced by bind_callback(), bind_key(), and configure_keys().
uint32 * bind_keysym [static] |
Definition at line 87 of file keys.c.
Referenced by bind_key(), and configure_keys().
uint32 cancelkeysym [static] |
Definition at line 87 of file keys.c.
Referenced by init_keys(), and keyfunc().
uint32 commandkeysym [static] |
Definition at line 87 of file keys.c.
Referenced by bind_key(), init_keys(), parse_key(), parse_keybind_line(), save_keys(), and show_keys().
uint32 completekeysym [static] |
Definition at line 87 of file keys.c.
Referenced by bind_key(), init_keys(), keyfunc(), parse_keybind_line(), save_keys(), and show_keys().
const char* const directions[9] |
uint32 firekeysym[2] [static] |
Definition at line 87 of file keys.c.
Referenced by bind_key(), configure_keys(), init_keys(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
uint32 nextkeysym [static] |
Definition at line 87 of file keys.c.
Referenced by bind_key(), init_keys(), keyfunc(), parse_keybind_line(), save_keys(), and show_keys().
uint32 prevkeysym [static] |
Definition at line 87 of file keys.c.
Referenced by bind_key(), init_keys(), keyfunc(), parse_keybind_line(), save_keys(), and show_keys().
const char* const rcsid_gtk_keys_c = "$Id: keys.c 10997 2008-12-17 03:36:53Z kbulgrien $" |
Definition at line 87 of file keys.c.
Referenced by bind_key(), configure_keys(), init_keys(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().