|
From: <cro...@li...> - 2005-03-27 20:51:33
|
Module Name: client
Committed By: akirschbaum
Date: Sun Mar 27 20:51:25 UTC 2005
Modified Files:
client: ChangeLog
client/common: image.c
client/gtk: gx11.c image.c
client/gtk-v2/src: image.c main.c
client/x11: png.c x11.c x11.h xutil.c
Log Message:
This patch fixes a few memory leaks related to image caching in all clients.
common/image.c: Declare facetoname[] as static. Add all code accessing this
array. Print warning if image cannot be created.
gtk/gx11.c, gtk/image.c, gtk-v2/src/image.c, x11/x11.c, x11/xutil.c: Remove
code accessing facetoname[].
gtk/gx11.c, gtk-v2/src/main5H.c, x11/x11.c: Always call init_cache_data() to
initialize pixmaps[] array.
gtk/image.c, gtk-v2/src/image.c, x11/png.c: Reject invalid face
numbers and fix resource leak in create_and_rescale_image_from_data().
gtk/image.c, gtk-v2/src/image.c, get_map_image_size: Pretend invalid faces to
be of size 1x1 in get_map_image_size().
gtk-v2/src/image.c: Properly free opengl resources in free_pixmap(). Fix
resource leak when freeing old pixmaps in reset_image_data().
x11/png.c: Properly free resources if an error occurs.
x11/x11.c: Ignore invalid face numbers.
x11/x11.h Remove duplicate definition of MAXPIXMAPNUM and facetoname[].
x11/xutil.c: Initialize size of pixmaps[0].
Start of context diffs
Index: client/ChangeLog
diff -c client/ChangeLog:1.6 client/ChangeLog:1.7
*** client/ChangeLog:1.6 Sat Mar 26 11:19:12 2005
--- client/ChangeLog Sun Mar 27 12:51:23 2005
***************
*** 1,8 ****
! "$Id: ChangeLog,v 1.6 2005/03/26 19:19:12 akirschbaum Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
gtk-v2/src/map.c: Fix typo to make it compile without opengl.
Andreas Kirschbaum 2005-03-26
--- 1,27 ----
! "$Id: ChangeLog,v 1.7 2005/03/27 20:51:23 akirschbaum Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
+ This patch fixes a few memory leaks related to image caching in all clients.
+ common/image.c: Declare facetoname[] as static. Add all code accessing this
+ array. Print warning if image cannot be created.
+ gtk/gx11.c, gtk/image.c, gtk-v2/src/image.c, x11/x11.c, x11/xutil.c: Remove
+ code accessing facetoname[].
+ gtk/gx11.c, gtk-v2/src/main.c, x11/x11.c: Always call init_cache_data() to
+ initialize pixmaps[] array.
+ gtk/image.c, gtk-v2/src/image.c, x11/png.c: Reject invalid face
+ numbers and fix resource leak in create_and_rescale_image_from_data().
+ gtk/image.c, gtk-v2/src/image.c, get_map_image_size: Pretend invalid faces to
+ be of size 1x1 in get_map_image_size().
+ gtk-v2/src/image.c: Properly free opengl resources in free_pixmap(). Fix
+ resource leak when freeing old pixmaps in reset_image_data().
+ x11/png.c: Properly free resources if an error occurs.
+ x11/x11.c: Ignore invalid face numbers.
+ x11/x11.h Remove duplicate definition of MAXPIXMAPNUM and facetoname[].
+ x11/xutil.c: Initialize size of pixmaps[0].
+ Andreas Kirschbaum 2005-03-27
+
gtk-v2/src/map.c: Fix typo to make it compile without opengl.
Andreas Kirschbaum 2005-03-26
Index: client/common/image.c
diff -c client/common/image.c:1.17 client/common/image.c:1.18
*** client/common/image.c:1.17 Mon Mar 21 23:22:58 2005
--- client/common/image.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_common_image_c =
! "$Id: image.c,v 1.17 2005/03/22 07:22:58 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_common_image_c =
! "$Id: image.c,v 1.18 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 171,177 ****
/* This holds the name we recieve with the 'face' command so we know what
* to save it as when we actually get the face.
*/
! char *facetoname[MAXPIXMAPNUM];
struct Image_Cache {
--- 171,177 ----
/* This holds the name we recieve with the 'face' command so we know what
* to save it as when we actually get the face.
*/
! static char *facetoname[MAXPIXMAPNUM];
struct Image_Cache {
***************
*** 335,340 ****
--- 335,346 ----
char bmaps[MAX_BUF], inbuf[MAX_BUF];
int i;
+ if (!want_config[CONFIG_CACHE])
+ return;
+
+ for (i = 0; i < MAXPIXMAPNUM; i++)
+ facetoname[i] = NULL;
+
/* First, make sure that image_cache is nulled out */
memset(image_cache, 0, IMAGE_HASH * sizeof(struct Image_Cache));
***************
*** 684,690 ****
}
pngtmp = png_to_data(buf, buflen, &width, &height);
! create_and_rescale_image_from_data(ce, face, pngtmp, width, height);
if (use_config[CONFIG_CACHE]) {
if (facetoname[face]) {
--- 690,698 ----
}
pngtmp = png_to_data(buf, buflen, &width, &height);
! if(create_and_rescale_image_from_data(ce, face, pngtmp, width, height)) {
! LOG(LOG_WARNING, "common::display_newpng", "create_and_rescale_image_from_data failed for face %ld", face);
! }
if (use_config[CONFIG_CACHE]) {
if (facetoname[face]) {
Index: client/gtk/gx11.c
diff -c client/gtk/gx11.c:1.61 client/gtk/gx11.c:1.62
*** client/gtk/gx11.c:1.61 Mon Mar 21 23:22:58 2005
--- client/gtk/gx11.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_gtk_gx11_c =
! "$Id: gx11.c,v 1.61 2005/03/22 07:22:58 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_gtk_gx11_c =
! "$Id: gx11.c,v 1.62 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 580,591 ****
*
*****************************************************************************/
-
- /* This holds the name we recieve with the 'face' command so we know what
- * to save it as when we actually get the face.
- */
- char *facetoname[MAXPIXMAPNUM];
-
/* Initializes the data for image caching */
static void init_cache_data()
{
--- 580,585 ----
***************
*** 619,625 ****
pixmaps[0]->map_mask = pixmaps[0]->icon_mask;
}
pixmaps[0]->icon_width = pixmaps[0]->icon_height = pixmaps[0]->map_width = pixmaps[0]->map_height = map_image_size;
- facetoname[0]=NULL;
/* Don't do anything special for SDL image - rather, that drawing
* code will check to see if there is no data
--- 613,618 ----
***************
*** 628,634 ****
/* Initialize all the images to be of the same value. */
for (i=1; i<MAXPIXMAPNUM; i++) {
pixmaps[i] = pixmaps[0];
- facetoname[i]=NULL;
}
init_common_cache_data();
--- 621,626 ----
***************
*** 5655,5661 ****
return 1;
init_keys();
! if (want_config[CONFIG_CACHE]) init_cache_data();
if (want_config[CONFIG_SPLASH]) destroy_splash();
gtk_timeout_add (10,(GtkFunction)gtk_checkchilds,NULL);
return 0;
--- 5647,5653 ----
return 1;
init_keys();
! init_cache_data();
if (want_config[CONFIG_SPLASH]) destroy_splash();
gtk_timeout_add (10,(GtkFunction)gtk_checkchilds,NULL);
return 0;
Index: client/gtk/image.c
diff -c client/gtk/image.c:1.21 client/gtk/image.c:1.22
*** client/gtk/image.c:1.21 Mon Mar 21 23:22:59 2005
--- client/gtk/image.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_gtk_image_c =
! "$Id: image.c,v 1.21 2005/03/22 07:22:59 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_gtk_image_c =
! "$Id: image.c,v 1.22 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 66,77 ****
#define BPP 4
- /* This holds the name we recieve with the 'face' command so we know what
- * to save it as when we actually get the face.
- */
- char *facetoname[MAXPIXMAPNUM];
-
-
int last_face_num=0;
/* this is used to rescale big images that will be drawn in the inventory/look
--- 66,71 ----
***************
*** 261,266 ****
--- 255,269 ----
uint8 *png_tmp;
PixmapInfo *pi;
+ if (pixmap_num <= 0 || pixmap_num >= MAXPIXMAPNUM)
+ return 1;
+
+ if (pixmaps[pixmap_num] != pixmaps[0]) {
+ free_pixmap(pixmaps[pixmap_num]);
+ free(pixmaps[pixmap_num]);
+ pixmaps[pixmap_num] = pixmaps[0];
+ }
+
pi = calloc(1, sizeof(PixmapInfo));
iscale = use_config[CONFIG_ICONSCALE];
***************
*** 448,454 ****
* is 33 wide, we want that to register as two spaces. By
* adding 31, that works out.
*/
! if ( (face <= 0) || (!pixmaps[face]) ) {
*w = 1;
*h = 1;
} else {
--- 451,457 ----
* is 33 wide, we want that to register as two spaces. By
* adding 31, that works out.
*/
! if (face < 0 || face >= MAXPIXMAPNUM) {
*w = 1;
*h = 1;
} else {
Index: client/gtk-v2/src/image.c
diff -c client/gtk-v2/src/image.c:1.2 client/gtk-v2/src/image.c:1.3
*** client/gtk-v2/src/image.c:1.2 Mon Mar 21 23:23:00 2005
--- client/gtk-v2/src/image.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_gtk2_image_c =
! "$Id: image.c,v 1.2 2005/03/22 07:23:00 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_gtk2_image_c =
! "$Id: image.c,v 1.3 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 70,80 ****
#define BPP 4
- /* This holds the name we recieve with the 'face' command so we know what
- * to save it as when we actually get the face.
- */
- char *facetoname[MAXPIXMAPNUM];
-
PixmapInfo *pixmaps[MAXPIXMAPNUM];
int last_face_num=0;
--- 70,75 ----
***************
*** 229,252 ****
if (pi->icon_image) g_object_unref(pi->icon_image);
if (pi->icon_mask) g_object_unref(pi->icon_mask);
if (pi->map_mask) gdk_pixmap_unref(pi->map_mask);
- if (pi->map_image) {
- #ifdef HAVE_SDL
if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_SDL) {
SDL_FreeSurface(pi->map_image);
free(((SDL_Surface*)pi->map_image)->pixels);
SDL_FreeSurface(pi->fog_image);
free(((SDL_Surface*)pi->fog_image)->pixels);
}
- else
#endif
- if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_PIXMAP) {
- gdk_pixmap_unref(pi->map_image);
}
! else if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_PIXMAP) {
#ifdef HAVE_OPENGL
opengl_free_pixmap(pi);
#endif
}
}
}
--- 224,248 ----
if (pi->icon_image) g_object_unref(pi->icon_image);
if (pi->icon_mask) g_object_unref(pi->icon_mask);
if (pi->map_mask) gdk_pixmap_unref(pi->map_mask);
if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_SDL) {
+ #ifdef HAVE_SDL
+ if (pi->map_image) {
SDL_FreeSurface(pi->map_image);
free(((SDL_Surface*)pi->map_image)->pixels);
SDL_FreeSurface(pi->fog_image);
free(((SDL_Surface*)pi->fog_image)->pixels);
}
#endif
}
! else if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_OPENGL) {
#ifdef HAVE_OPENGL
opengl_free_pixmap(pi);
#endif
}
+ else if (use_config[CONFIG_DISPLAYMODE]==CFG_DM_PIXMAP) {
+ if (pi->map_image) {
+ gdk_pixmap_unref(pi->map_image);
+ }
}
}
***************
*** 263,268 ****
--- 259,273 ----
uint8 *png_tmp;
PixmapInfo *pi;
+ if (pixmap_num <= 0 || pixmap_num >= MAXPIXMAPNUM)
+ return 1;
+
+ if (pixmaps[pixmap_num] != pixmaps[0]) {
+ free_pixmap(pixmaps[pixmap_num]);
+ free(pixmaps[pixmap_num]);
+ pixmaps[pixmap_num] = pixmaps[0];
+ }
+
pi = calloc(1, sizeof(PixmapInfo));
iscale = use_config[CONFIG_ICONSCALE];
***************
*** 386,394 ****
if (!want_config[CONFIG_CACHE] && pixmaps[i] != pixmaps[0]) {
free_pixmap(pixmaps[i]);
free(pixmaps[i]);
- }
pixmaps[i] = pixmaps[0];
}
memset( the_map.cells[0], 0, sizeof( sizeof( struct MapCell)*
the_map.x * the_map.y ));
}
--- 391,399 ----
if (!want_config[CONFIG_CACHE] && pixmaps[i] != pixmaps[0]) {
free_pixmap(pixmaps[i]);
free(pixmaps[i]);
pixmaps[i] = pixmaps[0];
}
+ }
memset( the_map.cells[0], 0, sizeof( sizeof( struct MapCell)*
the_map.x * the_map.y ));
}
***************
*** 455,461 ****
* is 33 wide, we want that to register as two spaces. By
* adding 31, that works out.
*/
! if ( (face <= 0) || (!pixmaps[face]) ) {
*w = 1;
*h = 1;
} else {
--- 460,466 ----
* is 33 wide, we want that to register as two spaces. By
* adding 31, that works out.
*/
! if ( face < 0 || face >= MAXPIXMAPNUM) {
*w = 1;
*h = 1;
} else {
***************
*** 470,481 ****
*
*****************************************************************************/
-
- /* This holds the name we recieve with the 'face' command so we know what
- * to save it as when we actually get the face.
- */
- char *facetoname[MAXPIXMAPNUM];
-
/* Initializes the data for image caching */
void init_cache_data()
{
--- 475,480 ----
***************
*** 516,522 ****
#endif
pixmaps[0]->icon_width = pixmaps[0]->icon_height = pixmaps[0]->map_width = pixmaps[0]->map_height = map_image_size;
- facetoname[0]=NULL;
/* Don't do anything special for SDL image - rather, that drawing
* code will check to see if there is no data
--- 515,520 ----
***************
*** 525,531 ****
/* Initialize all the images to be of the same value. */
for (i=1; i<MAXPIXMAPNUM; i++) {
pixmaps[i] = pixmaps[0];
- facetoname[i]=NULL;
}
init_common_cache_data();
--- 523,528 ----
Index: client/gtk-v2/src/main.c
diff -c client/gtk-v2/src/main.c:1.3 client/gtk-v2/src/main.c:1.4
*** client/gtk-v2/src/main.c:1.3 Mon Mar 21 23:23:00 2005
--- client/gtk-v2/src/main.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_gtk2_main_c =
! "$Id: main.c,v 1.3 2005/03/22 07:23:00 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_gtk2_main_c =
! "$Id: main.c,v 1.4 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 567,573 ****
map_init(window_root);
magic_map = lookup_widget(window_root,"drawingarea_magic_map");
! if (use_config[CONFIG_CACHE]) init_cache_data();
/* Loop to connect to server/metaserver and play the game */
while (1) {
--- 567,573 ----
map_init(window_root);
magic_map = lookup_widget(window_root,"drawingarea_magic_map");
! init_cache_data();
/* Loop to connect to server/metaserver and play the game */
while (1) {
Index: client/x11/png.c
diff -c client/x11/png.c:1.13 client/x11/png.c:1.14
*** client/x11/png.c:1.13 Sun Apr 18 22:14:11 2004
--- client/x11/png.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_x11_png_c =
! "$Id: png.c,v 1.13 2004/04/19 05:14:11 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_x11_png_c =
! "$Id: png.c,v 1.14 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 856,881 ****
{
struct PixmapInfo *pi;
pi = malloc(sizeof(struct PixmapInfo));
! pixmaps[pixmap_num] = pi;
! rgba_to_xpixmap(display, win_game, rgba_data, &pixmaps[pixmap_num]->pixmap,
! &pixmaps[pixmap_num]->mask, &colormap, width, height);
! if (!pixmaps[pixmap_num]->pixmap || !pixmaps[pixmap_num]->mask) return 1;
! pixmaps[pixmap_num]->width = width / image_size;
! pixmaps[pixmap_num]->height = height / image_size;
if (ce) {
ce->image_data = pi;
}
return 0;
}
void get_map_image_size(int face, uint8 *w, uint8 *h)
{
/* This function is not implemented yet, so just return default values */
! if (face == 0 || pixmaps[face] == NULL) {
*w = 1;
*h = 1;
}
--- 856,902 ----
{
struct PixmapInfo *pi;
+ if (pixmap_num <= 0 || pixmap_num >= MAXPIXMAPNUM)
+ return 1;
+
+ if (pixmaps[pixmap_num] != pixmaps[0]) {
+ XFreePixmap(display, pixmaps[pixmap_num]->pixmap);
+ if (pixmaps[pixmap_num]->mask)
+ XFreePixmap(display, pixmaps[pixmap_num]->mask);
+ free(pixmaps[pixmap_num]);
+ pixmaps[pixmap_num] = pixmaps[0];
+ }
+
pi = malloc(sizeof(struct PixmapInfo));
+ if (rgba_to_xpixmap(display, win_game, rgba_data, &pi->pixmap,
+ &pi->mask, &colormap, width, height) != 0) {
+ free(pi);
+ return 1;
+ }
! if (!pi->pixmap || !pi->mask) {
! if (pi->pixmap)
! XFreePixmap(display, pi->pixmap);
! if (pi->mask)
! XFreePixmap(display, pi->mask);
! free(pi);
! return 1;
! }
! pi->width = width / image_size;
! pi->height = height / image_size;
if (ce) {
ce->image_data = pi;
}
+ pixmaps[pixmap_num] = pi;
return 0;
}
void get_map_image_size(int face, uint8 *w, uint8 *h)
{
/* This function is not implemented yet, so just return default values */
! if (face < 0 || face >= MAXPIXMAPNUM) {
*w = 1;
*h = 1;
}
Index: client/x11/x11.c
diff -c client/x11/x11.c:1.27 client/x11/x11.c:1.28
*** client/x11/x11.c:1.27 Sat Feb 26 22:06:30 2005
--- client/x11/x11.c Sun Mar 27 12:51:24 2005
***************
*** 1,5 ****
char *rcsid_x11_x11_c =
! "$Id: x11.c,v 1.27 2005/02/27 06:06:30 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_x11_x11_c =
! "$Id: x11.c,v 1.28 2005/03/27 20:51:24 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 350,356 ****
static void gen_draw_face(Drawable where,int face,int x,int y, int sx, int sy)
{
! if (face<0) {
fprintf(stderr,"Invalid face number: %d @ %d, %d\n", face, x, y);
return;
}
--- 350,356 ----
static void gen_draw_face(Drawable where,int face,int x,int y, int sx, int sy)
{
! if (face < 0 || face >= MAXPIXMAPNUM) {
fprintf(stderr,"Invalid face number: %d @ %d, %d\n", face, x, y);
return;
}
***************
*** 2985,2991 ****
return 1;
init_keys();
! if (want_config[CONFIG_CACHE]) init_cache_data();
set_window_pos();
info_ratio=(float) infodata.width/ (float) (infodata.width + INV_WIDTH);
return 0;
--- 2985,2991 ----
return 1;
init_keys();
! init_cache_data();
set_window_pos();
info_ratio=(float) infodata.width/ (float) (infodata.width + INV_WIDTH);
return 0;
***************
*** 3262,3267 ****
--- 3262,3269 ----
{
int i;
+ reset_image_cache_data();
+
for (i=1; i<MAXPIXMAPNUM; i++) {
if (!want_config[CONFIG_CACHE] && pixmaps[i] != pixmaps[0]) {
XFreePixmap(display, pixmaps[i]->pixmap);
***************
*** 3271,3280 ****
free(pixmaps[i]);
pixmaps[i] = pixmaps[0];
}
- if (want_config[CONFIG_CACHE] && facetoname[i]!=NULL) {
- free(facetoname[i]);
- facetoname[i]=NULL;
- }
}
memset((char*)&the_map.cells[0][0], 0, sizeof(struct MapCell)*the_map.x*the_map.y);
look_list.env=cpl.below;
--- 3273,3278 ----
Index: client/x11/x11.h
diff -c client/x11/x11.h:1.9 client/x11/x11.h:1.10
*** client/x11/x11.h:1.9 Mon Oct 6 00:04:02 2003
--- client/x11/x11.h Sun Mar 27 12:51:25 2005
***************
*** 1,6 ****
/*
* static char *rcsid_x11_h =
! * "$Id: x11.h,v 1.9 2003/10/06 07:04:02 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
--- 1,6 ----
/*
* static char *rcsid_x11_h =
! * "$Id: x11.h,v 1.10 2005/03/27 20:51:25 akirschbaum Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
***************
*** 29,45 ****
#include "client-types.h"
- #define MAXPIXMAPNUM 10000
-
extern int map_size;
extern uint8 map_did_scroll;
extern uint8 updatekeycodes;
extern int updatelock;
- extern char *facetoname[MAXPIXMAPNUM];
struct PixmapInfo {
Pixmap pixmap,mask;
! uint8 width, height;
};
extern struct PixmapInfo *pixmaps[MAXPIXMAPNUM];
--- 29,42 ----
#include "client-types.h"
extern int map_size;
extern uint8 map_did_scroll;
extern uint8 updatekeycodes;
extern int updatelock;
struct PixmapInfo {
Pixmap pixmap,mask;
! uint8 width, height; /* size of pixmap in tiles */
};
extern struct PixmapInfo *pixmaps[MAXPIXMAPNUM];
Index: client/x11/xutil.c
diff -c client/x11/xutil.c:1.18 client/x11/xutil.c:1.19
*** client/x11/xutil.c:1.18 Mon Mar 21 23:23:00 2005
--- client/x11/xutil.c Sun Mar 27 12:51:25 2005
***************
*** 1,5 ****
char *rcsid_x11_xutil_c =
! "$Id: xutil.c,v 1.18 2005/03/22 07:23:00 mwedel Exp $";
/*
Crossfire client, a client program for the crossfire program.
--- 1,5 ----
char *rcsid_x11_xutil_c =
! "$Id: xutil.c,v 1.19 2005/03/27 20:51:25 akirschbaum Exp $";
/*
Crossfire client, a client program for the crossfire program.
***************
*** 123,133 ****
#define MAX_KEYCODE 255
static Key_Entry *keys[256];
- /* This holds the name we recieve with the 'face' command so we know what
- * to save it as when we actually get the face.
- */
- char *facetoname[MAXPIXMAPNUM];
-
/* Can be set when user is moving to new machine type */
uint8 updatekeycodes=FALSE;
--- 123,128 ----
***************
*** 154,169 ****
*/
pixmaps[0]->pixmap=XCreatePixmap(display, win_root, image_size, image_size,
DefaultDepth(display,DefaultScreen(display)));
XCopyPlane(display, ptmp, pixmaps[0]->pixmap, gc_game,
0,0,image_size,image_size,0,0,1);
XFreePixmap(display, ptmp);
- facetoname[0]=NULL;
-
/* Initialize all the images to be of the same value. */
for (i=1; i<MAXPIXMAPNUM; i++) {
pixmaps[i]=pixmaps[0];
- facetoname[i]=NULL;
}
init_common_cache_data();
--- 149,163 ----
*/
pixmaps[0]->pixmap=XCreatePixmap(display, win_root, image_size, image_size,
DefaultDepth(display,DefaultScreen(display)));
+ pixmaps[0]->width = 1;
+ pixmaps[0]->height = 1;
XCopyPlane(display, ptmp, pixmaps[0]->pixmap, gc_game,
0,0,image_size,image_size,0,0,1);
XFreePixmap(display, ptmp);
/* Initialize all the images to be of the same value. */
for (i=1; i<MAXPIXMAPNUM; i++) {
pixmaps[i]=pixmaps[0];
}
init_common_cache_data();
|