Commit 2356aad3 authored by Michael Natterer's avatar Michael Natterer 😴

Remove gimp-remote for good, it has been disabled since 2008

parent 172c3eb9
......@@ -947,16 +947,6 @@ if test "x$enable_mp" != "xno"; then
fi
###################################################
# gimp-remote is obsolete, but can still be enabled
###################################################
AC_ARG_ENABLE(gimp-remote,
[ --enable-gimp-remote build gimp-remote utility (default=no)],
enable_gimp_remote=yes,
enable_gimp_remote="no (not enabled)")
################################
# Some plug-ins are X11 specific
################################
......@@ -1013,20 +1003,8 @@ AC_SUBST(SCREENSHOT_LIBS)
AC_SUBST(DOC_SHOOTER)
if test x"$enable_gimp_remote" = xyes; then
enable_gimp_remote="$have_libxmu"
fi
if test x"$enable_gimp_remote" = xyes; then
GIMP_REMOTE='gimp-remote-gimp_app_version$(EXEEXT)'
GIMP_REMOTE_MANPAGE='gimp-remote-gimp_app_version.1'
GIMP_COMMAND='gimp-remote-gimp_app_version'
else
GIMP_COMMAND='gimp-gimp_app_version'
fi
GIMP_COMMAND='gimp-gimp_app_version'
AC_SUBST(GIMP_REMOTE)
AC_SUBST(GIMP_REMOTE_MANPAGE)
AC_SUBST(GIMP_COMMAND)
......@@ -2245,7 +2223,6 @@ AC_CONFIG_FILES(
docs/gimp-gimp_app_version.1:docs/gimp.1.in
docs/gimprc-gimp_app_version.5:docs/gimprc.5.in
docs/gimptool-gimp_tool_version.1:docs/gimptool.1.in
docs/gimp-remote-gimp_app_version.1:docs/gimp-remote.1.in
gimp-gimp_pkgconfig_version.pc:gimp.pc.in
gimpthumb-gimp_pkgconfig_version.pc:gimpthumb.pc.in
gimpui-gimp_pkgconfig_version.pc:gimpui.pc.in
......@@ -2267,7 +2244,6 @@ Desktop files install into $DESKTOP_DATADIR
Extra Binaries:
gimp-console: $enable_gimp_console
gimp-remote: $enable_gimp_remote
Optional Features:
D-Bus service: $have_dbus_glib
......
......@@ -2,7 +2,6 @@
/Makefile.in
/gimp-2.*.1
/gimprc-2.*.5
/gimp-remote-2.*.1
/gimptool-2.0.1
/Wilber.xcf
/Wilber_Construction_Kit.xcf
## Process this file with automake to produce Makefile.in
EXTRA_DIST = \
gimp-remote.1.in \
Wilber.xcf.gz \
Wilber.xcf.gz.README \
Wilber_Construction_Kit.xcf.gz
mans = \
gimp-$(GIMP_APP_VERSION).1 \
gimprc-$(GIMP_APP_VERSION).5 \
$(GIMP_REMOTE_MANPAGE)
gimprc-$(GIMP_APP_VERSION).5
man_MANS = \
$(mans) \
......
.TH GIMP-REMOTE 1 "Januar 23 2007" "Version @GIMP_VERSION@" "GIMP Manual Pages"
.SH NAME
gimp\-remote - tells a running GIMP to open a (local or remote) image file.
.SH SYNOPSIS
.B gimp-remote
[\-h] [\-\-help] [-v] [\-\-version] [\-\-display \fIdisplay\fP]
[\-e] [\-\-existing] [\-q] [\-\-query] [\-s] [\-\-no\-splash]
[\-p] [\-\-print\-xid]
\fIfilename\fP ...
.SH DESCRIPTION
.PP
\fIgimp-remote\fP is a small utility that tells a running GIMP to open
one or more (local or remote) image files. It does so by searching
for a GIMP toolbox on the active display. If it can find a GIMP
toolbox, a synthetic drop event is created which makes GIMP think the
files would have been dropped onto the toolbox. More than one filename
or URL can be specified on the commandline.
.PP
If no GIMP window is found, \fIgimp-remote\fP will start a new GIMP
instance and ask it to load the specified images. If no filename or
URL is given, \fIgimp-remote\fP will start a new GIMP. This behaviour
can be altered using the command-line options described below.
.PP
If you are using GIMP on Linux or another platform with the D-Bus
message bus system, chances are good that this functionality is
already built into the main GIMP executable and that you will not need
to use \fIgimp-remote\fP.
.SH OPTIONS
\fIgimp\-remote\fP accepts the following options:
.TP 8
.B \-h, \-\-help
Display a list of all commandline options.
.TP 8
.B \-v, \-\-version
Output the version info.
.TP 8
.B \-\-display \fIdisplay\fP
Use the designated X display.
.TP 8
.B \-e, \-\-existing
If no running GIMP instance is found, don't start a new one but exit.
.TP 8
.B \-q, \-\-query
Check if GIMP is running and exit. A status code of 0 indicates that
a GIMP toolbox window has been found on this display.
.TP 8
.B \-p, \-\-print-xid
Like \-q, but print the X Window ID of the toolbox window if GIMP is already
running. If no such window exists nothing is printed.
.TP 8
.B \-s, \-\-no\-splash
When starting GIMP, do not show the splash screen.
.SH EXAMPLES
.TP
.BI gimp\-remote\ http://www.gimp.org/images/wilber_the_gimp.png
Loads the image from the GIMP website into a running GIMP or starts
a new one.
.TP
.BI gimp\-remote\ wilber.xcf\ wilma.xcf
Loads the local files wilber.xcf and wilma.xcf into a running GIMP
or starts a new one.
.SH ENVIRONMENT
.PP
.TP 8
.B DISPLAY
to get the default host and display number.
.SH AUTHORS
Sven Neumann and Simon Budig.
.SH "SEE ALSO"
.BR gimp (1),
.BR gimprc (5),
.BR gimptool (1)
......@@ -3,8 +3,7 @@
/.deps
/.libs
/kernelgen
/gimp-remote-2.7
/gimptool-2.0
/gimptool-2.0.exe
/test-clipboard
/test-clipboard.exe
\ No newline at end of file
/test-clipboard.exe
......@@ -8,23 +8,13 @@ endif
SUBDIRS = $(D_pdbgen)
bin_PROGRAMS = $(GIMP_REMOTE) gimptool-2.0
bin_PROGRAMS = gimptool-2.0
noinst_PROGRAMS = test-clipboard
EXTRA_PROGRAMS = \
gimp-remote-2.7 \
kernelgen
gimp_remote_2_7_SOURCES = \
gimp-remote.c \
gimp-remote.h \
gimp-remote-x11.c
gimp_remote_2_7_LDADD = \
$(GTK_LIBS) \
$(XMU_LIBS)
gimptool_2_0_SOURCES = \
gimptool.c
......@@ -69,21 +59,3 @@ EXTRA_DIST = \
defcheck.py \
gimp-mkenums \
gimppath2svg.py
install-exec-hook:
if DEFAULT_BINARY
if test -f "$(DESTDIR)$(bindir)/gimp-remote-@GIMP_APP_VERSION@"; then \
echo "cd $(DESTDIR)$(bindir)"; \
cd $(DESTDIR)$(bindir); \
echo "rm -f gimp-remote"; \
rm -f gimp-remote; \
echo "$(LN_S) gimp-remote-@GIMP_APP_VERSION@ gimp-remote"; \
$(LN_S) gimp-remote-@GIMP_APP_VERSION@ gimp-remote; \
fi
endif
uninstall-local:
if DEFAULT_BINARY
rm -f $(DESTDIR)$(bindir)/gimp-remote
endif
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimp-remote-x11.c
* Copyright (C) 2000-2007 Sven Neumann <sven@gimp.org>
* Simon Budig <simon@gimp.org>
*
* X11 specific routines for gimp-remote.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <X11/Xmu/WinUtil.h>
#include "libgimpbase/gimpbase.h"
#include <glib/gi18n.h>
#include "gimp-remote.h"
#define GIMP_BINARY "gimp-" GIMP_APP_VERSION
static void
source_selection_get (GtkWidget *widget,
GtkSelectionData *selection_data,
guint info,
guint time,
const gchar *uri)
{
gtk_selection_data_set (selection_data,
gtk_selection_data_get_target (selection_data),
8, (const guchar *) uri, strlen (uri));
gtk_main_quit ();
}
static gboolean
toolbox_hidden (gpointer data)
{
g_printerr ("%s\n%s\n",
_("Could not connect to GIMP."),
_("Make sure that the Toolbox is visible!"));
gtk_main_quit ();
return FALSE;
}
GdkWindow *
gimp_remote_find_toolbox (GdkDisplay *display,
GdkScreen *screen)
{
GdkWindow *result = NULL;
Display *xdisplay;
Window root, parent;
Window *children;
Atom role_atom;
Atom string_atom;
guint nchildren;
gint i;
GdkWindow *root_window = gdk_screen_get_root_window (screen);
xdisplay = gdk_x11_display_get_xdisplay (display);
role_atom = XInternAtom (xdisplay, "WM_WINDOW_ROLE", TRUE);
string_atom = XInternAtom (xdisplay, "STRING", TRUE);
if (role_atom == None || string_atom == None)
return NULL;
if (XQueryTree (xdisplay, GDK_WINDOW_XID (root_window),
&root, &parent, &children, &nchildren) == 0)
return NULL;
if (! (children && nchildren))
return NULL;
for (i = nchildren - 1; i >= 0; i--)
{
Window window;
Atom ret_type;
gint ret_format;
gulong bytes_after;
gulong nitems;
guchar *data;
/* The XmuClientWindow() function finds a window at or below the
* specified window, that has a WM_STATE property. If such a
* window is found, it is returned; otherwise the argument window
* is returned.
*/
window = XmuClientWindow (xdisplay, children[i]);
/* We are searching for the GIMP toolbox: Its WM_WINDOW_ROLE Property
* (as set by gtk_window_set_role ()) has the value "gimp-toolbox".
* This is pretty reliable, since it ask for a special property,
* explicitly set by GIMP. See below... :-)
*/
if (XGetWindowProperty (xdisplay, window,
role_atom,
0, 32,
FALSE,
string_atom,
&ret_type, &ret_format, &nitems, &bytes_after,
&data) == Success && ret_type)
{
if (nitems > 11 &&
strcmp ((const gchar *) data, "gimp-toolbox") == 0)
{
XFree (data);
result = gdk_x11_window_foreign_new_for_display (display, window);
break;
}
XFree (data);
}
}
XFree (children);
return result;
}
void
gimp_remote_launch (GdkScreen *screen,
const gchar *argv0,
const gchar *startup_id,
gboolean no_splash,
GString *file_list)
{
gchar *display_name;
gchar **argv;
gchar *gimp, *path, *name, *pwd;
const gchar *spath;
gint i;
if (startup_id)
g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE);
if (file_list->len > 0)
file_list = g_string_prepend (file_list, "\n");
display_name = gdk_screen_make_display_name (screen);
file_list = g_string_prepend (file_list, display_name);
file_list = g_string_prepend (file_list, "--display\n");
g_free (display_name);
if (no_splash)
file_list = g_string_prepend (file_list, "--no-splash\n");
file_list = g_string_prepend (file_list, "gimp\n");
argv = g_strsplit (file_list->str, "\n", 0);
/* We are searching for the path the gimp-remote executable lives in */
/*
* the "_" environment variable usually gets set by the sh-family of
* shells. We have to sanity-check it. If we do not find anything
* usable in it try argv[0], then fall back to search the path.
*/
gimp = NULL;
spath = NULL;
for (i = 0; i < 2; i++)
{
if (i == 0)
{
spath = g_getenv ("_");
}
else if (i == 1)
{
spath = argv0;
}
if (spath)
{
name = g_path_get_basename (spath);
if (! strncmp (name, "gimp-remote", 11))
{
path = g_path_get_dirname (spath);
if (g_path_is_absolute (spath))
{
gimp = g_build_filename (path, GIMP_BINARY, NULL);
}
else
{
pwd = g_get_current_dir ();
gimp = g_build_filename (pwd, path, GIMP_BINARY, NULL);
g_free (pwd);
}
g_free (path);
}
g_free (name);
}
if (gimp)
break;
}
/* We must ensure that gimp is started with a different PID.
Otherwise it could happen that (when it opens it's display) it sends
the same auth token again (because that one is uniquified with PID
and time()), which the server would deny. */
switch (fork ())
{
case -1:
exit (EXIT_FAILURE);
case 0: /* child */
execv (gimp, argv);
execvp (GIMP_BINARY, argv);
/* if execv and execvp return, there was an error */
g_printerr (_("Couldn't start '%s': %s"),
GIMP_BINARY, g_strerror (errno));
g_printerr ("\n");
exit (EXIT_FAILURE);
default: /* parent */
break;
}
exit (EXIT_SUCCESS);
}
gboolean
gimp_remote_drop_files (GdkDisplay *display,
GdkWindow *window,
GString *file_list)
{
GdkDragContext *context;
GdkDragProtocol protocol;
GtkWidget *source;
GdkAtom sel_type;
GdkAtom sel_id;
GList *targetlist;
guint timeout;
gdk_drag_get_protocol_for_display (display,
GDK_WINDOW_XID (window),
&protocol);
if (protocol != GDK_DRAG_PROTO_XDND)
{
g_printerr ("GIMP Window doesnt use Xdnd-Protocol - huh?\n");
return FALSE;
}
/* Problem: If the Toolbox is hidden via Tab (gtk_widget_hide)
* it does not accept DnD-Operations and gtk_main() will not be
* terminated. If the Toolbox is simply unmapped (by the WM)
* DnD works. But in both cases gdk_window_is_visible() returns
* FALSE. To work around this we add a timeout and abort after
* 5 seconds.
*/
timeout = g_timeout_add (5000, toolbox_hidden, NULL);
/* set up an DND-source */
source = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (source, "selection-get",
G_CALLBACK (source_selection_get),
file_list->str);
gtk_widget_realize (source);
/* specify the id and the content-type of the selection used to
* pass the URIs to GIMP.
*/
sel_id = gdk_atom_intern ("XdndSelection", FALSE);
sel_type = gdk_atom_intern ("text/uri-list", FALSE);
targetlist = g_list_prepend (NULL, GUINT_TO_POINTER (sel_type));
/* assign the selection to our DnD-source */
gtk_selection_owner_set (source, sel_id, GDK_CURRENT_TIME);
gtk_selection_add_target (source, sel_id, sel_type, 0);
/* drag_begin/motion/drop */
context = gdk_drag_begin (gtk_widget_get_window (source), targetlist);
gdk_drag_motion (context, window, protocol, 0, 0,
GDK_ACTION_COPY, GDK_ACTION_COPY, GDK_CURRENT_TIME);
gdk_drag_drop (context, GDK_CURRENT_TIME);
/* finally enter the mainloop to handle the events */
gtk_main ();
g_source_remove (timeout);
return TRUE;
}
void
gimp_remote_print_id (GdkWindow *window)
{
g_print ("0x%lx\n", GDK_WINDOW_XID (window));
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimp-remote.c
* Copyright (C) 2000-2007 Sven Neumann <sven@gimp.org>
* Simon Budig <simon@gimp.org>
*
* Tells a running gimp to open files by creating a synthetic drop-event.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/* Disclaimer:
*
* It is a really bad idea to use Drag'n'Drop for inter-client
* communication. Dont even think about doing this in your own newly
* created application.
* Simon
*/
#include "config.h"
#include <stdlib.h>
#include <locale.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include <glib/gi18n.h>
#include "gimp-remote.h"
static void show_version (void) G_GNUC_NORETURN;
static gboolean existing = FALSE;
static gboolean query = FALSE;
static gboolean no_splash = FALSE;
static gboolean print_xid = FALSE;
static const gchar **filenames = NULL;
static const GOptionEntry main_entries[] =
{
{ "version", 'v', G_OPTION_FLAG_NO_ARG,
G_OPTION_ARG_CALLBACK, (GOptionArgFunc) show_version,
N_("Show version information and exit"), NULL
},
{
"existing", 'e', 0,
G_OPTION_ARG_NONE, &existing,
N_("Use a running GIMP only, never start a new one"), NULL
},
{
"query", 'q', 0,
G_OPTION_ARG_NONE, &query,
N_("Only check if GIMP is running, then quit"), NULL
},
#ifdef GDK_WINDOWING_X11
{
"print-xid", 'p', 0,
G_OPTION_ARG_NONE, &print_xid,
N_("Print X window ID of GIMP toolbox window, then quit"), NULL
},
#endif
{
"no-splash", 's', 0,
G_OPTION_ARG_NONE, &no_splash,
N_("Start GIMP without showing the startup window"), NULL
},
{
G_OPTION_REMAINING, 0, 0,
G_OPTION_ARG_FILENAME_ARRAY, &filenames,
NULL, NULL
},
{ NULL }
};
static void
show_version (void)
{
g_print (_("%s version %s"), "gimp-remote", GIMP_VERSION);
g_print ("\n");
exit (EXIT_SUCCESS);
}
static void
init_i18n (void)
{
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
textdomain (GETTEXT_PACKAGE);
}
/* Check name for a valid URI scheme as described in RFC 2396.
* URI scheme:suffix with scheme = [alpha][alphanum|digit|+|-|.]*
* Note that a null suffix will be considered as an invalid URI.
* return 1 if valid scheme found, else 0
*/
static gboolean
is_valid_uri (const gchar *name)
{
const gchar *c = name;
g_return_val_if_fail (name != NULL, FALSE);
/* first character must be alpha */
if (! g_ascii_isalpha (*c))
return FALSE;
c++;
while (*c != '\0' && *c != ':')
{
if (! g_ascii_isalnum (*c) && *c != '+' && *c != '-' && *c != '.')
return FALSE;
c++;
}
if (*c == ':')
{
c++;
if (*c != '\0')
return TRUE;
}
return FALSE;
}
gint
main (gint argc,
gchar **argv)
{
GOptionContext *context;
GError *error = NULL;
GdkDisplay *display;
GdkScreen *screen;
GdkWindow *toolbox;
const gchar *startup_id;
gchar *desktop_startup_id = NULL;
GString *file_list = g_string_new (NULL);
init_i18n ();
/* we save the startup_id before calling gtk_init()
because GTK+ will unset it */
startup_id = g_getenv ("DESKTOP_STARTUP_ID");
if (startup_id && *startup_id)
desktop_startup_id = g_strdup (startup_id);
/* parse the command-line options */
context = g_option_context_new ("[FILE|URI...]");
g_option_context_add_main_entries (context, main_entries, NULL);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
if (! g_option_context_parse (context, &argc, &argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (EXIT_FAILURE);
}
gtk_init (&argc, &argv);
if (filenames)
{
gchar *cwd = g_get_current_dir ();
gint i;
for (i = 0; filenames[i]; i++)
{
const gchar *name = filenames[i];
gchar *uri;
/* If not already a valid URI */
if (! is_valid_uri (name))
{
if (g_path_is_absolute (name))
{
uri = g_filename_to_uri (name, NULL, NULL);
}
else
{
gchar *abs = g_build_filename (cwd, name, NULL);
uri = g_filename_to_uri (abs, NULL, NULL);
g_free (abs);
}
}
else
{
uri = g_strdup (name);