2003-08-29 04:23:09 +08:00
|
|
|
/*
|
1999-12-28 07:14:31 +08:00
|
|
|
* ScreenShot plug-in
|
2000-10-30 02:07:07 +08:00
|
|
|
* Copyright 1998-2000 Sven Neumann <sven@gimp.org>
|
2003-08-29 04:23:09 +08:00
|
|
|
* Copyright 2003 Henrik Brix Andersen <brix@gimp.org>
|
1998-04-20 11:21:31 +08:00
|
|
|
*
|
|
|
|
* Any suggestions, bug-reports or patches are very welcome.
|
2003-08-29 04:23:09 +08:00
|
|
|
*
|
1998-04-20 11:21:31 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-24 10:18:52 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1998-04-20 11:21:31 +08:00
|
|
|
*/
|
|
|
|
|
2000-01-08 23:23:28 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
2003-09-01 01:23:01 +08:00
|
|
|
#if defined(GDK_WINDOWING_X11)
|
2003-08-29 04:23:09 +08:00
|
|
|
#include <gdk/gdkx.h>
|
2003-09-01 01:23:01 +08:00
|
|
|
#elif defined(GDK_WINDOWING_WIN32)
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
2003-08-29 04:23:09 +08:00
|
|
|
|
1999-11-23 06:38:02 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-05-02 04:22:55 +08:00
|
|
|
|
1998-04-20 11:21:31 +08:00
|
|
|
/* Defines */
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
#define PLUG_IN_NAME "plug_in_screenshot"
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#ifdef GDK_NATIVE_WINDOW_POINTER
|
2003-08-29 07:38:32 +08:00
|
|
|
#if GLIB_SIZEOF_VOID_P != 4
|
2003-08-29 04:23:09 +08:00
|
|
|
#warning window_id does not fit in PDB_INT32
|
|
|
|
#endif
|
|
|
|
#endif
|
1998-04-20 11:21:31 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-02 04:22:55 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2003-08-29 04:23:09 +08:00
|
|
|
gboolean root;
|
|
|
|
guint window_id;
|
|
|
|
guint delay;
|
1998-04-20 11:21:31 +08:00
|
|
|
} ScreenShotValues;
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
static ScreenShotValues shootvals =
|
|
|
|
{
|
1998-06-05 00:17:59 +08:00
|
|
|
FALSE, /* root window */
|
2003-08-29 04:23:09 +08:00
|
|
|
0, /* window ID */
|
|
|
|
0, /* delay */
|
1998-04-20 11:21:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
static void query (void);
|
2003-07-02 21:00:16 +08:00
|
|
|
static void run (const gchar *name,
|
|
|
|
gint nparams,
|
2003-08-29 04:23:09 +08:00
|
|
|
const GimpParam *param,
|
2003-07-02 21:00:16 +08:00
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals);
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
static GdkNativeWindow select_window (const GdkScreen *screen);
|
|
|
|
static gint32 create_image (const GdkPixbuf *pixbuf);
|
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
static void shoot (void);
|
|
|
|
static gboolean shoot_dialog (void);
|
2003-08-29 04:23:09 +08:00
|
|
|
static void shoot_ok_callback (GtkWidget *widget,
|
2000-10-30 02:07:07 +08:00
|
|
|
gpointer data);
|
|
|
|
static void shoot_delay (gint32 delay);
|
2003-01-31 11:08:29 +08:00
|
|
|
static gboolean shoot_delay_callback (gpointer data);
|
2000-05-02 04:22:55 +08:00
|
|
|
|
1998-04-20 11:21:31 +08:00
|
|
|
|
|
|
|
/* Global Variables */
|
2000-08-22 09:26:57 +08:00
|
|
|
GimpPlugInInfo PLUG_IN_INFO =
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2000-05-02 04:22:55 +08:00
|
|
|
NULL, /* init_proc */
|
|
|
|
NULL, /* quit_proc */
|
|
|
|
query, /* query_proc */
|
|
|
|
run /* run_proc */
|
1998-04-20 11:21:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* the image that will be returned */
|
2003-08-29 04:23:09 +08:00
|
|
|
gint32 image_ID = -1;
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
gboolean run_flag = FALSE;
|
2000-10-30 02:07:07 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
/* the screen on which we are running */
|
|
|
|
GdkScreen *cur_screen = NULL;
|
|
|
|
|
|
|
|
/* the window the user selected */
|
|
|
|
GdkNativeWindow selected_native;
|
2000-10-30 02:07:07 +08:00
|
|
|
|
1998-04-20 11:21:31 +08:00
|
|
|
/* Functions */
|
|
|
|
|
|
|
|
MAIN ()
|
|
|
|
|
2000-05-02 04:22:55 +08:00
|
|
|
static void
|
|
|
|
query (void)
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
static GimpParamDef args[] =
|
2000-05-02 04:22:55 +08:00
|
|
|
{
|
2003-08-29 04:23:09 +08:00
|
|
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
|
|
|
{ GIMP_PDB_INT32, "root", "Root window { TRUE, FALSE }" },
|
|
|
|
{ GIMP_PDB_INT32, "window_id", "Window id" }
|
2000-05-02 04:22:55 +08:00
|
|
|
};
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
static GimpParamDef return_vals[] =
|
2000-05-02 04:22:55 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
{ GIMP_PDB_IMAGE, "image", "Output image" }
|
2000-05-02 04:22:55 +08:00
|
|
|
};
|
1998-04-20 11:21:31 +08:00
|
|
|
|
|
|
|
gimp_install_procedure (PLUG_IN_NAME,
|
2000-03-08 21:53:54 +08:00
|
|
|
"Creates a screenshot of a single window or the whole screen",
|
2003-08-29 04:23:09 +08:00
|
|
|
"After specifying some options the user selects a window and "
|
|
|
|
"a time out is started. At the end of the time out the window "
|
|
|
|
"is grabbed and the image is loaded into The GIMP. Alternatively "
|
|
|
|
"the whole screen can be grabbed. When called non-interactively "
|
|
|
|
"it may grab the root window or use the window-id passed as a parameter.",
|
|
|
|
"Sven Neumann <sven@gimp.org>, Henrik Brix Andersen <brix@gimp.org>",
|
|
|
|
"1998 - 2003",
|
|
|
|
"v0.9.6 (2003/08/28)",
|
2003-07-17 23:47:18 +08:00
|
|
|
N_("<Toolbox>/File/Acquire/_Screen Shot..."),
|
1998-04-20 11:21:31 +08:00
|
|
|
NULL,
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
GIMP_PLUGIN,
|
2001-12-06 10:28:58 +08:00
|
|
|
G_N_ELEMENTS (args),
|
|
|
|
G_N_ELEMENTS (return_vals),
|
2000-05-02 04:22:55 +08:00
|
|
|
args, return_vals);
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
static void
|
2003-07-02 21:00:16 +08:00
|
|
|
run (const gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
const GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
|
|
|
/* Get the runmode from the in-parameters */
|
2003-08-29 04:23:09 +08:00
|
|
|
GimpRunMode run_mode = param[0].data.d_int32;
|
2000-05-02 04:22:55 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
/* status variable, use it to check for errors in invocation usually only
|
2000-05-02 04:22:55 +08:00
|
|
|
* during non-interactive calling
|
|
|
|
*/
|
2003-08-29 04:23:09 +08:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
2000-05-02 04:22:55 +08:00
|
|
|
|
|
|
|
/* always return at least the status to the caller. */
|
2001-03-15 17:59:48 +08:00
|
|
|
static GimpParam values[2];
|
2000-05-02 04:22:55 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
/* initialize the return of the status */
|
2000-10-30 02:07:07 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-04-20 11:21:31 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
*nreturn_vals = 1;
|
2000-10-30 02:07:07 +08:00
|
|
|
*return_vals = values;
|
2000-05-02 04:22:55 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
INIT_I18N ();
|
|
|
|
|
2000-05-02 04:22:55 +08:00
|
|
|
/* how are we running today? */
|
1998-04-20 11:21:31 +08:00
|
|
|
switch (run_mode)
|
2000-05-02 04:22:55 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_INTERACTIVE:
|
1998-04-20 11:21:31 +08:00
|
|
|
/* Possibly retrieve data from a previous run */
|
|
|
|
gimp_get_data (PLUG_IN_NAME, &shootvals);
|
2003-08-29 04:23:09 +08:00
|
|
|
shootvals.window_id = 0;
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-01-09 23:51:46 +08:00
|
|
|
/* Get information from the dialog */
|
|
|
|
if (!shoot_dialog ())
|
2000-10-30 02:07:07 +08:00
|
|
|
status = GIMP_PDB_EXECUTION_ERROR;
|
1998-04-20 11:21:31 +08:00
|
|
|
break;
|
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_NONINTERACTIVE:
|
2003-08-29 04:23:09 +08:00
|
|
|
if (nparams == 3)
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2000-10-30 02:07:07 +08:00
|
|
|
shootvals.root = param[1].data.d_int32;
|
2003-08-29 04:23:09 +08:00
|
|
|
shootvals.window_id = param[2].data.d_int32;
|
1998-06-05 00:17:59 +08:00
|
|
|
shootvals.delay = 0;
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
|
|
|
else
|
2000-08-22 09:26:57 +08:00
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
if (!gdk_init_check (0, NULL))
|
|
|
|
status = GIMP_PDB_CALLING_ERROR;
|
1998-04-20 11:21:31 +08:00
|
|
|
break;
|
2000-05-02 04:22:55 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_WITH_LAST_VALS:
|
1998-04-20 11:21:31 +08:00
|
|
|
/* Possibly retrieve data from a previous run */
|
|
|
|
gimp_get_data (PLUG_IN_NAME, &shootvals);
|
|
|
|
break;
|
2000-05-02 04:22:55 +08:00
|
|
|
|
1998-04-20 11:21:31 +08:00
|
|
|
default:
|
|
|
|
break;
|
2000-05-02 04:22:55 +08:00
|
|
|
}
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
2000-05-02 04:22:55 +08:00
|
|
|
{
|
|
|
|
if (shootvals.delay > 0)
|
|
|
|
shoot_delay (shootvals.delay);
|
|
|
|
/* Run the main function */
|
|
|
|
shoot ();
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
status = (image_ID != -1) ? GIMP_PDB_SUCCESS : GIMP_PDB_EXECUTION_ERROR;
|
|
|
|
}
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-08-22 09:26:57 +08:00
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
2000-05-02 04:22:55 +08:00
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
2000-05-02 04:22:55 +08:00
|
|
|
{
|
|
|
|
/* Store variable states for next run */
|
|
|
|
gimp_set_data (PLUG_IN_NAME, &shootvals, sizeof (ScreenShotValues));
|
|
|
|
/* display the image */
|
2000-08-01 08:38:38 +08:00
|
|
|
gimp_display_new (image_ID);
|
2000-05-02 04:22:55 +08:00
|
|
|
}
|
|
|
|
/* set return values */
|
|
|
|
*nreturn_vals = 2;
|
2000-08-22 09:26:57 +08:00
|
|
|
values[1].type = GIMP_PDB_IMAGE;
|
2000-05-02 04:22:55 +08:00
|
|
|
values[1].data.d_image = image_ID;
|
|
|
|
}
|
2000-10-30 02:07:07 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
values[0].data.d_status = status;
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
/* Allow the user to select a window with the mouse */
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
static GdkNativeWindow
|
|
|
|
select_window (const GdkScreen *screen)
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2003-08-29 07:38:32 +08:00
|
|
|
#if defined(GDK_WINDOWING_X11)
|
|
|
|
/* X11 specific code */
|
2003-08-29 04:23:09 +08:00
|
|
|
|
2003-08-29 07:38:32 +08:00
|
|
|
#define MASK (ButtonPressMask | ButtonReleaseMask)
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
Display *x_dpy;
|
|
|
|
Cursor x_cursor;
|
|
|
|
XEvent x_event;
|
|
|
|
Window x_win;
|
|
|
|
Window x_root;
|
|
|
|
gint x_scr;
|
|
|
|
gint status;
|
|
|
|
gint buttons;
|
|
|
|
|
|
|
|
x_dpy = GDK_SCREEN_XDISPLAY (GDK_SCREEN (screen));
|
|
|
|
x_scr = GDK_SCREEN_XNUMBER (GDK_SCREEN (screen));
|
|
|
|
|
|
|
|
x_win = None;
|
|
|
|
x_root = RootWindow (x_dpy, x_scr);
|
2003-09-01 01:23:01 +08:00
|
|
|
x_cursor = XCreateFontCursor (x_dpy, GDK_CROSSHAIR);
|
2003-08-29 04:23:09 +08:00
|
|
|
buttons = 0;
|
|
|
|
|
|
|
|
status = XGrabPointer (x_dpy, x_root, False,
|
2003-08-29 07:38:32 +08:00
|
|
|
MASK, GrabModeSync, GrabModeAsync,
|
2003-08-29 04:23:09 +08:00
|
|
|
x_root, x_cursor, CurrentTime);
|
|
|
|
|
|
|
|
if (status != GrabSuccess)
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2003-09-03 20:44:10 +08:00
|
|
|
g_message (_("Error grabbing the pointer"));
|
2003-08-29 04:23:09 +08:00
|
|
|
return 0;
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
while ((x_win == None) || (buttons != 0))
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2003-08-29 04:23:09 +08:00
|
|
|
XAllowEvents (x_dpy, SyncPointer, CurrentTime);
|
2003-08-29 07:38:32 +08:00
|
|
|
XWindowEvent (x_dpy, x_root, MASK, &x_event);
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
switch (x_event.type)
|
|
|
|
{
|
|
|
|
case ButtonPress:
|
|
|
|
if (x_win == None)
|
|
|
|
{
|
|
|
|
x_win = x_event.xbutton.subwindow;
|
|
|
|
if (x_win == None)
|
|
|
|
x_win = x_root;
|
|
|
|
}
|
|
|
|
buttons++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ButtonRelease:
|
|
|
|
if (buttons > 0)
|
|
|
|
buttons--;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
XUngrabPointer (x_dpy, CurrentTime);
|
2003-08-29 07:38:32 +08:00
|
|
|
XFreeCursor (x_dpy, x_cursor);
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
return x_win;
|
2003-08-29 07:38:32 +08:00
|
|
|
#elif defined(GDK_WINDOWING_WIN32)
|
|
|
|
/* MS Windows specific code goes here (yet to be written) */
|
|
|
|
|
|
|
|
/* basically the code should grab the pointer using a crosshair
|
|
|
|
cursor, allow the user to click on a window and return the
|
|
|
|
obtained HWND (as a GdkNativeWindow) - for more details consult
|
|
|
|
the X11 specific code below */
|
|
|
|
|
|
|
|
/* note to self: take a look at the winsnap plug-in for example
|
|
|
|
code */
|
|
|
|
|
|
|
|
#warning Win32 screenshot window chooser not implemented yet
|
|
|
|
return 0;
|
2003-09-03 20:48:51 +08:00
|
|
|
#else /* GDK_WINDOWING_WIN32 */
|
|
|
|
#warning screenshot window chooser not implemented yet for this GDK backend
|
2003-08-29 07:38:32 +08:00
|
|
|
return 0;
|
2003-09-03 20:48:51 +08:00
|
|
|
#endif
|
2003-08-29 04:23:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a GimpImage from a GdkPixbuf */
|
|
|
|
|
|
|
|
static gint32
|
|
|
|
create_image (const GdkPixbuf *pixbuf)
|
|
|
|
{
|
|
|
|
GimpPixelRgn pr;
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpParasite *parasite;
|
|
|
|
gint32 image;
|
|
|
|
gint32 layer;
|
|
|
|
gdouble xres, yres;
|
|
|
|
gchar *comment;
|
|
|
|
gint width, height;
|
|
|
|
gint rowstride;
|
|
|
|
gboolean status;
|
|
|
|
gchar *buf;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
width = gdk_pixbuf_get_width (GDK_PIXBUF (pixbuf));
|
|
|
|
height = gdk_pixbuf_get_height (GDK_PIXBUF (pixbuf));
|
|
|
|
|
|
|
|
image = gimp_image_new (width, height, GIMP_RGB);
|
|
|
|
layer = gimp_layer_new (image, _("Background"),
|
|
|
|
width, height,
|
|
|
|
GIMP_RGB_IMAGE, 100, GIMP_NORMAL_MODE);
|
|
|
|
|
|
|
|
gimp_image_add_layer (image, layer, 0);
|
|
|
|
|
|
|
|
drawable = gimp_drawable_get (layer);
|
|
|
|
|
2003-09-07 21:47:41 +08:00
|
|
|
gimp_tile_cache_ntiles ((width / gimp_tile_width ()) + 1);
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
gimp_pixel_rgn_init (&pr, drawable,
|
|
|
|
0, 0, width, height,
|
|
|
|
TRUE, FALSE);
|
|
|
|
|
|
|
|
/* copy the contents of the GdkPixbuf to the GimpDrawable */
|
|
|
|
rowstride = gdk_pixbuf_get_rowstride (GDK_PIXBUF (pixbuf));
|
|
|
|
buf = gdk_pixbuf_get_pixels (GDK_PIXBUF (pixbuf));
|
|
|
|
status = gimp_progress_init (_("Loading Screen Shot..."));
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++)
|
1998-04-20 11:21:31 +08:00
|
|
|
{
|
2003-08-29 04:23:09 +08:00
|
|
|
gimp_pixel_rgn_set_row (&pr, buf, 0, i, width);
|
|
|
|
buf += rowstride;
|
|
|
|
/* update progress every 10 percent */
|
|
|
|
if (status && ((i + 1) * 100 / height) % 10 == 0)
|
|
|
|
status = gimp_progress_update ((i + 1.0) / height);
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
gimp_progress_update (1.0);
|
|
|
|
|
|
|
|
/* figure out the monitor resolution and set the image to it */
|
|
|
|
gimp_get_monitor_resolution (&xres, &yres);
|
|
|
|
gimp_image_set_resolution (image, xres, yres);
|
|
|
|
|
|
|
|
/* Set the default comment parasite */
|
|
|
|
comment = gimp_get_default_comment ();
|
|
|
|
|
|
|
|
if (comment)
|
1999-05-02 00:11:35 +08:00
|
|
|
{
|
2003-08-29 04:23:09 +08:00
|
|
|
parasite = gimp_parasite_new ("gimp-comment",
|
|
|
|
GIMP_PARASITE_PERSISTENT,
|
|
|
|
g_utf8_strlen (comment, -1) + 1,
|
|
|
|
comment);
|
|
|
|
|
|
|
|
gimp_image_parasite_attach (image_ID, parasite);
|
|
|
|
gimp_parasite_free (parasite);
|
|
|
|
g_free (comment);
|
1999-05-02 00:11:35 +08:00
|
|
|
}
|
2000-11-09 05:58:22 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The main ScreenShot function */
|
|
|
|
|
|
|
|
static void
|
|
|
|
shoot (void)
|
|
|
|
{
|
|
|
|
GdkWindow *window;
|
|
|
|
GdkPixbuf *screenshot;
|
|
|
|
GdkRectangle clip;
|
|
|
|
GdkPoint origin;
|
|
|
|
gint screen_w, screen_h;
|
|
|
|
|
|
|
|
/* use default screen if we are running non-interactively */
|
|
|
|
if (cur_screen == NULL)
|
|
|
|
cur_screen = gdk_screen_get_default ();
|
|
|
|
|
|
|
|
screen_w = gdk_screen_get_width (GDK_SCREEN (cur_screen));
|
|
|
|
screen_h = gdk_screen_get_height (GDK_SCREEN (cur_screen));
|
|
|
|
clip.x = 0;
|
|
|
|
clip.y = 0;
|
|
|
|
|
|
|
|
if (shootvals.root)
|
|
|
|
{
|
|
|
|
/* entire screen */
|
|
|
|
window = gdk_screen_get_root_window (GDK_SCREEN (cur_screen));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* single window */
|
|
|
|
if (shootvals.window_id)
|
|
|
|
{
|
|
|
|
window = gdk_window_foreign_new (shootvals.window_id);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window = gdk_window_foreign_new (selected_native);
|
|
|
|
}
|
1998-04-20 11:21:31 +08:00
|
|
|
}
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
if (!window)
|
1999-08-13 00:54:53 +08:00
|
|
|
{
|
2003-09-03 20:44:10 +08:00
|
|
|
g_message (_("Specified window not found"));
|
2003-08-29 04:23:09 +08:00
|
|
|
return;
|
1999-08-13 00:54:53 +08:00
|
|
|
}
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
gdk_drawable_get_size (GDK_WINDOW (window), &clip.width, &clip.height);
|
|
|
|
gdk_window_get_origin (GDK_WINDOW (window), &origin.x, &origin.y);
|
1999-08-13 00:54:53 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
/* do clipping */
|
|
|
|
if (origin.x < 0)
|
1999-12-15 03:38:39 +08:00
|
|
|
{
|
2003-08-29 04:23:09 +08:00
|
|
|
clip.x = -origin.x;
|
|
|
|
clip.width += origin.x;
|
|
|
|
}
|
|
|
|
if (origin.y < 0)
|
|
|
|
{
|
|
|
|
clip.y = -origin.y;
|
|
|
|
clip.height += origin.y;
|
|
|
|
}
|
|
|
|
if (origin.x + clip.width > screen_w)
|
|
|
|
clip.width -= origin.x + clip.width - screen_w;
|
|
|
|
if (origin.y + clip.height > screen_h)
|
|
|
|
clip.height -= origin.y + clip.height - screen_h;
|
2003-05-15 02:57:39 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
screenshot = gdk_pixbuf_get_from_drawable (NULL, GDK_WINDOW (window),
|
|
|
|
NULL, clip.x, clip.y, 0, 0,
|
|
|
|
clip.width, clip.height);
|
|
|
|
|
|
|
|
gdk_display_beep (gdk_screen_get_display (GDK_SCREEN (cur_screen)));
|
|
|
|
gdk_flush ();
|
|
|
|
|
|
|
|
if (!screenshot)
|
|
|
|
{
|
2003-09-03 20:44:10 +08:00
|
|
|
g_message (_("Error obtaining screenshot"));
|
2003-08-29 04:23:09 +08:00
|
|
|
return;
|
1999-12-15 03:38:39 +08:00
|
|
|
}
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
image_ID = create_image (GDK_PIXBUF (screenshot));
|
|
|
|
}
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
/* ScreenShot dialog */
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
static void
|
2003-08-29 04:23:09 +08:00
|
|
|
shoot_ok_callback (GtkWidget *widget,
|
2000-10-30 02:07:07 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
run_flag = TRUE;
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
/* get the screen on which we are running */
|
|
|
|
cur_screen = gtk_widget_get_screen (GTK_WIDGET (widget));
|
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (data));
|
2003-08-29 04:23:09 +08:00
|
|
|
|
|
|
|
if (!shootvals.root && !shootvals.window_id)
|
|
|
|
selected_native = select_window (GDK_SCREEN (cur_screen));
|
2000-10-30 02:07:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
1998-04-20 11:21:31 +08:00
|
|
|
shoot_dialog (void)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
2000-01-08 23:23:28 +08:00
|
|
|
GtkWidget *main_vbox;
|
1998-04-20 11:21:31 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
1998-06-05 00:17:59 +08:00
|
|
|
GtkWidget *label;
|
2000-10-30 02:07:07 +08:00
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *spinner;
|
1998-04-20 11:21:31 +08:00
|
|
|
GSList *radio_group = NULL;
|
2000-10-30 02:07:07 +08:00
|
|
|
GtkObject *adj;
|
2000-01-08 23:23:28 +08:00
|
|
|
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-05-02 04:22:55 +08:00
|
|
|
gimp_ui_init ("screenshot", FALSE);
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
/* main dialog */
|
2000-01-08 23:23:28 +08:00
|
|
|
dialog = gimp_dialog_new (_("Screen Shot"), "screenshot",
|
2000-05-23 01:10:28 +08:00
|
|
|
gimp_standard_help_func, "filters/screenshot.html",
|
2000-01-08 23:23:28 +08:00
|
|
|
GTK_WIN_POS_MOUSE,
|
|
|
|
FALSE, TRUE, FALSE,
|
|
|
|
|
2001-08-04 03:52:08 +08:00
|
|
|
GTK_STOCK_CANCEL, gtk_widget_destroy,
|
2000-01-08 23:23:28 +08:00
|
|
|
NULL, 1, NULL, FALSE, TRUE,
|
2003-09-03 20:44:10 +08:00
|
|
|
|
2001-11-29 21:23:44 +08:00
|
|
|
GTK_STOCK_OK, shoot_ok_callback,
|
|
|
|
NULL, NULL, NULL, TRUE, FALSE,
|
2000-01-08 23:23:28 +08:00
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (dialog, "destroy",
|
2001-07-29 17:43:09 +08:00
|
|
|
G_CALLBACK (gtk_main_quit),
|
|
|
|
NULL);
|
2000-01-08 23:23:28 +08:00
|
|
|
|
|
|
|
main_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_vbox,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (main_vbox);
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
/* single window */
|
|
|
|
frame = gtk_frame_new (_("Grab"));
|
1998-04-20 11:21:31 +08:00
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
2000-01-08 23:23:28 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
1998-04-20 11:21:31 +08:00
|
|
|
|
1999-06-05 08:29:05 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
2000-01-08 23:23:28 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
1998-04-20 11:21:31 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
button = gtk_radio_button_new_with_mnemonic (radio_group,
|
2003-09-03 20:44:10 +08:00
|
|
|
_("a _Single Window"));
|
2003-08-29 04:23:09 +08:00
|
|
|
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
2001-12-31 08:21:10 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), ! shootvals.root);
|
2000-10-30 02:07:07 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
2001-12-31 08:21:10 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
|
|
|
GINT_TO_POINTER (FALSE));
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "toggled",
|
2001-07-29 17:43:09 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
|
|
|
&shootvals.root);
|
2000-10-30 02:07:07 +08:00
|
|
|
|
|
|
|
/* root window */
|
2003-01-19 22:40:56 +08:00
|
|
|
button = gtk_radio_button_new_with_mnemonic (radio_group,
|
2003-09-03 20:44:10 +08:00
|
|
|
_("the _Whole Screen"));
|
2003-08-29 04:23:09 +08:00
|
|
|
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
2001-12-31 08:21:10 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), shootvals.root);
|
2000-10-30 02:07:07 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
2001-12-31 08:21:10 +08:00
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
|
|
|
GINT_TO_POINTER (TRUE));
|
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (button, "toggled",
|
2001-07-29 17:43:09 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
|
|
|
&shootvals.root);
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2002-01-30 00:52:53 +08:00
|
|
|
gtk_widget_show (button);
|
1999-05-13 09:14:29 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
/* with delay */
|
2000-01-08 23:23:28 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
2003-01-19 22:40:56 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (_("_after"));
|
2000-01-08 23:23:28 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
1998-06-05 00:17:59 +08:00
|
|
|
gtk_widget_show (label);
|
2003-08-29 04:23:09 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
adj = gtk_adjustment_new (shootvals.delay, 0.0, 100.0, 1.0, 5.0, 0.0);
|
|
|
|
spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spinner);
|
1998-06-05 00:17:59 +08:00
|
|
|
|
2003-01-07 14:16:02 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2003-08-29 04:23:09 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
2001-12-31 08:21:10 +08:00
|
|
|
&shootvals.delay);
|
|
|
|
|
2000-01-08 23:23:28 +08:00
|
|
|
label = gtk_label_new (_("Seconds Delay"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
1998-06-05 00:17:59 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
1999-06-05 08:29:05 +08:00
|
|
|
gtk_widget_show (hbox);
|
1998-04-20 11:21:31 +08:00
|
|
|
gtk_widget_show (dialog);
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
return run_flag;
|
1998-06-05 00:17:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
/* delay functions */
|
1998-06-05 00:17:59 +08:00
|
|
|
void
|
|
|
|
shoot_delay (gint delay)
|
|
|
|
{
|
2003-01-31 11:08:29 +08:00
|
|
|
g_timeout_add (1000, shoot_delay_callback, &delay);
|
|
|
|
gtk_main ();
|
1998-06-05 00:17:59 +08:00
|
|
|
}
|
|
|
|
|
2003-01-31 11:08:29 +08:00
|
|
|
gboolean
|
1998-06-05 00:17:59 +08:00
|
|
|
shoot_delay_callback (gpointer data)
|
|
|
|
{
|
2003-08-29 07:38:32 +08:00
|
|
|
gint *seconds_left = data;
|
2000-10-30 02:07:07 +08:00
|
|
|
|
1998-06-05 00:17:59 +08:00
|
|
|
(*seconds_left)--;
|
2000-10-30 02:07:07 +08:00
|
|
|
|
2003-08-29 04:23:09 +08:00
|
|
|
if (!*seconds_left)
|
2003-08-29 07:38:32 +08:00
|
|
|
gtk_main_quit ();
|
1998-04-20 11:21:31 +08:00
|
|
|
|
2000-10-30 02:07:07 +08:00
|
|
|
return *seconds_left;
|
|
|
|
}
|