From 179f0cc4f487a3bca549cb5c91fc04c143fb9ee5 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 14 Aug 2006 19:11:15 +0000 Subject: [PATCH] tools/gimp-remote.c applied patch from Michael Klein that adds an option 2006-08-14 Sven Neumann * tools/gimp-remote.c * docs/gimp-remote.1.in: applied patch from Michael Klein that adds an option to print out the XID of the toolbox window (bug #351205). --- ChangeLog | 6 ++++++ docs/gimp-remote.1.in | 5 +++++ tools/gimp-remote.c | 17 +++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f24616ba2..6527ed8cdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-14 Sven Neumann + + * tools/gimp-remote.c + * docs/gimp-remote.1.in: applied patch from Michael Klein that adds + an option to print out the XID of the toolbox window (bug #351205). + 2006-08-14 Sven Neumann * plug-ins/winicon/icoload.c: open the file in binary mode. diff --git a/docs/gimp-remote.1.in b/docs/gimp-remote.1.in index 514693bac0..654ae16a6b 100644 --- a/docs/gimp-remote.1.in +++ b/docs/gimp-remote.1.in @@ -6,6 +6,7 @@ gimp\-remote - tells a running GIMP to open a (local or remote) image file. .B gimp-remote [\-h] [\-\-help] [-v] [\-\-version] [\-\-display \fIdisplay\fP] [\-e] [\-\-existing] [\-q] [\-\-query] [\-s] [\-\-no\-splash] +[\-p] [\-\-print\-xid] \fIfilename\fP ... @@ -45,6 +46,10 @@ If no running GIMP instance is found, don't start a new one but exit. 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. diff --git a/tools/gimp-remote.c b/tools/gimp-remote.c index 238894ac73..706aa7557d 100644 --- a/tools/gimp-remote.c +++ b/tools/gimp-remote.c @@ -69,6 +69,7 @@ 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[] = @@ -87,6 +88,11 @@ static const GOptionEntry main_entries[] = G_OPTION_ARG_NONE, &query, N_("Only check if GIMP is running, then quit"), NULL }, + { + "print-xid", 'p', 0, + G_OPTION_ARG_NONE, &print_xid, + N_("Print X window ID of GIMP toolbox window, then quit"), NULL + }, { "no-splash", 's', 0, G_OPTION_ARG_NONE, &no_splash, @@ -449,14 +455,14 @@ main (gint argc, screen = gdk_screen_get_default (); /* if called without any filenames, always start a new GIMP */ - if (file_list->len == 0 && !query && !existing) + if (file_list->len == 0 && !query && !print_xid && !existing) { start_new_gimp (screen, argv[0], desktop_startup_id, file_list); } gimp_window = gimp_remote_find_window (display, screen); - if (! query) + if (! query && ! print_xid) { if (gimp_window) { @@ -524,6 +530,13 @@ main (gint argc, start_new_gimp (screen, argv[0], desktop_startup_id, file_list); } } + else if (print_xid) + { + if (gimp_window) + { + g_print ("0x%lx\n", GDK_WINDOW_XID (gimp_window)); + } + } gdk_notify_startup_complete ();