[gimp] plug-ins: set parent_window parameter to Screenshot function of portal…
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: set parent_window parameter to Screenshot function of portal…
- Date: Wed, 30 Dec 2020 21:23:14 +0000 (UTC)
commit ba4f24e49c50f86a5713dd5b0aad2c268c052b1f
Author: Jehan <jehan girinstud io>
Date: Wed Dec 30 22:05:49 2020 +0100
plug-ins: set parent_window parameter to Screenshot function of portal…
… org.freedesktop.portal.Desktop (X11 only).
If we don't set this parameter appropriately, the created dialog is not
modal/transient relatively to the main GIMP window. This is especially
annoying because in my tests (GNOME shell), the screenshot dialog would
appear behind GIMP window, which makes it feel like broken behavior.
Note that the supported handles are X11 only so far. We'll need to
generate the appropriate Wayland handles too (created from xdg_foreign
protocol).
plug-ins/screenshot/screenshot-freedesktop.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/screenshot/screenshot-freedesktop.c b/plug-ins/screenshot/screenshot-freedesktop.c
index 214051d509..ba0bffa00f 100644
--- a/plug-ins/screenshot/screenshot-freedesktop.c
+++ b/plug-ins/screenshot/screenshot-freedesktop.c
@@ -28,6 +28,10 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
#include "screenshot.h"
#include "screenshot-freedesktop.h"
@@ -126,7 +130,24 @@ screenshot_freedesktop_shoot (ScreenshotValues *shootvals,
GError **error)
{
GVariant *retval;
- gchar *opath = NULL;
+ gchar *opath = NULL;
+ gchar *parent_window = NULL;
+
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+ {
+ GdkWindow *window;
+
+ window = gimp_ui_get_progress_window ();
+ if (window)
+ {
+ gint id;
+
+ id = GDK_WINDOW_XID (window);
+ parent_window = g_strdup_printf ("x11:0x%x", id);
+ }
+ }
+#endif
if (shootvals->shoot_type != SHOOT_ROOT)
{
@@ -138,9 +159,10 @@ screenshot_freedesktop_shoot (ScreenshotValues *shootvals,
screenshot_delay (shootvals->screenshot_delay);
retval = g_dbus_proxy_call_sync (proxy, "Screenshot",
- g_variant_new ("(sa{sv})", "", NULL),
+ g_variant_new ("(sa{sv})", parent_window ? parent_window : "", NULL),
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, error);
+ g_free (parent_window);
g_object_unref (proxy);
proxy = NULL;
if (retval)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]