[gnome-settings-daemon] RANDR - only use applicable configurations when auto-configuring outputs during hotplug
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-settings-daemon] RANDR - only use applicable configurations when auto-configuring outputs during hotplug
- Date: Wed, 15 Jul 2009 18:25:28 +0000 (UTC)
commit 2236330b75beeb04b0a5336e93d6b75fccc9e631
Author: Federico Mena Quintero <federico novell com>
Date: Wed Jul 15 12:33:38 2009 -0500
RANDR - only use applicable configurations when auto-configuring outputs during hotplug
Like in the previous commit, we would generate a configuration automatically,
but we didn't check if it was actually applicable. We don't want auto-
configuration to cause spurious errors to be presented to the user, so now we
first check if auto-generated configurations are applicable.
Signed-off-by: Federico Mena Quintero <federico novell com>
plugins/xrandr/gsd-xrandr-manager.c | 44 +++++++++++++++++++++++++++++++---
1 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index ac892f7..82a91ff 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -978,6 +978,7 @@ auto_configure_outputs (GsdXrandrManager *manager, guint32 timestamp)
GList *l;
int x;
GError *error;
+ gboolean applicable;
config = gnome_rr_config_new_current (priv->rw_screen);
@@ -1050,12 +1051,47 @@ auto_configure_outputs (GsdXrandrManager *manager, guint32 timestamp)
x += output->width;
}
- /* Apply the configuration! */
+ /* Check if we have a large enough framebuffer size. If not, turn off
+ * outputs from right to left until we reach a usable size.
+ */
- error = NULL;
- if (!gnome_rr_config_apply_with_time (config, priv->rw_screen, timestamp, &error)) {
- error_message (manager, _("Could not switch the monitor configuration"), error, NULL);
+ just_turned_on = g_list_reverse (just_turned_on); /* now the outputs here are from right to left */
+
+ l = just_turned_on;
+ while (1) {
+ GnomeOutputInfo *output;
+ gboolean is_bounds_error;
+
+ error = NULL;
+ applicable = gnome_rr_config_applicable (config, priv->rw_screen, &error);
+
+ if (applicable)
+ break;
+
+ is_bounds_error = g_error_matches (error, GNOME_RR_ERROR, GNOME_RR_ERROR_BOUNDS_ERROR);
g_error_free (error);
+
+ if (!is_bounds_error)
+ break;
+
+ if (l) {
+ i = GPOINTER_TO_INT (l->data);
+ l = l->next;
+
+ output = config->outputs[i];
+ output->on = FALSE;
+ } else
+ break;
+ }
+
+ /* Apply the configuration! */
+
+ if (applicable) {
+ error = NULL;
+ if (!gnome_rr_config_apply_with_time (config, priv->rw_screen, timestamp, &error)) {
+ error_message (manager, _("Could not switch the monitor configuration"), error, NULL);
+ g_error_free (error);
+ }
}
g_list_free (just_turned_on);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]