File gnome-settings-daemon-bnc486019-confirmation-dialog-transient.diff of Package gnome-settings-daemon
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 911eb1b..ec88e13 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -340,7 +340,7 @@ timeout_response_cb (GtkDialog *dialog, int response_id, gpointer data)
}
static gboolean
-user_says_things_are_ok (GsdXrandrManager *manager)
+user_says_things_are_ok (GsdXrandrManager *manager, GdkWindow *parent_window)
{
TimeoutDialog timeout;
guint timeout_id;
@@ -364,6 +364,11 @@ user_says_things_are_ok (GsdXrandrManager *manager)
G_CALLBACK (timeout_response_cb),
&timeout);
+ gtk_widget_realize (timeout.dialog);
+
+ if (parent_window)
+ gdk_window_set_transient_for (gtk_widget_get_window (timeout.dialog), parent_window);
+
gtk_widget_show_all (timeout.dialog);
timeout_id = g_timeout_add (1000,
timeout_cb,
@@ -380,7 +385,7 @@ user_says_things_are_ok (GsdXrandrManager *manager)
}
static gboolean
-try_to_apply_intended_configuration (GsdXrandrManager *manager, GError **error)
+try_to_apply_intended_configuration (GsdXrandrManager *manager, GdkWindow *parent_window, guint32 timestamp, GError **error)
{
char *backup_filename;
char *intended_filename;
@@ -391,6 +396,9 @@ try_to_apply_intended_configuration (GsdXrandrManager *manager, GError **error)
backup_filename = gnome_rr_config_get_backup_filename ();
intended_filename = gnome_rr_config_get_intended_filename ();
+ /* FIXME: we should pass the timestamp to the XRR* functions, but the
+ * GnomeRR wrapper API doesn't take timestamps yet.
+ */
result = apply_stored_configuration_and_rotate_tablet (manager, intended_filename, error);
if (!result) {
error_message (manager, _("The selected configuration for displays could not be applied"), error ? *error : NULL, NULL);
@@ -400,7 +408,7 @@ try_to_apply_intended_configuration (GsdXrandrManager *manager, GError **error)
/* Confirm with the user */
- if (user_says_things_are_ok (manager))
+ if (user_says_things_are_ok (manager, parent_window))
unlink (backup_filename);
else
restore_backup_configuration (manager, backup_filename, intended_filename);
@@ -412,12 +420,35 @@ out:
return result;
}
-/* DBus method; see gsd-xrandr-manager.xml for the interface definition */
+/* DBus method for org.gnome.SettingsDaemon.XRANDR ApplyConfiguration; see gsd-xrandr-manager.xml for the interface definition */
static gboolean
gsd_xrandr_manager_apply_configuration (GsdXrandrManager *manager,
GError **error)
{
- return try_to_apply_intended_configuration (manager, error);
+ return try_to_apply_intended_configuration (manager, NULL, 0, error);
+}
+
+/* DBus method for org.gnome.SettingsDaemon.XRANDR_2 ApplyConfiguration; see gsd-xrandr-manager.xml for the interface definition */
+static gboolean
+gsd_xrandr_manager_2_apply_configuration (GsdXrandrManager *manager,
+ long parent_window_id,
+ long timestamp,
+ GError **error)
+{
+ GdkWindow *parent_window;
+ gboolean result;
+
+ if (parent_window_id != 0)
+ parent_window = gdk_window_foreign_new_for_display (gdk_display_get_default (), parent_window_id);
+ else
+ parent_window = NULL;
+
+ result = try_to_apply_intended_configuration (manager, parent_window, (guint32) timestamp, error);
+
+ if (parent_window)
+ g_object_unref (parent_window);
+
+ return result;
}
/* We include this after the definition of gsd_xrandr_manager_apply_configuration() so the prototype will already exist */
@@ -1206,7 +1237,7 @@ output_rotation_item_activate_cb (GtkCheckMenuItem *item, gpointer data)
return;
}
- try_to_apply_intended_configuration (manager, NULL); /* NULL-GError */
+ try_to_apply_intended_configuration (manager, NULL, 0, NULL); /* NULL-GError */
}
static void
diff --git a/plugins/xrandr/gsd-xrandr-manager.xml b/plugins/xrandr/gsd-xrandr-manager.xml
index 2efd18b..365a552 100644
--- a/plugins/xrandr/gsd-xrandr-manager.xml
+++ b/plugins/xrandr/gsd-xrandr-manager.xml
@@ -3,6 +3,21 @@
<interface name="org.gnome.SettingsDaemon.XRANDR">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="gsd_xrandr_manager"/>
<method name="ApplyConfiguration">
+ <!-- This method is implemented, but deprecated in favor of the
+ same method in the XRANDR-2 interface defined below. -->
+ </method>
+ </interface>
+
+ <interface name="org.gnome.SettingsDaemon.XRANDR_2">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="gsd_xrandr_manager_2"/>
+ <method name="ApplyConfiguration">
+ <!-- transient-parent window for the confirmation dialog; use 0
+ for no parent -->
+ <arg name="parent_window_id" type="x" direction="in"/>
+
+ <!-- Timestamp used to present the confirmation dialog and (in
+ the future) for the RANDR calls themselves -->
+ <arg name="timestamp" type="x" direction="in"/>
</method>
</interface>
</node>