tuxpaint.c code & warning clean-up (WIP)
- Replace any C++ style comments (// ...) with C style (/* ... */). - Improve calls to fgets() to avoid "ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]" errors (WIP). - Removed some unused, commented-out code.
This commit is contained in:
parent
a8a0276f89
commit
284a64a08f
1 changed files with 328 additions and 361 deletions
259
src/tuxpaint.c
259
src/tuxpaint.c
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Tux Paint - A simple drawing program for children.
|
Tux Paint - A simple drawing program for children.
|
||||||
|
|
||||||
Copyright (c) 2002-2014 by Bill Kendrick and others; see AUTHORS.txt
|
Copyright (c) 2002-2017 by Bill Kendrick and others; see AUTHORS.txt
|
||||||
bill@newbreedsoftware.com
|
bill@newbreedsoftware.com
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - April 16, 2014
|
June 14, 2002 - October 15, 2017
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ static scaleparams scaletable[] = {
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <libgen.h> //EP added this include for basename()
|
#include <libgen.h> /* EP added this include for basename() */
|
||||||
|
|
||||||
/* On Linux, we can use 'wordexp()' to expand env. vars. in settings
|
/* On Linux, we can use 'wordexp()' to expand env. vars. in settings
|
||||||
pulled from config. files */
|
pulled from config. files */
|
||||||
|
|
@ -256,7 +256,7 @@ char *strcasestr(const char *haystack, const char *needle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#undef gettext //EP to avoid warning on following line
|
#undef gettext /* EP to avoid warning on following line */
|
||||||
#define gettext(String) debug_gettext(String)
|
#define gettext(String) debug_gettext(String)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -276,7 +276,7 @@ char *strcasestr(const char *haystack, const char *needle)
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#if defined __BEOS__ //|| defined __HAIKU__
|
#if defined __BEOS__
|
||||||
|
|
||||||
/* BeOS */
|
/* BeOS */
|
||||||
|
|
||||||
|
|
@ -467,7 +467,7 @@ static void mtw(wchar_t * wtok, char *tok)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <zlib.h> //EP added for PNG upgrade from 1.2 to 1.5
|
#include <zlib.h> /* EP added for PNG upgrade from 1.2 to 1.5 */
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
#define FNAME_EXTENSION ".png"
|
#define FNAME_EXTENSION ".png"
|
||||||
|
|
@ -512,7 +512,7 @@ static void mtw(wchar_t * wtok, char *tok)
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
|
||||||
|
|
||||||
//EP added #ifndef __APPLE__ because macros are buggy (shifted by 1 byte), plus the function exists in SDL
|
/* EP added #ifndef __APPLE__ because macros are buggy (shifted by 1 byte), plus the function exists in SDL */
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#if VIDEO_BPP==32
|
#if VIDEO_BPP==32
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
@ -549,9 +549,9 @@ static void mtw(wchar_t * wtok, char *tok)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define fmemopen_alternative */ /* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
/* #define fmemopen_alternative */ /* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
||||||
|
|
||||||
#if defined (WIN32) || defined (__APPLE__) || defined(__NetBSD__) || defined(__sun) // MINGW/MSYS, NetBSD, and MacOSX need it, at least for now
|
#if defined (WIN32) || defined (__APPLE__) || defined(__NetBSD__) || defined(__sun) /* MINGW/MSYS, NetBSD, and MacOSX need it, at least for now */
|
||||||
#define fmemopen_alternative
|
#define fmemopen_alternative
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -623,8 +623,8 @@ enum
|
||||||
{
|
{
|
||||||
LABEL_OFF,
|
LABEL_OFF,
|
||||||
LABEL_LABEL,
|
LABEL_LABEL,
|
||||||
LABEL_SELECT //,
|
LABEL_SELECT
|
||||||
// LABEL_ROTATE
|
/* , LABEL_ROTATE */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -715,7 +715,7 @@ static grid_dims gd_colors; /* was 17x1 */
|
||||||
static int WINDOW_WIDTH = 800;
|
static int WINDOW_WIDTH = 800;
|
||||||
static int WINDOW_HEIGHT = 480;
|
static int WINDOW_HEIGHT = 480;
|
||||||
#elif defined(OLPC_XO)
|
#elif defined(OLPC_XO)
|
||||||
// ideally we'd support rotation and 2x scaling
|
/* ideally we'd support rotation and 2x scaling */
|
||||||
static int WINDOW_WIDTH = 1200;
|
static int WINDOW_WIDTH = 1200;
|
||||||
static int WINDOW_HEIGHT = 900;
|
static int WINDOW_HEIGHT = 900;
|
||||||
#else
|
#else
|
||||||
|
|
@ -996,12 +996,7 @@ static void update_canvas_ex_r(int x1, int y1, int x2, int y2, int screen_too)
|
||||||
|
|
||||||
SDL_BlitSurface(img_starter, &dest, canvas, &dest);
|
SDL_BlitSurface(img_starter, &dest, canvas, &dest);
|
||||||
}
|
}
|
||||||
// printf("%d\n", canvas );
|
|
||||||
//printf("%d, %d, %d, %d\n", dest.x, dest.y, dest.w, dest.h);
|
|
||||||
//printf("%d\n", screen);
|
|
||||||
//printf("%d, %d, %d, %d\n\n\n", r_canvas.x, r_canvas.y, r_canvas.w, r_canvas.w);
|
|
||||||
|
|
||||||
// src.x = x1 + 96;
|
|
||||||
dest.x = x1 + 96;
|
dest.x = x1 + 96;
|
||||||
|
|
||||||
SDL_BlitSurface(canvas, &src, screen, &dest);
|
SDL_BlitSurface(canvas, &src, screen, &dest);
|
||||||
|
|
@ -1443,7 +1438,7 @@ static Uint16 *wcstou16(const wchar_t * str)
|
||||||
will cause a change from one utf16 character into two....
|
will cause a change from one utf16 character into two....
|
||||||
(though at least UTF-8 suffers from this problem) */
|
(though at least UTF-8 suffers from this problem) */
|
||||||
|
|
||||||
// FIXME: mangles non-BMP characters rather than using UTF-16 surrogates!
|
/* FIXME: mangles non-BMP characters rather than using UTF-16 surrogates! */
|
||||||
res[i] = (Uint16) str[i];
|
res[i] = (Uint16) str[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2239,7 +2234,7 @@ static void mainloop(void)
|
||||||
mod = event.key.keysym.mod;
|
mod = event.key.keysym.mod;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// FIXME: debug junk
|
/* FIXME: debug junk */
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"key 0x%04x mod 0x%04x character 0x%04x %d <%c> is %sprintable, key_down 0x%x\n",
|
"key 0x%04x mod 0x%04x character 0x%04x %d <%c> is %sprintable, key_down 0x%x\n",
|
||||||
(unsigned)key,
|
(unsigned)key,
|
||||||
|
|
@ -2662,7 +2657,7 @@ static void mainloop(void)
|
||||||
add_label_node(0, 0, 0, 0, NULL);
|
add_label_node(0, 0, 0, 0, NULL);
|
||||||
derender_node(&label_node_to_edit);
|
derender_node(&label_node_to_edit);
|
||||||
label_node_to_edit = NULL;
|
label_node_to_edit = NULL;
|
||||||
// playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); // FIXME lack of specific sound
|
/* playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); */ /* FIXME lack of specific sound */
|
||||||
|
|
||||||
if (been_saved)
|
if (been_saved)
|
||||||
{
|
{
|
||||||
|
|
@ -2704,7 +2699,6 @@ static void mainloop(void)
|
||||||
cur_font = select_cur_font;
|
cur_font = select_cur_font;
|
||||||
text_state = select_text_state;
|
text_state = select_text_state;
|
||||||
text_size = select_text_size;
|
text_size = select_text_size;
|
||||||
// int j;
|
|
||||||
for (j = 0; j < num_font_families; j++)
|
for (j = 0; j < num_font_families; j++)
|
||||||
{
|
{
|
||||||
if (user_font_families[j] && user_font_families[j]->handle)
|
if (user_font_families[j] && user_font_families[j]->handle)
|
||||||
|
|
@ -2777,7 +2771,7 @@ static void mainloop(void)
|
||||||
add_label_node(0, 0, 0, 0, NULL);
|
add_label_node(0, 0, 0, 0, NULL);
|
||||||
derender_node(&label_node_to_edit);
|
derender_node(&label_node_to_edit);
|
||||||
label_node_to_edit = NULL;
|
label_node_to_edit = NULL;
|
||||||
// playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); // FIXME lack of specific sound
|
/* playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); */ /* FIXME lack of specific sound */
|
||||||
|
|
||||||
if (been_saved)
|
if (been_saved)
|
||||||
{
|
{
|
||||||
|
|
@ -3331,8 +3325,6 @@ static void mainloop(void)
|
||||||
WARNING: this must be kept in sync with the mouse-move
|
WARNING: this must be kept in sync with the mouse-move
|
||||||
code (for cursor changes) and mouse-scroll code. */
|
code (for cursor changes) and mouse-scroll code. */
|
||||||
|
|
||||||
// magic_switchout(canvas);
|
|
||||||
|
|
||||||
if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_STAMP ||
|
if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_STAMP ||
|
||||||
cur_tool == TOOL_SHAPES || cur_tool == TOOL_LINES ||
|
cur_tool == TOOL_SHAPES || cur_tool == TOOL_LINES ||
|
||||||
cur_tool == TOOL_MAGIC || cur_tool == TOOL_TEXT ||
|
cur_tool == TOOL_MAGIC || cur_tool == TOOL_TEXT ||
|
||||||
|
|
@ -3911,7 +3903,8 @@ static void mainloop(void)
|
||||||
}
|
}
|
||||||
else if (cur_tool == TOOL_TEXT || cur_tool == TOOL_LABEL)
|
else if (cur_tool == TOOL_TEXT || cur_tool == TOOL_LABEL)
|
||||||
{
|
{
|
||||||
/* FIXME *//* char font_tux_text[512]; */
|
/* FIXME */
|
||||||
|
/* char font_tux_text[512]; */
|
||||||
|
|
||||||
cur_font = cur_thing;
|
cur_font = cur_thing;
|
||||||
|
|
||||||
|
|
@ -6434,8 +6427,8 @@ static void loadbrush_callback(SDL_Surface * screen,
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
fgets(buf, sizeof(buf), fi);
|
if (fgets(buf, sizeof(buf), fi))
|
||||||
|
{
|
||||||
if (strstr(buf, "frames=") != NULL)
|
if (strstr(buf, "frames=") != NULL)
|
||||||
{
|
{
|
||||||
brushes_frames[num_brushes] = atoi(strstr(buf, "frames=") + 7);
|
brushes_frames[num_brushes] = atoi(strstr(buf, "frames=") + 7);
|
||||||
|
|
@ -6453,6 +6446,7 @@ static void loadbrush_callback(SDL_Surface * screen,
|
||||||
want_rand = 1;
|
want_rand = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (!feof(fi));
|
while (!feof(fi));
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
||||||
|
|
@ -7365,7 +7359,7 @@ static void loadstamp_callback(SDL_Surface * screen,
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
if (dotext > files[i].str && !strcasecmp(dotext, ext)
|
if (dotext > files[i].str && !strcasecmp(dotext, ext)
|
||||||
&& (dotext - files[i].str + 1 + dirlen < sizeof fname)
|
&& (dotext - files[i].str + 1 + dirlen < (int) (sizeof fname))
|
||||||
&& !strcasestr(files[i].str, mirror_ext)
|
&& !strcasestr(files[i].str, mirror_ext)
|
||||||
&& !strcasestr(files[i].str, flip_ext) && !strcasestr(files[i].str, mirrorflip_ext))
|
&& !strcasestr(files[i].str, flip_ext) && !strcasestr(files[i].str, mirrorflip_ext))
|
||||||
{
|
{
|
||||||
|
|
@ -10628,8 +10622,8 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
fgets(buf, sizeof(buf), fi);
|
if (fgets(buf, sizeof(buf), fi))
|
||||||
|
{
|
||||||
if (!feof(fi))
|
if (!feof(fi))
|
||||||
{
|
{
|
||||||
strip_trailing_whitespace(buf);
|
strip_trailing_whitespace(buf);
|
||||||
|
|
@ -10666,8 +10660,6 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
|
||||||
need_right_to_left = wished_langs[i].need_right_to_left;
|
need_right_to_left = wished_langs[i].need_right_to_left;
|
||||||
need_right_to_left_word = wished_langs[i].need_right_to_left_word;
|
need_right_to_left_word = wished_langs[i].need_right_to_left_word;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
debug("...FOUND!");
|
debug("...FOUND!");
|
||||||
|
|
@ -10675,6 +10667,7 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (!feof(fi) && !found);
|
while (!feof(fi) && !found);
|
||||||
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
@ -10723,8 +10716,8 @@ static double loadinfo(const char *const fname, stamp_type * inf)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
fgets(buf, sizeof buf, fi);
|
if (fgets(buf, sizeof buf, fi))
|
||||||
|
{
|
||||||
if (!feof(fi))
|
if (!feof(fi))
|
||||||
{
|
{
|
||||||
strip_trailing_whitespace(buf);
|
strip_trailing_whitespace(buf);
|
||||||
|
|
@ -10808,6 +10801,7 @@ static double loadinfo(const char *const fname, stamp_type * inf)
|
||||||
inf->flipable = 0;
|
inf->flipable = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (!feof(fi));
|
while (!feof(fi));
|
||||||
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
@ -10961,7 +10955,7 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
||||||
char fname[FILENAME_MAX];
|
char fname[FILENAME_MAX];
|
||||||
FILE *fi;
|
FILE *fi;
|
||||||
char color_tag;
|
char color_tag;
|
||||||
int r, g, b;
|
int r, g, b, tmp;
|
||||||
|
|
||||||
rname = NULL;
|
rname = NULL;
|
||||||
|
|
||||||
|
|
@ -10980,12 +10974,13 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
||||||
|
|
||||||
if (fi != NULL)
|
if (fi != NULL)
|
||||||
{
|
{
|
||||||
fgets(starter_id, sizeof(starter_id), fi);
|
if (fgets(starter_id, sizeof(starter_id), fi))
|
||||||
|
{
|
||||||
starter_id[strlen(starter_id) - 1] = '\0';
|
starter_id[strlen(starter_id) - 1] = '\0';
|
||||||
|
|
||||||
fscanf(fi, "%d", &starter_mirrored);
|
tmp = fscanf(fi, "%d", &starter_mirrored);
|
||||||
fscanf(fi, "%d", &starter_flipped);
|
tmp = fscanf(fi, "%d", &starter_flipped);
|
||||||
fscanf(fi, "%d", &starter_personal);
|
tmp = fscanf(fi, "%d", &starter_personal);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -10995,9 +10990,9 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
||||||
|
|
||||||
if (!feof(fi) && color_tag == 'c')
|
if (!feof(fi) && color_tag == 'c')
|
||||||
{
|
{
|
||||||
fscanf(fi, "%d", &r);
|
tmp = fscanf(fi, "%d", &r);
|
||||||
fscanf(fi, "%d", &g);
|
tmp = fscanf(fi, "%d", &g);
|
||||||
fscanf(fi, "%d", &b);
|
tmp = fscanf(fi, "%d", &b);
|
||||||
|
|
||||||
canvas_color_r = (Uint8) r;
|
canvas_color_r = (Uint8) r;
|
||||||
canvas_color_g = (Uint8) g;
|
canvas_color_g = (Uint8) g;
|
||||||
|
|
@ -11015,12 +11010,13 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
||||||
color_tag = fgetc(fi);
|
color_tag = fgetc(fi);
|
||||||
}
|
}
|
||||||
while ((color_tag == '\n' || color_tag == '\r') && !feof(fi));
|
while ((color_tag == '\n' || color_tag == '\r') && !feof(fi));
|
||||||
{
|
|
||||||
if (!feof(fi) && color_tag == 'T')
|
if (!feof(fi) && color_tag == 'T')
|
||||||
{
|
{
|
||||||
fgets(template_id, sizeof(template_id), fi);
|
tmp = fgets(template_id, sizeof(template_id), fi);
|
||||||
template_id[strlen(template_id) - 1] = '\0';
|
template_id[strlen(template_id) - 1] = '\0';
|
||||||
fscanf(fi, "%d", &template_personal);
|
tmp = fscanf(fi, "%d", &template_personal);
|
||||||
|
/* FIXME: Debug only? */
|
||||||
printf("template = %s\n (Personal=%d)", template_id, template_personal);
|
printf("template = %s\n (Personal=%d)", template_id, template_personal);
|
||||||
}
|
}
|
||||||
if (!feof(fi) && color_tag == 'M')
|
if (!feof(fi) && color_tag == 'M')
|
||||||
|
|
@ -11028,7 +11024,6 @@ static void load_starter_id(char *saved_id, FILE * fil)
|
||||||
starter_modified = fgetc(fi);
|
starter_modified = fgetc(fi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -12284,37 +12279,6 @@ static void free_surface_array(SDL_Surface * surface_array[], int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Update screen where shape is/was: */
|
|
||||||
|
|
||||||
/* FIXME: unused */
|
|
||||||
/*
|
|
||||||
static void update_shape(int cx, int ox1, int ox2, int cy, int oy1, int oy2, int fix)
|
|
||||||
{
|
|
||||||
int rx, ry;
|
|
||||||
|
|
||||||
rx = abs(ox1 - cx);
|
|
||||||
if (abs(ox2 - cx) > rx)
|
|
||||||
rx = abs(ox2 - cx);
|
|
||||||
|
|
||||||
ry = abs(oy1 - cy);
|
|
||||||
if (abs(oy2 - cy) > ry)
|
|
||||||
ry = abs(oy2 - cy);
|
|
||||||
|
|
||||||
if (fix)
|
|
||||||
{
|
|
||||||
if (ry > rx)
|
|
||||||
rx = ry;
|
|
||||||
else
|
|
||||||
ry = rx;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_UpdateRect(screen, max((cx - rx), 0) + 96, max(cy - ry, 0),
|
|
||||||
min((cx + rx) + 96, screen->w),
|
|
||||||
min(cy + ry, screen->h));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Draw a shape! */
|
/* Draw a shape! */
|
||||||
|
|
||||||
static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush)
|
static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush)
|
||||||
|
|
@ -21275,6 +21239,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
|
||||||
{
|
{
|
||||||
FILE *fi, *fp;
|
FILE *fi, *fp;
|
||||||
char *control;
|
char *control;
|
||||||
|
char *CHAR_PTR_TMP;
|
||||||
Bytef *unc_buff;
|
Bytef *unc_buff;
|
||||||
|
|
||||||
int unc_size;
|
int unc_size;
|
||||||
|
|
@ -21345,9 +21310,12 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
|
||||||
have_label_delta = have_label_data = have_background = have_foreground = FALSE;
|
have_label_delta = have_label_data = have_background = have_foreground = FALSE;
|
||||||
ldelta = ldata = fgnd = bgnd = FALSE;
|
ldelta = ldata = fgnd = bgnd = FALSE;
|
||||||
|
|
||||||
/* Need to get things in order, as we can't enforce any order in custom chunks, we need to go around them 3 times */
|
/* Need to get things in order, as we can't enforce any order in custom chunks,
|
||||||
|
we need to go around them 3 times */
|
||||||
|
|
||||||
/* First we search for the things that usually were in the .dat file, so if a starter or a template is found and if it is not modified, we can load it clean (i.e. not rebluring a blured when scaled one)*/
|
/* First we search for the things that usually were in the .dat file, so if a starter or a
|
||||||
|
template is found and if it is not modified, we can load it clean (i.e. not rebluring a
|
||||||
|
blured when scaled one)*/
|
||||||
for (u = 0; u < num_unknowns; u++)
|
for (u = 0; u < num_unknowns; u++)
|
||||||
{
|
{
|
||||||
printf("%s, %d\n", unknowns[u].name, unknowns[u].size);
|
printf("%s, %d\n", unknowns[u].name, unknowns[u].size);
|
||||||
|
|
@ -21369,13 +21337,14 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
|
||||||
|
|
||||||
/* Put fi position at the right place after the chunk headers */
|
/* Put fi position at the right place after the chunk headers */
|
||||||
control = malloc(50);
|
control = malloc(50);
|
||||||
fgets(control, 49, fi);
|
CHAR_PTR_TMP = fgets(control, 49, fi);
|
||||||
fgets(control, 49, fi);
|
CHAR_PTR_TMP = fgets(control, 49, fi);
|
||||||
fgets(control, 49, fi);
|
CHAR_PTR_TMP = fgets(control, 49, fi);
|
||||||
fgets(control, 49, fi);
|
CHAR_PTR_TMP = fgets(control, 49, fi);
|
||||||
free(control);
|
free(control);
|
||||||
|
|
||||||
load_starter_id(NULL, fi); // fi will be closed in load_starter_id()
|
/* fi will be closed in load_starter_id() */
|
||||||
|
load_starter_id(NULL, fi);
|
||||||
if (!starter_modified)
|
if (!starter_modified)
|
||||||
{
|
{
|
||||||
/* Code adapted from load_current() */
|
/* Code adapted from load_current() */
|
||||||
|
|
@ -21615,7 +21584,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/* ================================================================================== */
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
|
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__)
|
||||||
static void show_available_papersizes(int exitcode)
|
static void show_available_papersizes(int exitcode)
|
||||||
|
|
@ -21650,7 +21619,7 @@ static void show_available_papersizes(int exitcode)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/* ================================================================================== */
|
||||||
|
|
||||||
static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *filename)
|
static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *filename)
|
||||||
{
|
{
|
||||||
|
|
@ -21679,10 +21648,10 @@ static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *file
|
||||||
wordfree(&result);
|
wordfree(&result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: leaking mem here, but the trouble is that these
|
/* FIXME: leaking mem here, but the trouble is that these
|
||||||
// strings get mixed in with ones from .data and .rodata
|
strings get mixed in with ones from .data and .rodata
|
||||||
// and free() isn't smart about the situation -- also some
|
and free() isn't smart about the situation -- also some
|
||||||
// of the strings end up being kept around
|
of the strings end up being kept around */
|
||||||
parse_one_option(tmpcfg, str, strdup(arg), filename);
|
parse_one_option(tmpcfg, str, strdup(arg), filename);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
@ -21690,7 +21659,7 @@ static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *file
|
||||||
}
|
}
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
||||||
// These interact in horrid ways.
|
/* These interact in horrid ways. */
|
||||||
if (tmpcfg->parsertmp_lang && tmpcfg->parsertmp_locale)
|
if (tmpcfg->parsertmp_lang && tmpcfg->parsertmp_locale)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Warning: option 'lang=%s' overrides option 'locale=%s' in '%s'\n",
|
"Warning: option 'lang=%s' overrides option 'locale=%s' in '%s'\n",
|
||||||
|
|
@ -21761,7 +21730,7 @@ static void parse_argv_options(struct cfginfo *restrict tmpcfg, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// These interact in horrid ways.
|
/* These interact in horrid ways. */
|
||||||
if (tmpcfg->parsertmp_lang && tmpcfg->parsertmp_locale)
|
if (tmpcfg->parsertmp_lang && tmpcfg->parsertmp_locale)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
@ -21775,7 +21744,7 @@ static void parse_argv_options(struct cfginfo *restrict tmpcfg, char *argv[])
|
||||||
tmpcfg->parsertmp_lang = PARSE_CLOBBER;
|
tmpcfg->parsertmp_lang = PARSE_CLOBBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge two configs, with the winner taking priority
|
/* merge two configs, with the winner taking priority */
|
||||||
static void tmpcfg_merge(struct cfginfo *loser, const struct cfginfo *winner)
|
static void tmpcfg_merge(struct cfginfo *loser, const struct cfginfo *winner)
|
||||||
{
|
{
|
||||||
int i = CFGINFO_MAXOFFSET / sizeof(char *);
|
int i = CFGINFO_MAXOFFSET / sizeof(char *);
|
||||||
|
|
@ -21809,7 +21778,9 @@ static void setup_config(char *argv[])
|
||||||
|
|
||||||
parse_argv_options(&tmpcfg_cmd, argv);
|
parse_argv_options(&tmpcfg_cmd, argv);
|
||||||
|
|
||||||
#if defined(__APPLE__) //EP added this conditional section for Mac to allow for a config in the current directory, that supersedes sys and user configs
|
#if defined(__APPLE__)
|
||||||
|
/* EP added this conditional section for Mac to allow for a config in
|
||||||
|
the current directory, that supersedes sys and user configs */
|
||||||
/* Mac OS X: Use a "tuxpaint.cfg" file in the current folder */
|
/* Mac OS X: Use a "tuxpaint.cfg" file in the current folder */
|
||||||
struct cfginfo tmpcfg_curdir;
|
struct cfginfo tmpcfg_curdir;
|
||||||
|
|
||||||
|
|
@ -21866,14 +21837,15 @@ static void setup_config(char *argv[])
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Linux and other Unixes: Use 'rc' style (~/.tuxpaintrc) */
|
/* Linux and other Unixes: Use 'rc' style (~/.tuxpaintrc) */
|
||||||
// it should it be "~/.tuxpaint/tuxpaintrc" instead, but too late now
|
/* it should it be "~/.tuxpaint/tuxpaintrc" instead, but too late now */
|
||||||
snprintf(str, sizeof(str), "%s/.tuxpaintrc", home);
|
snprintf(str, sizeof(str), "%s/.tuxpaintrc", home);
|
||||||
#endif
|
#endif
|
||||||
parse_file_options(&tmpcfg_usr, str);
|
parse_file_options(&tmpcfg_usr, str);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__APPLE__) //EP added this conditional section for Mac
|
#if defined(__APPLE__)
|
||||||
|
/* EP added this conditional section for Mac */
|
||||||
tmpcfg_merge(&tmpcfg_usr, &tmpcfg_curdir);
|
tmpcfg_merge(&tmpcfg_usr, &tmpcfg_curdir);
|
||||||
#else
|
#else
|
||||||
tmpcfg_merge(&tmpcfg_usr, &tmpcfg_cmd);
|
tmpcfg_merge(&tmpcfg_usr, &tmpcfg_cmd);
|
||||||
|
|
@ -21885,14 +21857,17 @@ static void setup_config(char *argv[])
|
||||||
|
|
||||||
memset(&tmpcfg_sys, '\0', sizeof tmpcfg_sys);
|
memset(&tmpcfg_sys, '\0', sizeof tmpcfg_sys);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// global config file in the application directory
|
/* global config file in the application directory */
|
||||||
parse_file_options(&tmpcfg_sys, "tuxpaint.cfg");
|
parse_file_options(&tmpcfg_sys, "tuxpaint.cfg");
|
||||||
#elif defined(__APPLE__) //EP added this conditional section for Mac to fix folder&extension inconsistency with Tux Paint Config application)
|
#elif defined(__APPLE__)
|
||||||
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint application support folder */
|
/* EP added this conditional section for Mac to fix
|
||||||
|
folder & extension inconsistency with Tux Paint Config application) */
|
||||||
|
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint
|
||||||
|
application support folder */
|
||||||
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macosx.globalPreferencesPath);
|
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macosx.globalPreferencesPath);
|
||||||
parse_file_options(&tmpcfg_sys, str);
|
parse_file_options(&tmpcfg_sys, str);
|
||||||
#else
|
#else
|
||||||
// normally /etc/tuxpaint/tuxpaint.conf
|
/* normally /etc/tuxpaint/tuxpaint.conf */
|
||||||
parse_file_options(&tmpcfg_sys, CONFDIR "tuxpaint.conf");
|
parse_file_options(&tmpcfg_sys, CONFDIR "tuxpaint.conf");
|
||||||
#endif
|
#endif
|
||||||
tmpcfg_merge(&tmpcfg, &tmpcfg_sys);
|
tmpcfg_merge(&tmpcfg, &tmpcfg_sys);
|
||||||
|
|
@ -21914,7 +21889,7 @@ static void setup_config(char *argv[])
|
||||||
button_label_y_nudge = setup_i18n(tmpcfg.parsertmp_lang, tmpcfg.parsertmp_locale);
|
button_label_y_nudge = setup_i18n(tmpcfg.parsertmp_lang, tmpcfg.parsertmp_locale);
|
||||||
|
|
||||||
|
|
||||||
// FIXME: most of this is not required before starting the font scanner
|
/* FIXME: most of this is not required before starting the font scanner */
|
||||||
|
|
||||||
#ifdef PAPER_H
|
#ifdef PAPER_H
|
||||||
if (tmpcfg_cmd.papersize && !strcmp(tmpcfg_cmd.papersize, "help"))
|
if (tmpcfg_cmd.papersize && !strcmp(tmpcfg_cmd.papersize, "help"))
|
||||||
|
|
@ -21980,7 +21955,7 @@ static void setup_config(char *argv[])
|
||||||
}
|
}
|
||||||
if (tmpcfg.parsertmp_fullscreen_native)
|
if (tmpcfg.parsertmp_fullscreen_native)
|
||||||
{
|
{
|
||||||
// should conflict with other fullscreen/native_screensize setting?
|
/* should conflict with other fullscreen/native_screensize setting? */
|
||||||
if (!strcmp(tmpcfg.parsertmp_fullscreen_native, "native"))
|
if (!strcmp(tmpcfg.parsertmp_fullscreen_native, "native"))
|
||||||
native_screensize = 1;
|
native_screensize = 1;
|
||||||
fullscreen = strcmp(tmpcfg.parsertmp_fullscreen_native, "no");
|
fullscreen = strcmp(tmpcfg.parsertmp_fullscreen_native, "no");
|
||||||
|
|
@ -21991,17 +21966,17 @@ static void setup_config(char *argv[])
|
||||||
stamp_size_override = -1;
|
stamp_size_override = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FIXME: needs to be a scaling factor
|
/* FIXME: needs to be a scaling factor */
|
||||||
stamp_size_override = atoi(tmpcfg.stamp_size_override);
|
stamp_size_override = atoi(tmpcfg.stamp_size_override);
|
||||||
if (stamp_size_override > 10)
|
if (stamp_size_override > 10)
|
||||||
stamp_size_override = 10;
|
stamp_size_override = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME: make this dynamic (accelerometer or OLPC XO-1 rotation button)
|
/* FIXME: make this dynamic (accelerometer or OLPC XO-1 rotation button) */
|
||||||
if (tmpcfg.rotate_orientation)
|
if (tmpcfg.rotate_orientation)
|
||||||
rotate_orientation = !strcmp(tmpcfg.rotate_orientation, "portrait"); // alternative is "landscape"
|
rotate_orientation = !strcmp(tmpcfg.rotate_orientation, "portrait"); /* alternative is "landscape" */
|
||||||
if (tmpcfg.colorfile)
|
if (tmpcfg.colorfile)
|
||||||
strcpy(colorfile, tmpcfg.colorfile); // FIXME can overflow
|
strcpy(colorfile, tmpcfg.colorfile); /* FIXME can overflow */
|
||||||
if (tmpcfg.print_delay)
|
if (tmpcfg.print_delay)
|
||||||
{
|
{
|
||||||
print_delay = atoi(tmpcfg.print_delay);
|
print_delay = atoi(tmpcfg.print_delay);
|
||||||
|
|
@ -22015,13 +21990,13 @@ static void setup_config(char *argv[])
|
||||||
#endif
|
#endif
|
||||||
if (tmpcfg.alt_print_command_default)
|
if (tmpcfg.alt_print_command_default)
|
||||||
{
|
{
|
||||||
// FIXME: probably need extra variables
|
/* FIXME: probably need extra variables */
|
||||||
if (!strcmp(tmpcfg.alt_print_command_default, "always"))
|
if (!strcmp(tmpcfg.alt_print_command_default, "always"))
|
||||||
alt_print_command_default = ALTPRINT_ALWAYS;
|
alt_print_command_default = ALTPRINT_ALWAYS;
|
||||||
else if (!strcmp(tmpcfg.alt_print_command_default, "never"))
|
else if (!strcmp(tmpcfg.alt_print_command_default, "never"))
|
||||||
alt_print_command_default = ALTPRINT_NEVER;
|
alt_print_command_default = ALTPRINT_NEVER;
|
||||||
else
|
else
|
||||||
alt_print_command_default = ALTPRINT_MOD; // default ("mod")
|
alt_print_command_default = ALTPRINT_MOD; /* default ("mod") */
|
||||||
}
|
}
|
||||||
#ifdef PAPER_H
|
#ifdef PAPER_H
|
||||||
if (tmpcfg.papersize)
|
if (tmpcfg.papersize)
|
||||||
|
|
@ -22324,14 +22299,15 @@ static void setup_config(char *argv[])
|
||||||
|
|
||||||
static void chdir_to_binary(char *argv0)
|
static void chdir_to_binary(char *argv0)
|
||||||
{
|
{
|
||||||
char curdir[256]; //EP added this block to print out of current directory
|
char curdir[256];
|
||||||
|
/* EP added this block to print out of current directory */
|
||||||
|
|
||||||
getcwd(curdir, sizeof(curdir));
|
getcwd(curdir, sizeof(curdir));
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Binary Path: %s\nCurrent directory at launchtime: %s\n", argv0, curdir);
|
printf("Binary Path: %s\nCurrent directory at launchtime: %s\n", argv0, curdir);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(WIN32) || defined(__APPLE__) //EP added __APPLE__
|
#if defined(__BEOS__) || defined(WIN32) || defined(__APPLE__)
|
||||||
/* if run from gui, like OpenTracker in BeOS or Explorer in Windows,
|
/* if run from gui, like OpenTracker in BeOS or Explorer in Windows,
|
||||||
find path from which binary was run and change dir to it
|
find path from which binary was run and change dir to it
|
||||||
so all files will be local :) */
|
so all files will be local :) */
|
||||||
|
|
@ -22346,14 +22322,16 @@ static void chdir_to_binary(char *argv0)
|
||||||
char *app_path = strdup(argv0);
|
char *app_path = strdup(argv0);
|
||||||
char *slash = strrchr(app_path, '/');
|
char *slash = strrchr(app_path, '/');
|
||||||
|
|
||||||
#if defined(__APPLE__) //EP added to fix 10.9 issue of current directory set by Finder to something else than folder where app bundle resides
|
#if defined(__APPLE__)
|
||||||
// typical path of app's binary on Mac OS : /Applications/Tux Paint.app/Contents/MacOS/Tux Paint
|
/* EP added to fix 10.9 issue of current directory set by Finder
|
||||||
int levels = 3; // we need to back up 3 levels
|
to something else than folder where app bundle resides */
|
||||||
|
/* typical path of app's binary on Mac OS : /Applications/Tux Paint.app/Contents/MacOS/Tux Paint */
|
||||||
|
int levels = 3; /* we need to back up 3 levels */
|
||||||
|
|
||||||
while ((levels-- > 0) && (slash))
|
while ((levels-- > 0) && (slash))
|
||||||
{
|
{
|
||||||
*slash = '\0'; // this overwrites the \0 at end of string
|
*slash = '\0'; /* this overwrites the \0 at end of string */
|
||||||
slash = strrchr(app_path, '/'); // so we can carry on our back-pedaling...
|
slash = strrchr(app_path, '/'); /* so we can carry on our back-pedaling... */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -22375,7 +22353,7 @@ static void chdir_to_binary(char *argv0)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/* ================================================================================== */
|
||||||
|
|
||||||
static void setup_colors(void)
|
static void setup_colors(void)
|
||||||
{
|
{
|
||||||
|
|
@ -22403,8 +22381,8 @@ static void setup_colors(void)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
fgets(str, sizeof(str), fi);
|
if (fgets(str, sizeof(str), fi))
|
||||||
|
{
|
||||||
if (!feof(fi))
|
if (!feof(fi))
|
||||||
{
|
{
|
||||||
if (NUM_COLORS + 1 > max)
|
if (NUM_COLORS + 1 > max)
|
||||||
|
|
@ -22465,6 +22443,7 @@ static void setup_colors(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (!feof(fi));
|
while (!feof(fi));
|
||||||
|
|
||||||
if (NUM_COLORS < 2)
|
if (NUM_COLORS < 2)
|
||||||
|
|
@ -22534,7 +22513,7 @@ static void setup_colors(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
/* ================================================================================== */
|
||||||
|
|
||||||
static void do_lock_file(void)
|
static void do_lock_file(void)
|
||||||
{
|
{
|
||||||
|
|
@ -22634,7 +22613,8 @@ int TP_EventFilter(const SDL_Event * event)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/* ================================================================================== */
|
||||||
|
|
||||||
static void setup(void)
|
static void setup(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -23587,22 +23567,9 @@ static void setup(void)
|
||||||
|
|
||||||
signal(SIGPIPE, signal_handler);
|
signal(SIGPIPE, signal_handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Call this once */
|
|
||||||
//EP now deprecated
|
|
||||||
/*
|
|
||||||
#if !defined(NOSVG) && !defined(OLD_SVG)
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("rsvg_init()\n"); fflush(stdout);
|
|
||||||
#endif
|
|
||||||
rsvg_init();
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================================================== */
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
static void claim_to_be_ready(void)
|
static void claim_to_be_ready(void)
|
||||||
{
|
{
|
||||||
|
|
@ -23704,7 +23671,7 @@ static void claim_to_be_ready(void)
|
||||||
draw_tux_text(tool_tux[cur_tool], tool_tips[cur_tool], 1);
|
draw_tux_text(tool_tux[cur_tool], tool_tips[cur_tool], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
/* ================================================================================== */
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -23717,14 +23684,15 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
CLOCK_ASM(time1);
|
CLOCK_ASM(time1);
|
||||||
|
|
||||||
// do not add code (slowness) here unless required for scanning fonts
|
/* do not add code (slowness) here unless required for scanning fonts */
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(__APPLE__) //EP added block to log messages
|
#if defined(DEBUG) && defined(__APPLE__)
|
||||||
freopen("/tmp/tuxpaint.log", "w", stdout); // redirect stdout to a file
|
/* EP added block to log messages */
|
||||||
dup2(fileno(stdout), fileno(stderr)); // redirect stderr to stdout
|
freopen("/tmp/tuxpaint.log", "w", stdout); /* redirect stdout to a file */
|
||||||
setvbuf(stdout, NULL, _IONBF, 0); // we don't want buffering to avoid de-sync'ing stdout and stderr
|
dup2(fileno(stdout), fileno(stderr)); /* redirect stderr to stdout */
|
||||||
setvbuf(stderr, NULL, _IONBF, 0); // we don't want buffering to avoid de-sync'ing stdout and stderr
|
setvbuf(stdout, NULL, _IONBF, 0); /* we don't want buffering to avoid de-sync'ing stdout and stderr */
|
||||||
|
setvbuf(stderr, NULL, _IONBF, 0); /* we don't want buffering to avoid de-sync'ing stdout and stderr */
|
||||||
char logTime[100];
|
char logTime[100];
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
|
|
||||||
|
|
@ -23737,7 +23705,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
CLOCK_ASM(time2);
|
CLOCK_ASM(time2);
|
||||||
#ifdef FORKED_FONTS
|
#ifdef FORKED_FONTS
|
||||||
// must start ASAP, but depends on locale which in turn needs the config
|
/* must start ASAP, but depends on locale which in turn needs the config */
|
||||||
#ifdef NO_SDLPANGO
|
#ifdef NO_SDLPANGO
|
||||||
/* Only fork it now if we're not planning on creating a thread to handle fontconfig stuff -bjk 2010.04.27 */
|
/* Only fork it now if we're not planning on creating a thread to handle fontconfig stuff -bjk 2010.04.27 */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
@ -23805,7 +23773,7 @@ static int trash(char *path)
|
||||||
char deldate[32];
|
char deldate[32];
|
||||||
struct tm tim;
|
struct tm tim;
|
||||||
time_t now;
|
time_t now;
|
||||||
int cnt;
|
int cnt, tmp;
|
||||||
FILE *fi, *fo;
|
FILE *fi, *fo;
|
||||||
unsigned char buf[1024];
|
unsigned char buf[1024];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
@ -23821,7 +23789,7 @@ static int trash(char *path)
|
||||||
return (unlink(path));
|
return (unlink(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("trash: basename=%s", basename(path)); //EP
|
printf("trash: basename=%s", basename(path)); /* EP */
|
||||||
strcpy(fname, basename(path));
|
strcpy(fname, basename(path));
|
||||||
|
|
||||||
if (!file_exists(path))
|
if (!file_exists(path))
|
||||||
|
|
@ -23945,7 +23913,7 @@ static int trash(char *path)
|
||||||
-bjk 2011.04.18 */
|
-bjk 2011.04.18 */
|
||||||
|
|
||||||
/* FIXME: Is this sufficient to find 'dbus-send' (rely on system to use $PATH?) -bjk 2011.04.18 */
|
/* FIXME: Is this sufficient to find 'dbus-send' (rely on system to use $PATH?) -bjk 2011.04.18 */
|
||||||
system("dbus-send / org.kde.KDirNotify.FilesAdded string:trash:/");
|
tmp = system("dbus-send / org.kde.KDirNotify.FilesAdded string:trash:/");
|
||||||
|
|
||||||
|
|
||||||
/* Note: GNOME figures out when things change because it asks the Kernel
|
/* Note: GNOME figures out when things change because it asks the Kernel
|
||||||
|
|
@ -24008,7 +23976,6 @@ static void handle_joyaxismotion(SDL_Event event, int *motioner, int *val_x, int
|
||||||
else
|
else
|
||||||
*val_y = 0;
|
*val_y = 0;
|
||||||
|
|
||||||
// printf("i %d valx %d j %d val_y %d\n", i, val_x, j, val_y);
|
|
||||||
if (*val_x || *val_y)
|
if (*val_x || *val_y)
|
||||||
{
|
{
|
||||||
*motioner = TRUE;
|
*motioner = TRUE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue