[gimp] Bug 732072: Image windows created by script-fu plug-ins...



commit 51d3498cd4c63edc4233520ca737a3d0e1a1b185
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Thu Aug 21 12:43:51 2014 +0200

    Bug 732072: Image windows created by script-fu plug-ins...
    
    are opened behind the previously focused Image Window
    
    libgimp/gimpui.c bypasses gtk in setting the transient_for
    property and so it is not possible to call
    gtk_set_transient_for (dialog, NULL), but it is necessary
    to go directly to the gdk level.

 plug-ins/script-fu/script-fu-interface.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/script-fu/script-fu-interface.c b/plug-ins/script-fu/script-fu-interface.c
index 5a7ae7f..6e5bcd7 100644
--- a/plug-ins/script-fu/script-fu-interface.c
+++ b/plug-ins/script-fu/script-fu-interface.c
@@ -719,6 +719,16 @@ script_fu_brush_callback (gpointer              data,
 }
 
 static void
+unset_transient_for (GtkWidget *dialog)
+{
+  GdkWindow *window = gtk_widget_get_window (dialog);
+
+  if (window)
+    gdk_property_delete (window,
+                         gdk_atom_intern_static_string ("WM_TRANSIENT_FOR"));
+}
+
+static void
 script_fu_response (GtkWidget *widget,
                     gint       response_id,
                     SFScript  *script)
@@ -747,6 +757,13 @@ script_fu_response (GtkWidget *widget,
       while (g_main_context_pending (NULL))
         g_main_context_iteration (NULL, TRUE);
 #endif
+      /*
+       * The script could have created a new GimpImageWindow, so
+       * unset the transient-for property not to focus the
+       * ImageWindow from which the script was started
+       */
+      unset_transient_for (sf_interface->dialog);
+
       gtk_widget_destroy (sf_interface->dialog);
       break;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]