~ubuntu-branches/ubuntu/maverick/crossfire-client/maverick

« back to all changes in this revision

Viewing changes to x11/xutil.c

  • Committer: Bazaar Package Importer
  • Author(s): Kari Pahula
  • Date: 2005-08-20 23:46:35 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050820234635-m3nwl2a0190jc15f
Tags: 1.8.0-1
* New upstream release (closes: #298438)
* New maintainer
* Set datadir to /usr/share/games and sounddir to
  /usr/share/games/crossfire/sounds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
char *rcsid_x11_xutil_c =
2
 
    "$Id: xutil.c,v 1.16 2004/01/31 20:13:11 tchize Exp $";
 
2
    "$Id: xutil.c,v 1.19 2005/03/27 20:51:25 akirschbaum Exp $";
3
3
/*
4
4
    Crossfire client, a client program for the crossfire program.
5
5
 
30
30
#include <client.h>
31
31
#include <item.h>
32
32
#include <config.h>
 
33
#include <p_cmd.h>
33
34
 
34
35
#ifdef HAVE_LIBXPM
35
36
#include <X11/xpm.h>
122
123
#define MAX_KEYCODE 255
123
124
static Key_Entry *keys[256];
124
125
 
125
 
/* This holds the name we recieve with the 'face' command so we know what
126
 
 * to save it as when we actually get the face.
127
 
 */
128
 
char *facetoname[MAXPIXMAPNUM];
129
 
 
130
126
/* Can be set when user is moving to new machine type */
131
127
uint8 updatekeycodes=FALSE;
132
128
 
153
149
     */
154
150
    pixmaps[0]->pixmap=XCreatePixmap(display, win_root, image_size, image_size, 
155
151
        DefaultDepth(display,DefaultScreen(display)));
 
152
    pixmaps[0]->width = 1;
 
153
    pixmaps[0]->height = 1;
156
154
    XCopyPlane(display, ptmp, pixmaps[0]->pixmap, gc_game,
157
155
               0,0,image_size,image_size,0,0,1);
158
156
    XFreePixmap(display, ptmp);
159
157
                
160
 
    facetoname[0]=NULL;
161
 
 
162
158
    /* Initialize all the images to be of the same value. */
163
159
    for (i=1; i<MAXPIXMAPNUM; i++)  {
164
160
        pixmaps[i]=pixmaps[0];
165
 
        facetoname[i]=NULL;
166
161
    }
167
162
 
168
163
    init_common_cache_data();
244
239
    Key_Entry *newkey;
245
240
    int i, direction=-1;
246
241
 
 
242
#if 0
 
243
    /* This is at least a meaningless check on my system that results in
 
244
     * a compile warning (always false result), so may was well comment it
 
245
     * out - MSW 2005-02-09
 
246
     */
247
247
    if (keycode>MAX_KEYCODE) {
248
248
        LOG(LOG_WARNING,"x11::insert_key", "keycode that is passed is greater than 255.");
249
249
        keycode=0;      /* hopefully the rest of the data is OK */
250
250
    }
 
251
#endif
251
252
    if (keys[keycode]==NULL) {
252
253
        keys[keycode]=malloc(sizeof(Key_Entry));
253
254
        keys[keycode]->command=NULL;
809
810
 
810
811
 
811
812
 
812
 
void bind_key(char *params)
 
813
void bind_key(const char *params)
813
814
{
814
815
  char buf[MAX_BUF];
815
816
 
922
923
    return;
923
924
  }
924
925
 
925
 
    if (strlen(params) >= sizeof(bind_buf)) {
926
 
        params[sizeof(bind_buf) - 1] = '\0';
 
926
  strncpy(bind_buf, params, sizeof(bind_buf)-1);
 
927
  bind_buf[sizeof(bind_buf)-1]=0;
 
928
  if (strlen(params) >= sizeof(bind_buf)) {
927
929
    draw_info("Keybinding too long! Truncated:",NDI_RED);
928
 
    draw_info(params,NDI_RED);
929
 
    }
930
 
  sprintf(buf, "Push key to bind '%s'.", params);
 
930
    draw_info(bind_buf,NDI_RED);
 
931
  }
 
932
 
 
933
  sprintf(buf, "Push key to bind '%s'.", bind_buf);
931
934
  draw_info(buf,NDI_BLACK);
932
 
  strcpy(bind_buf, params);
933
935
  bind_keycode=NULL;
934
936
  cpl.input_state = Configure_Keys;
935
937
  return;
1067
1069
    draw_info("    -g unbinds a global binding", NDI_BLACK);
1068
1070
}
1069
1071
 
1070
 
void unbind_key(char *params)
 
1072
void unbind_key(const char *params)
1071
1073
{
1072
1074
    int count=0, keyentry, onkey,global=0;
1073
1075
    Key_Entry *key, *tmp;
1326
1328
         * let the neighbors know they should update their darkness
1327
1329
         * now.
1328
1330
         */
1329
 
        if (use_config[CONFIG_SDL]) {
 
1331
        if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_SDL) {
1330
1332
            if (x-1>0) the_map.cells[x-1][y].need_update = 1;
1331
1333
            if (y-1>0) the_map.cells[x][y-1].need_update = 1;
1332
1334
            if (x+1<use_config[CONFIG_MAPWIDTH]) the_map.cells[x+1][y].need_update = 1;
1513
1515
        }
1514
1516
    }
1515
1517
}
 
1518
 
 
1519
 
 
1520
/* x11 client doesn't do smoothing, so don't need to do anything with this */
 
1521
void addsmooth(uint16 face, uint smooth_face)
 
1522
{
 
1523
}