Skip to content

Commit

Permalink
Stop embedding the default theme in the executable
Browse files Browse the repository at this point in the history
Now the theme is always dynamically loaded as if we used the -graphic option
  • Loading branch information
Hugo committed Apr 21, 2015
1 parent d64e316 commit eef4885
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
#AC_INIT([xjump], [2.8], []) #email
AC_INIT([xjump], [2.8], []) #email

AC_CONFIG_SRCDIR([src/game.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile themes/Makefile])

AM_INIT_AUTOMAKE


# Checks for programs.
AC_PROG_CC
Expand All @@ -27,4 +27,4 @@ AC_TYPE_UID_T
AC_FUNC_ERROR_AT_LINE
AC_CHECK_FUNCS([ftruncate])

AC_OUTPUT(Makefile src/Makefile man/Makefile themes/Makefile)
AC_OUTPUT
4 changes: 3 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
AM_CFLAGS = --std=c99 --pedantic -Wall -O2
AM_CPPFLAGS = -DRECORD_ENTRY=20 -DRECORD_FILE=\"@localstatedir@/xjump/highscores\"
AM_CPPFLAGS = -DRECORD_ENTRY=20 \
-DRECORD_FILE=\"@localstatedir@/xjump/highscores\" \
-DGRAPH_FILE=\"$(pkgdatadir)/themes/default.xpm\"
AM_LDFLAGS = -lXaw -lXt -lXpm -lX11

bin_PROGRAMS = xjump
Expand Down
17 changes: 5 additions & 12 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include"record.h"
#include"config.h"

#include"themes/default.xpm"
#include"icon.xbm"
#include"icon_msk.xbm"

Expand Down Expand Up @@ -58,7 +57,7 @@ static Colormap Cmap;
static int IntervalState;
static XtIntervalId IntervalId;

static char *GraphFile = NULL; /* For custom graphics */
static char *GraphFile = GRAPH_FILE; /* For custom graphics */

static GameState GameMode; /* 0=Title; 1=Game; 2=GameOver; 3=Pause */

Expand Down Expand Up @@ -417,20 +416,14 @@ static void option( int argc, char **argv )

static void make_graphic( void )
{
int i;
XpmAttributes attr;

attr.valuemask = XpmColormap;
attr.colormap = Cmap;

if( GraphFile != NULL )
i = XpmReadFileToPixmap( Disp,DefaultRootWindow(Disp),GraphFile,
&Char_p,&Char_m,&attr );
else
i = XpmCreatePixmapFromData( Disp,DefaultRootWindow(Disp),
picture_xpm,&Char_p,&Char_m,&attr );
if( i ){
fprintf( stderr,"%s: %s\n",Myname,XpmGetErrorString(i) );
int err = XpmReadFileToPixmap( Disp, DefaultRootWindow(Disp), GraphFile,
&Char_p,&Char_m,&attr );
if( err ){
fprintf( stderr,"%s: %s\n",Myname,XpmGetErrorString(err) );
exit(1);
}

Expand Down

0 comments on commit eef4885

Please sign in to comment.