Crossfire Client, Branch
R11627
|
#include <client.h>
#include <item.h>
#include <config.h>
#include <p_cmd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include "def-keys.h"
#include "x11proto.h"
#include "x11.h"
#include "pixmaps/question.111"
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 | MAX_KEYCODE 255 |
#define | MAXFACES 5 |
#define | MAXPIXMAPNUM 10000 |
#define | ROTATE_RIGHT(c) if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1; |
Typedefs | |
typedef struct Keys | Key_Entry |
Functions | |
void | addsmooth (uint16 face, uint16 smooth_face) |
Referenced from common/commands.c. | |
void | allocate_colors (Display *disp, Window w, long screen_num, Colormap *colormap, XColor discolor[16]) |
void | bind_key (const char *params) |
void | client_pickup (uint32 pickup) |
We get pickup information from server, update our status. | |
void | client_tick (uint32 tick) |
X11 client doesn't care about this. | |
void | configure_keys (KeyCode k, KeySym keysym) |
int | find_face_in_private_cache (char *face, int checksum) |
static char * | get_key_info (Key_Entry *key, KeyCode kc, int save_mode) |
void | image_update_download_status (int start, int end, int total) |
Draws a status bar showing where we our in terms of downloading all the image data. | |
void | init_cache_data (void) |
Initializes the data for image caching Create question mark to display in each supported rendering mode when an image is not cached. | |
static void | init_default_keybindings (void) |
void | init_keys (void) |
static void | insert_key (KeySym keysym, KeyCode keycode, int flags, char *command) |
void | parse_key (char key, KeyCode keycode, KeySym keysym, int repeated) |
void | parse_key_release (KeyCode kc, KeySym ks) |
void | parse_keybind_line (char *buf, int line, int standard) |
void | reset_map (void) |
Request a map update from the server. | |
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 KeyCode * | bind_keycode |
static KeySym * | bind_keysym |
static const char *const | colorname [] |
static KeyCode | commandkey |
static KeySym | commandkeysym |
static KeyCode | completekey |
static KeySym | completekeysym |
const char *const | directions [9] |
static KeyCode | firekey [2] |
static KeySym | firekeysym [2] |
static Key_Entry * | keys [256] |
int | last_face_num = 0 |
static KeyCode | nextkey |
static KeySym | nextkeysym |
PlayerPosition | pl_pos |
static KeyCode | prevkey |
static KeySym | prevkeysym |
struct { | |
uint32 checksum | |
Pixmap mask | |
char * name | |
Pixmap pixmap | |
} | private_cache [MAXPIXMAPNUM] |
const char * | rcsid_x11_xutil_c = "$Id: xutil.c 9201 2008-06-01 17:32:45Z anmaster $" |
static KeyCode | runkey [2] |
static KeySym | runkeysym [2] |
uint8 | updatekeycodes = FALSE |
int | use_private_cache = 0 |
#define KEYF_EDIT 0x08 /* Line editor */ |
Definition at line 111 of file xutil.c.
Referenced by bind_key(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_FIRE 0x02 /* Used in fire mode */ |
Definition at line 107 of file xutil.c.
Referenced by bind_key(), configure_keys(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_MODIFIERS 0x07 /* Mask for actual keyboard modifiers, */ |
Definition at line 109 of file xutil.c.
Referenced by bind_key(), configure_keys(), get_key_info(), and parse_key().
#define KEYF_NORMAL 0x01 /* Used in normal mode */ |
Definition at line 106 of file xutil.c.
Referenced by bind_key(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_RUN 0x04 /* Used in run mode */ |
Definition at line 108 of file xutil.c.
Referenced by bind_key(), configure_keys(), get_key_info(), parse_key(), and parse_keybind_line().
#define KEYF_STANDARD 0x10 /* For standard (built in) key definitions */ |
Definition at line 112 of file xutil.c.
Referenced by get_key_info(), parse_keybind_line(), show_keys(), and unbind_key().
#define MAX_KEYCODE 255 |
Definition at line 121 of file xutil.c.
Referenced by init_keys(), insert_key(), save_keys(), show_keys(), and unbind_key().
#define MAXPIXMAPNUM 10000 |
Definition at line 1167 of file xutil.c.
Referenced by init_cache_data().
#define ROTATE_RIGHT | ( | c | ) | if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1; |
Referenced from common/commands.c.
face | |
smooth_face |
Definition at line 1190 of file xutil.c.
References pixmaps, and PixmapInfo::smooth_face.
Referenced by SmoothCmd().
void allocate_colors | ( | Display * | disp, |
Window | w, | ||
long | screen_num, | ||
Colormap * | colormap, | ||
XColor | discolor[16] | ||
) |
Definition at line 172 of file xutil.c.
References colorname.
Referenced by get_game_display(), and get_root_display().
void bind_key | ( | const char * | params | ) |
Definition at line 798 of file xutil.c.
References bind_buf, bind_flags, bind_keycode, bind_keysym, commandkey, commandkeysym, completekey, completekeysym, Configure_Keys, cpl, draw_info(), firekey, firekeysym, Player_Struct::input_state, KEYF_EDIT, KEYF_FIRE, KEYF_MODIFIERS, KEYF_NORMAL, KEYF_RUN, MAX_BUF, NDI_BLACK, NDI_RED, nextkey, nextkeysym, prevkey, prevkeysym, runkey, and runkeysym.
void client_pickup | ( | uint32 | pickup | ) |
We get pickup information from server, update our status.
Definition at line 1202 of file xutil.c.
References pickup_count, and pickup_mode.
Referenced by PickupCmd().
void client_tick | ( | uint32 | tick | ) |
X11 client doesn't care about this.
Definition at line 1195 of file xutil.c.
References CFG_DM_SDL, CONFIG_DISPLAYMODE, gtk_draw_map(), inventory_tick(), mapdata_animation(), sdl_gen_map(), and use_config.
Referenced by TickCmd().
void configure_keys | ( | KeyCode | k, |
KeySym | keysym | ||
) |
Definition at line 998 of file xutil.c.
References bind_buf, bind_flags, bind_keycode, bind_keysym, cpl, draw_info(), draw_message_window(), Player_Struct::fire_on, firekey, Player_Struct::input_state, insert_key(), KEYF_FIRE, KEYF_MODIFIERS, KEYF_RUN, Keys::keysym, MAX_BUF, NDI_BLACK, Playing, Player_Struct::run_on, runkey, and save_keys().
int find_face_in_private_cache | ( | char * | face, |
int | checksum | ||
) |
Definition at line 1135 of file xutil.c.
References last_face_num, name, and private_cache.
static char* get_key_info | ( | Key_Entry * | key, |
KeyCode | kc, | ||
int | save_mode | ||
) | [static] |
Definition at line 692 of file xutil.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().
void image_update_download_status | ( | int | start, |
int | end, | ||
int | total | ||
) |
Draws a status bar showing where we our in terms of downloading all the image data.
A few hacks: If start is 1, this is the first batch, so it means we need to create the appropriate status window. If start = end = total, it means were finished, so destroy the gui element.
start | The start value just sent to the server. |
end | |
total | The total number of images. |
Definition at line 1147 of file xutil.c.
References draw_info(), FALSE, get_window_coord(), gtkwin_root, MAX_BUF, NDI_BLUE, padj, pbar, pbar_window, and TRUE.
Referenced by negotiate_connection().
void init_cache_data | ( | void | ) |
Initializes the data for image caching Create question mark to display in each supported rendering mode when an image is not cached.
When image caching is enabled, if a needed image is not yet in the cache, a question mark image is displayed instead. The image displayed is unique to the display mode. This function creates the image to use when OpenGL mode is in effect.
Definition at line 129 of file xutil.c.
References CFG_DM_OPENGL, CFG_DM_PIXMAP, CFG_DM_SDL, CONFIG_DISPLAYMODE, create_opengl_question_mark(), display, gc_game, PixmapInfo::height, PixmapInfo::icon_image, PixmapInfo::icon_mask, image_size, init_common_cache_data(), LOG(), LOG_INFO, map_image_size, PixmapInfo::mask, MAXPIXMAPNUM, PixmapInfo::pixmap, pixmap, pixmaps, use_config, PixmapInfo::width, win_root, and window_root.
static void init_default_keybindings | ( | void | ) | [static] |
Definition at line 435 of file xutil.c.
References def_keys, MAX_BUF, and parse_keybind_line().
Referenced by init_keys().
void init_keys | ( | void | ) |
Definition at line 452 of file xutil.c.
References BIG_BUF, cancelkeysym, client_libdir, Keys::command, commandkey, commandkeysym, completekey, completekeysym, cpl, display, firekey, firekeysym, init_default_keybindings(), KEYHASH, LOG(), LOG_INFO, MAX_KEYCODE, Player_Struct::name, Keys::next, nextkey, nextkeysym, parse_keybind_line(), prevkey, prevkeysym, runkey, and runkeysym.
Referenced by init_windows(), and setUserPass().
static void insert_key | ( | KeySym | keysym, |
KeyCode | keycode, | ||
int | flags, | ||
char * | command | ||
) | [static] |
Definition at line 221 of file xutil.c.
References Keys::command, Keys::direction, directions, Keys::flags, Keys::keysym, LOG(), LOG_WARNING, MAX_KEYCODE, Keys::next, and strdup_local().
Referenced by configure_keys(), and parse_keybind_line().
void parse_key | ( | char | key, |
KeyCode | keycode, | ||
KeySym | keysym, | ||
int | repeated | ||
) |
Definition at line 578 of file xutil.c.
References Keys::command, Command_Mode, commandkey, commandkeysym, CONFIG_ECHO, Player_Struct::count, counttext, cpl, Keys::direction, draw_info(), draw_message_window(), draw_prompt(), entrytext, extended_command(), FALSE, fire_dir(), fire_label, Player_Struct::fire_on, firekey, firekeysym, Keys::flags, Player_Struct::input_state, Player_Struct::input_text, KEYF_EDIT, KEYF_FIRE, KEYF_MODIFIERS, KEYF_NORMAL, KEYF_RUN, Keys::keysym, MAX_BUF, NDI_BLACK, Keys::next, Player_Struct::no_echo, run_dir(), run_label, Player_Struct::run_on, runkey, runkeysym, and use_config.
void parse_key_release | ( | KeyCode | kc, |
KeySym | ks | ||
) |
Definition at line 537 of file xutil.c.
References clear_fire(), clear_run(), CONFIG_ECHO, cpl, draw_info(), draw_message_window(), fire_label, Player_Struct::fire_on, firekey, firekeysym, NDI_BLACK, run_label, Player_Struct::run_on, runkey, runkeysym, stop_fire(), stop_run(), and use_config.
void parse_keybind_line | ( | char * | buf, |
int | line, | ||
int | standard | ||
) |
Definition at line 280 of file xutil.c.
References bind_buf, commandkey, commandkeysym, completekey, completekeysym, display, firekey, firekeysym, Keys::flags, insert_key(), KEYF_EDIT, KEYF_FIRE, KEYF_NORMAL, KEYF_RUN, KEYF_STANDARD, Keys::keysym, LOG(), LOG_WARNING, nextkey, nextkeysym, prevkey, prevkeysym, runkey, runkeysym, and updatekeycodes.
void reset_map | ( | void | ) |
Request a map update from the server.
This is to circumvent a bug in some server versions.
Definition at line 1185 of file xutil.c.
Referenced by display_map_newmap(), and keyfunc().
static void save_individual_key | ( | FILE * | fp, |
Key_Entry * | key, | ||
KeyCode | kc | ||
) | [static] |
Definition at line 933 of file xutil.c.
References get_key_info(), and Keys::next.
Referenced by save_keys().
static void save_keys | ( | void | ) | [static] |
Definition at line 940 of file xutil.c.
References commandkey, commandkeysym, completekey, completekeysym, draw_info(), firekey, firekeysym, LOG(), LOG_WARNING, make_path_to_file(), MAX_BUF, MAX_KEYCODE, NDI_BLACK, nextkey, nextkeysym, prevkey, prevkeysym, runkey, runkeysym, and save_individual_key().
Referenced by configure_keys(), and unbind_key().
static void show_keys | ( | int | allbindings | ) | [static] |
Definition at line 746 of file xutil.c.
References commandkey, commandkeysym, completekey, completekeysym, draw_info(), firekey, firekeysym, Keys::flags, get_key_info(), KEYF_STANDARD, MAX_BUF, MAX_KEYCODE, NDI_BLACK, Keys::next, nextkey, nextkeysym, prevkey, prevkeysym, runkey, and runkeysym.
Referenced by unbind_key().
static void unbind_usage | ( | void | ) | [static] |
Definition at line 1049 of file xutil.c.
References draw_info(), and NDI_BLACK.
Referenced by unbind_key().
Definition at line 104 of file xutil.c.
Referenced by bind_key(), configure_keys(), get_key_info(), and parse_keybind_line().
int bind_flags = 0 [static] |
Definition at line 103 of file xutil.c.
Referenced by bind_key(), and configure_keys().
KeyCode * bind_keycode [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), and configure_keys().
KeySym * bind_keysym [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), and configure_keys().
const char* const colorname[] [static] |
KeyCode commandkey [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_key(), parse_keybind_line(), save_keys(), and show_keys().
KeySym commandkeysym [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_key(), parse_keybind_line(), save_keys(), and show_keys().
KeyCode completekey [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_keybind_line(), save_keys(), and show_keys().
KeySym completekeysym [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_keybind_line(), save_keys(), and show_keys().
const char* const directions[9] |
Definition at line 48 of file player.c.
Referenced by insert_key(), and move_player().
KeyCode firekey[2] [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), configure_keys(), init_keys(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
KeySym firekeysym[2] [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
int last_face_num = 0 |
Pixmap mask |
Definition at line 67 of file xutil.c.
Referenced by create_and_rescale_image_from_data(), gen_draw_face(), Map2Cmd(), MapExtendedCmd(), and reset_image_data().
KeyCode nextkey [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_keybind_line(), save_keys(), and show_keys().
KeySym nextkeysym [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_keybind_line(), save_keys(), and show_keys().
Pixmap pixmap |
Definition at line 67 of file xutil.c.
Referenced by create_and_rescale_image_from_data(), gen_draw_face(), init_cache_data(), rebuild_our_widget(), reset_image_data(), and update_spell_list().
Definition at line 1177 of file xutil.c.
Referenced by display_map_doneupdate(), display_mapcell(), expand_clear_bigface(), expand_set_bigface(), ExtSmooth(), mapdata_animation(), mapdata_bigface(), mapdata_clear_old(), mapdata_clear_space(), mapdata_face(), mapdata_init(), mapdata_scroll(), mapdata_set_anim_layer(), mapdata_set_check_space(), mapdata_set_darkness(), mapdata_set_face_layer(), mapdata_set_size(), mapdata_set_smooth(), recenter_virtual_map_view(), and script_process_cmd().
KeyCode prevkey [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_keybind_line(), save_keys(), and show_keys().
KeySym prevkeysym [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_keybind_line(), save_keys(), and show_keys().
struct { ... } private_cache[MAXPIXMAPNUM] |
const char* rcsid_x11_xutil_c = "$Id: xutil.c 9201 2008-06-01 17:32:45Z anmaster $" |
KeyCode runkey[2] [static] |
Definition at line 99 of file xutil.c.
Referenced by bind_key(), configure_keys(), init_keys(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
KeySym runkeysym[2] [static] |
Definition at line 101 of file xutil.c.
Referenced by bind_key(), init_keys(), parse_key(), parse_key_release(), parse_keybind_line(), save_keys(), and show_keys().
int use_private_cache = 0 |