[gcr/wip/nielsdg/lose-x11-dependency: 2/3] prompt: Support transient_for in Wayland
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr/wip/nielsdg/lose-x11-dependency: 2/3] prompt: Support transient_for in Wayland
- Date: Tue, 3 Dec 2019 08:01:22 +0000 (UTC)
commit 7a91f5487768aeb6747353b1f1d63cd8904fecba
Author: Niels De Graef <nielsdegraef gmail com>
Date: Tue Dec 3 08:51:28 2019 +0100
prompt: Support transient_for in Wayland
GDK provides an interface to the _xdg-foreign_ protocol extension, which
exactly allows to export a handle that another window can use to set
itself transient to.
gcr/gcr-prompt.c | 4 ++++
ui/gcr-prompt-dialog.c | 7 +++++++
2 files changed, 11 insertions(+)
---
diff --git a/gcr/gcr-prompt.c b/gcr/gcr-prompt.c
index d1e71a4..a2a6aaf 100644
--- a/gcr/gcr-prompt.c
+++ b/gcr/gcr-prompt.c
@@ -210,6 +210,10 @@ gcr_prompt_default_init (GcrPromptIface *iface)
* The caller window indicates to the prompt which window is prompting the
* user. The prompt may choose to ignore this information or use it in whatever
* way it sees fit.
+ *
+ * In X11, this will be a stringified version of the XWindow handle; in
+ * Wayland this is the result of an export using the XDG foreign
+ * protocol.
*/
g_object_interface_install_property (iface,
g_param_spec_string ("caller-window", "Caller window", "Window ID of
application window requesting prompt",
diff --git a/ui/gcr-prompt-dialog.c b/ui/gcr-prompt-dialog.c
index f623df1..88a3f96 100644
--- a/ui/gcr-prompt-dialog.c
+++ b/ui/gcr-prompt-dialog.c
@@ -160,6 +160,13 @@ update_transient_for (GcrPromptDialog *self)
gdk_window_set_transient_for (window, transient_for);
g_object_unref (transient_for);
}
+#else
+ if (gdk_wayland_window_set_transient_for_exported (window, self->pv->caller_window)) {
+ g_debug ("Succesfully set transient for WL window %s", self->pv->caller_window);
+ } else {
+ g_warning ("caller-window property doesn't represent a window on current display: %s",
+ self->pv->caller_window);
+ }
#endif
gtk_window_set_modal (GTK_WINDOW (self), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]