Crossfire Client, Branches  R11627
xutil.c File Reference
#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"
+ Include dependency graph for xutil.c:

Go to the source code of this file.

Data Structures

struct  Keys
 

Macros

#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)
 
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)
 
void client_tick (uint32 tick)
 
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)
 
void init_cache_data (void)
 
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)
 
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_Entrykeys [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
 
static KeyCode runkey [2]
 
static KeySym runkeysym [2]
 
uint8 updatekeycodes =FALSE
 
int use_private_cache =0
 

Macro Definition Documentation

#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 MAXFACES   5

Definition at line 1166 of file xutil.c.

#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;

Definition at line 167 of file xutil.c.

Typedef Documentation

typedef struct Keys Key_Entry

Function Documentation

void addsmooth ( uint16  face,
uint16  smooth_face 
)

Referenced from common/commands.c

Parameters
face
smooth_face

Definition at line 1190 of file xutil.c.

References pixmaps, and PixmapInfo::smooth_face.

Referenced by SmoothCmd().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void configure_keys ( KeyCode  k,
KeySym  keysym 
)
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().

+ Here is the caller graph for this function:

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.

Parameters
startThe start value just sent to the server.
end
totalThe 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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, PixmapInfo::fog_image, gc_game, PixmapInfo::height, PixmapInfo::icon_height, PixmapInfo::icon_image, PixmapInfo::icon_mask, PixmapInfo::icon_width, image_size, init_common_cache_data(), LOG(), LOG_INFO, PixmapInfo::map_height, PixmapInfo::map_image, map_image_size, PixmapInfo::map_mask, PixmapInfo::map_width, PixmapInfo::mask, MAXPIXMAPNUM, PixmapInfo::pixmap, pixmap, pixmaps, PixmapInfo::smooth_face, use_config, PixmapInfo::width, win_root, and window_root.

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void init_keys ( void  )
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void parse_key_release ( KeyCode  kc,
KeySym  ks 
)
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.

Referenced by init_default_keybindings(), and init_keys().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void reset_map ( void  )

Request a map update from the server. This is to circumvent a bug in some server versions.

Todo:
remove

Definition at line 1185 of file xutil.c.

Referenced by display_map_newmap(), and keyfunc().

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void unbind_usage ( void  )
static

Definition at line 1049 of file xutil.c.

References draw_info(), and NDI_BLACK.

Referenced by unbind_key().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

char bind_buf[MAX_BUF]
static

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().

uint32 checksum

Definition at line 66 of file xutil.c.

const char* const colorname[]
static
Initial value:
= {
"Black",
"White",
"Navy",
"Red",
"Chocolate",
"DodgerBlue",
"DarkOrange2",
"SeaGreen",
"DarkSeaGreen",
"Grey80",
"Sienna",
"Gold",
"Khaki"
}

Definition at line 48 of file xutil.c.

Referenced by allocate_colors().

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
KeySym firekeysym[2]
static
Key_Entry* keys[256]
static

Definition at line 122 of file xutil.c.

int last_face_num =0

Definition at line 70 of file xutil.c.

Referenced by find_face_in_private_cache().

Pixmap mask
char* name

Definition at line 65 of file xutil.c.

Referenced by find_face_in_private_cache().

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().

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
Initial value:
=
"$Id: xutil.c 9201 2008-06-01 17:32:45Z anmaster $"

Definition at line 1 of file xutil.c.

KeyCode runkey[2]
static
KeySym runkeysym[2]
static
uint8 updatekeycodes =FALSE

Definition at line 125 of file xutil.c.

Referenced by parse_keybind_line().

int use_private_cache =0

Definition at line 70 of file xutil.c.