On systems that use postscript_print (Linux and other Unix-likes),
errors when attempting to issue a print command (e.g., trying to use "lpr", but that command is not available) should appear in Tux Paint. (SourceForge bug #2205528)
This commit is contained in:
parent
784c4ae7e5
commit
c349189b2c
4 changed files with 71 additions and 10 deletions
|
|
@ -8,7 +8,7 @@ http://www.tuxpaint.org/
|
|||
|
||||
$Id$
|
||||
|
||||
2008.December.3 (0.9.21)
|
||||
2008.December.7 (0.9.21)
|
||||
* New Starters:
|
||||
-------------
|
||||
* Silver Frame
|
||||
|
|
@ -79,6 +79,11 @@ $Id$
|
|||
NOTE: 'printcommand' and 'altprintcommand' options not currently parsed
|
||||
for env. vars.
|
||||
|
||||
* On systems that use postscript_print (Linux and other Unix-likes),
|
||||
errors when attempting to issue a print command (e.g., trying to use
|
||||
"lpr", but that command is not available) should appear in Tux Paint.
|
||||
(SourceForge bug #2205528)
|
||||
|
||||
* Build System Improvements:
|
||||
--------------------------
|
||||
* Adhering to Debian & FreeDesktop.org standards regarding .desktop file.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
implied warranty.
|
||||
|
||||
|
||||
June 24, 2007 - August 28, 2008
|
||||
June 24, 2007 - December 7, 2008
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
|
@ -50,6 +50,7 @@
|
|||
#include <time.h>
|
||||
#include <paper.h>
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef PAPER_H
|
||||
#error "---------------------------------------------------"
|
||||
|
|
@ -81,7 +82,8 @@ int do_ps_save(FILE * fi,
|
|||
// const char *restrict const fname,
|
||||
const char * fname,
|
||||
SDL_Surface * surf,
|
||||
char * pprsize)
|
||||
char * pprsize,
|
||||
int is_pipe)
|
||||
{
|
||||
const struct paper * ppr;
|
||||
int img_w = surf->w;
|
||||
|
|
@ -300,8 +302,55 @@ int do_ps_save(FILE * fi,
|
|||
fprintf(fi, "%%%%Trailer\n");
|
||||
fprintf(fi, "%%%%EOF\n");
|
||||
|
||||
if (!is_pipe)
|
||||
{
|
||||
fclose(fi);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pid_t child_pid, w;
|
||||
int status;
|
||||
|
||||
child_pid = pclose(fi);
|
||||
|
||||
/* debug */
|
||||
/*
|
||||
printf("pclose returned %d\n", child_pid); fflush(stdout);
|
||||
printf("errno = %d\n", errno); fflush(stdout);
|
||||
*/
|
||||
|
||||
if (child_pid < 0 || (errno != 0 && errno != EAGAIN)) { /* FIXME: This right? */
|
||||
return 0;
|
||||
} else if (child_pid == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
w = waitpid(child_pid, &status, 0);
|
||||
|
||||
/* debug */
|
||||
/*
|
||||
if (w == -1) { perror("waitpid"); exit(EXIT_FAILURE); }
|
||||
if (WIFEXITED(status)) {
|
||||
printf("exited, status=%d\n", WEXITSTATUS(status));
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
printf("killed by signal %d\n", WTERMSIG(status));
|
||||
} else if (WIFSTOPPED(status)) {
|
||||
printf("stopped by signal %d\n", WSTOPSIG(status));
|
||||
} else if (WIFCONTINUED(status)) {
|
||||
printf("continued\n");
|
||||
}
|
||||
*/
|
||||
}
|
||||
while (w != -1 && !WIFEXITED(status) && !WIFSIGNALED(status));
|
||||
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) != 0) /* Not happy exit */
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
(for non-Windows, non-Mac OS X, non-BeOS platforms, e.g. Linux)
|
||||
(moved from tuxpaint.c in 0.9.17)
|
||||
|
||||
Copyright (c) 2007 by Bill Kendrick and others
|
||||
Copyright (c) 2008 by Bill Kendrick and others
|
||||
bill@newbreedsoftware.com
|
||||
http://www.tuxpaint.org/
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 24, 2007 - June 25, 2007
|
||||
June 24, 2007 - December 7, 2008
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
|
@ -80,7 +80,8 @@ int do_ps_save(FILE * fi,
|
|||
// const char *restrict const fname,
|
||||
const char *fname,
|
||||
SDL_Surface * surf,
|
||||
char * pprsize);
|
||||
char * pprsize,
|
||||
int is_pipe);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - December 1, 2008
|
||||
June 14, 2002 - December 7, 2008
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
|
@ -1891,6 +1891,9 @@ int main(int argc, char *argv[])
|
|||
#define PROMPT_PRINT_TXT gettext_noop("Your picture has been printed!")
|
||||
#define PROMPT_PRINT_YES gettext_noop("OK")
|
||||
|
||||
/* We got an error printing */
|
||||
#define PROMPT_PRINT_FAILED_TXT gettext_noop("Sorry! Your picture could not be printed!")
|
||||
|
||||
/* Notification that it's too soon to print again (--printdelay option is in effect) */
|
||||
#define PROMPT_PRINT_TOO_SOON_TXT gettext_noop("You can’t print yet!")
|
||||
#define PROMPT_PRINT_TOO_SOON_YES gettext_noop("OK")
|
||||
|
|
@ -15420,9 +15423,12 @@ void do_print(void)
|
|||
#elif defined(PRINTMETHOD_PNM_PS)
|
||||
/* nothing here */
|
||||
#elif defined(PRINTMETHOD_PS)
|
||||
if (do_ps_save(pi, pcmd, canvas, papersize))
|
||||
if (do_ps_save(pi, pcmd, canvas, papersize, 1))
|
||||
do_prompt_snd(PROMPT_PRINT_TXT, PROMPT_PRINT_YES, "", SND_TUXOK,
|
||||
screen->w / 2, screen->h / 2);
|
||||
else
|
||||
do_prompt_snd(PROMPT_PRINT_FAILED_TXT, PROMPT_PRINT_YES, "", SND_YOUCANNOT,
|
||||
screen->w / 2, screen->h / 2);
|
||||
#else
|
||||
#error No print method defined!
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue