build gimp-remote
2000-07-15 Sven Neumann <neo@wintermute.ochsenblut.de> * tools/Makefile.am: build gimp-remote * tools/gimp-remote.c: g_error() should only be used for fatal errors that can never happen. * plug-ins/script-fu/po/pt_BR.po * plug-ins/script-fu/po: removed. I guess this was accidentally added.
This commit is contained in:

committed by
Sven Neumann

parent
10510384d8
commit
2010d3a822
12
ChangeLog
12
ChangeLog
@ -1,6 +1,18 @@
|
|||||||
|
2000-07-15 Sven Neumann <neo@wintermute.ochsenblut.de>
|
||||||
|
|
||||||
|
* tools/Makefile.am: build gimp-remote
|
||||||
|
|
||||||
|
* tools/gimp-remote.c: g_error() should only be used
|
||||||
|
for fatal errors that can never happen.
|
||||||
|
|
||||||
|
* plug-ins/script-fu/po/pt_BR.po
|
||||||
|
* plug-ins/script-fu/po: removed. I guess this was
|
||||||
|
accidentally added.
|
||||||
|
|
||||||
2000-07-13 Simon Budig <simon@gimp.org>
|
2000-07-13 Simon Budig <simon@gimp.org>
|
||||||
|
|
||||||
* tools/gimp-remote.c: new file
|
* tools/gimp-remote.c: new file
|
||||||
|
|
||||||
This is a first implementation of a remote control for gimp.
|
This is a first implementation of a remote control for gimp.
|
||||||
It synthesizes a drag'n'drop event on the toolbox to make
|
It synthesizes a drag'n'drop event on the toolbox to make
|
||||||
Gimp load a file or an URL. Not yet built automatically since
|
Gimp load a file or an URL. Not yet built automatically since
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,6 @@
|
|||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
kernelgen
|
kernelgen
|
||||||
|
gimp-remote
|
||||||
|
@ -4,6 +4,19 @@ else
|
|||||||
D_pdbgen=
|
D_pdbgen=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
bin_PROGRAMS = gimp-remote
|
||||||
|
|
||||||
|
gimp_remote_SOURCES = gimp-remote.c
|
||||||
|
|
||||||
|
gimp_remote_LDADD = \
|
||||||
|
$(GTK_LIBS) \
|
||||||
|
-lXmu
|
||||||
|
|
||||||
|
INCLUDES = \
|
||||||
|
-I$(top_srcdir) \
|
||||||
|
$(GTK_CFLAGS) \
|
||||||
|
-I$(includedir)
|
||||||
|
|
||||||
#if WITH_GCG
|
#if WITH_GCG
|
||||||
#D_gcg=gcg
|
#D_gcg=gcg
|
||||||
#else
|
#else
|
||||||
|
@ -25,7 +25,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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* this file contains code derived from:
|
/* This file contains code derived from:
|
||||||
*
|
*
|
||||||
* remote.c --- remote control of Netscape Navigator for Unix.
|
* remote.c --- remote control of Netscape Navigator for Unix.
|
||||||
* version 1.1.3, for Netscape Navigator 1.1 and newer.
|
* version 1.1.3, for Netscape Navigator 1.1 and newer.
|
||||||
@ -55,8 +55,6 @@
|
|||||||
* Simon
|
* Simon
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -103,7 +101,7 @@ gimp_remote_find_window (Display *display)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = nchildren - 1; i >= 0; i--)
|
for (i = nchildren - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Atom type;
|
Atom type;
|
||||||
gint format;
|
gint format;
|
||||||
gulong nitems, bytesafter;
|
gulong nitems, bytesafter;
|
||||||
@ -123,14 +121,16 @@ gimp_remote_find_window (Display *display)
|
|||||||
False, WM_STRING,
|
False, WM_STRING,
|
||||||
&type, &format, &nitems, &bytesafter,
|
&type, &format, &nitems, &bytesafter,
|
||||||
&version);
|
&version);
|
||||||
if (status == Success && type != None && nitems > 0) {
|
|
||||||
if (!strcmp (version, "toolbox"))
|
if (status == Success && type != None && nitems > 0)
|
||||||
if (!strcmp (version+8, "Gimp")) {
|
{
|
||||||
result = window;
|
if (!strcmp (version, "toolbox") && !strcmp (version+8, "Gimp"))
|
||||||
break;
|
{
|
||||||
}
|
result = window;
|
||||||
|
break;
|
||||||
|
}
|
||||||
XFree (version);
|
XFree (version);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -148,15 +148,15 @@ gimp_remote_find_window (Display *display)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (status == Success && type != None)
|
if (status == Success && type != None)
|
||||||
{
|
{
|
||||||
result = window;
|
result = window;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree (version);
|
XFree (version);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree (children);
|
XFree (children);
|
||||||
|
|
||||||
@ -166,11 +166,11 @@ gimp_remote_find_window (Display *display)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
source_selection_get (GtkWidget *widget,
|
source_selection_get (GtkWidget *widget,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint info,
|
guint info,
|
||||||
guint time,
|
guint time,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gchar *uri = (gchar *) data;
|
gchar *uri = (gchar *) data;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ source_selection_get (GtkWidget *widget,
|
|||||||
int
|
int
|
||||||
toolbox_hidden (gpointer data)
|
toolbox_hidden (gpointer data)
|
||||||
{
|
{
|
||||||
g_printerr ("Could not connect to the Gimp. "
|
g_printerr ("Could not connect to the Gimp.\n"
|
||||||
"Make sure that the Toolbox is visible!\n");
|
"Make sure that the Toolbox is visible!\n");
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
return 0;
|
return 0;
|
||||||
@ -194,91 +194,95 @@ toolbox_hidden (gpointer data)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc,
|
||||||
|
char **argv)
|
||||||
{
|
{
|
||||||
GtkWidget *source;
|
GtkWidget *source;
|
||||||
GdkWindow *gimp_window;
|
GdkWindow *gimp_window;
|
||||||
Window gimp_x_window;
|
Window gimp_x_window;
|
||||||
|
|
||||||
GdkDragContext *context;
|
GdkDragContext *context;
|
||||||
GdkDragProtocol protocol;
|
GdkDragProtocol protocol;
|
||||||
|
|
||||||
GdkAtom sel_type;
|
GdkAtom sel_type;
|
||||||
GdkAtom sel_id;
|
GdkAtom sel_id;
|
||||||
GList *targetlist;
|
GList *targetlist;
|
||||||
guint timeout;
|
guint timeout;
|
||||||
|
|
||||||
/* multiple files are separated by "\n"
|
/* multiple files are separated by "\n"
|
||||||
* obviously this should be set from the commandline...
|
* obviously this should be set from the commandline...
|
||||||
*/
|
*/
|
||||||
/* gchar *filename = "file:/tmp/dnd-test.gif"; */
|
/* gchar *filename = "file:/tmp/dnd-test.gif"; */
|
||||||
|
|
||||||
gchar *cwd = g_get_current_dir();
|
gchar *cwd = g_get_current_dir();
|
||||||
gchar *file_list = "";
|
gchar *file_list = "";
|
||||||
gchar *file_uri = "";
|
gchar *file_uri = "";
|
||||||
gchar *tmp = NULL;
|
gchar *tmp = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (strlen (argv[i]) == 0)
|
if (strlen (argv[i]) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If not already a valid URI */
|
/* If not already a valid URI */
|
||||||
if (g_strncasecmp ("file:", argv[i], 5) &&
|
if (g_strncasecmp ("file:", argv[i], 5) &&
|
||||||
g_strncasecmp ("ftp:", argv[i], 4) &&
|
g_strncasecmp ("ftp:", argv[i], 4) &&
|
||||||
g_strncasecmp ("http:", argv[i], 5))
|
g_strncasecmp ("http:", argv[i], 5))
|
||||||
{
|
{
|
||||||
if (g_path_is_absolute (argv[i]))
|
if (g_path_is_absolute (argv[i]))
|
||||||
file_uri = g_strconcat ("file:", argv[i], NULL);
|
file_uri = g_strconcat ("file:", argv[i], NULL);
|
||||||
else
|
else
|
||||||
file_uri = g_strconcat ("file:", cwd, "/", argv[i], NULL);
|
file_uri = g_strconcat ("file:", cwd, "/", argv[i], NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
file_uri = g_strdup (argv[i]);
|
file_uri = g_strdup (argv[i]);
|
||||||
|
|
||||||
if (strlen (file_list) > 0)
|
if (strlen (file_list) > 0)
|
||||||
{
|
{
|
||||||
tmp = g_strconcat (file_list, "\n", file_uri, NULL);
|
tmp = g_strconcat (file_list, "\n", file_uri, NULL);
|
||||||
g_free (file_list);
|
g_free (file_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp = g_strdup (file_uri);
|
tmp = g_strdup (file_uri);
|
||||||
|
|
||||||
g_free (file_uri);
|
g_free (file_uri);
|
||||||
|
|
||||||
file_list = tmp;
|
file_list = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if (strlen (file_list) == 0)
|
||||||
|
{
|
||||||
if (strlen (file_list) == 0) {
|
g_print ("Usage: gimp-remote [FILE|URI]...\n"
|
||||||
g_print (
|
"Tell a running Gimp to open a (local or remote) image file\n"
|
||||||
"Usage: gimp-remote [FILE|URI]...\n"
|
"Example: gimp-remote http://www.gimp.org/icons/frontpage-small.gif\n"
|
||||||
"Tell a running Gimp to open a (local or remote) image file\n"
|
" or: gimp-remote localfile.png\n");
|
||||||
"Example: gimp-remote http://www.gimp.org/icons/frontpage-small.gif\n"
|
|
||||||
" or: gimp-remote localfile.png\n"
|
|
||||||
);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
/* locate Gimp window and make it comfortable for us */
|
/* locate Gimp window and make it comfortable for us */
|
||||||
gimp_x_window = gimp_remote_find_window (gdk_display);
|
gimp_x_window = gimp_remote_find_window (gdk_display);
|
||||||
if (gimp_x_window == None)
|
if (gimp_x_window == None)
|
||||||
g_error ("no gimp window found on display %s\n", gdk_get_display ());
|
{
|
||||||
|
g_printerr ("No gimp window found on display %s\n", gdk_get_display ());
|
||||||
|
exit (-1);
|
||||||
|
}
|
||||||
|
|
||||||
gdk_drag_get_protocol (gimp_x_window, &protocol);
|
gdk_drag_get_protocol (gimp_x_window, &protocol);
|
||||||
if (protocol != GDK_DRAG_PROTO_XDND)
|
if (protocol != GDK_DRAG_PROTO_XDND)
|
||||||
g_error ("Gimp-Window doesnt use Xdnd-Protocol - huh?\n");
|
{
|
||||||
|
g_printerr ("Gimp-Window doesnt use Xdnd-Protocol - huh?\n");
|
||||||
|
exit (-1);
|
||||||
|
}
|
||||||
|
|
||||||
gimp_window = gdk_window_foreign_new (gimp_x_window);
|
gimp_window = gdk_window_foreign_new (gimp_x_window);
|
||||||
if (!gimp_window)
|
if (!gimp_window)
|
||||||
g_error ("Couldn't create gdk_window for gimp_x_window\n");
|
{
|
||||||
|
g_printerr ("Couldn't create gdk_window for gimp_x_window\n");
|
||||||
|
exit (-1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Problem: If the Toolbox is hidden via Tab (gtk_widget_hide)
|
/* Problem: If the Toolbox is hidden via Tab (gtk_widget_hide)
|
||||||
* it does not accept DnD-Operations and gtk_main() will not be
|
* it does not accept DnD-Operations and gtk_main() will not be
|
||||||
@ -326,3 +330,4 @@ main (int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user