[gnome-control-center/gnome-2-28] bgo#593866 - Don't assert when the current output doesn't have a resolution set yet
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-2-28] bgo#593866 - Don't assert when the current output doesn't have a resolution set yet
- Date: Tue, 20 Oct 2009 19:28:40 +0000 (UTC)
commit 41c5405976978ec23339d89d3857c3793955ed43
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 19 13:57:27 2009 -0500
bgo#593866 - Don't assert when the current output doesn't have a resolution set yet
Signed-off-by: Federico Mena Quintero <federico novell com>
capplets/display/xrandr-capplet.c | 53 ++++++++++++++++++++----------------
1 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index f21857c..5a8b5b1 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -512,6 +512,29 @@ make_resolution_string (int width, int height)
}
static void
+find_best_mode (GnomeRRMode **modes, int *out_width, int *out_height)
+{
+ int i;
+
+ *out_width = 0;
+ *out_height = 0;
+
+ for (i = 0; modes[i] != NULL; i++)
+ {
+ int w, h;
+
+ w = gnome_rr_mode_get_width (modes[i]);
+ h = gnome_rr_mode_get_height (modes[i]);
+
+ if (w * h > *out_width * *out_height)
+ {
+ *out_width = w;
+ *out_height = h;
+ }
+ }
+}
+
+static void
rebuild_resolution_combo (App *app)
{
int i;
@@ -548,7 +571,12 @@ rebuild_resolution_combo (App *app)
current = idle_free (make_resolution_string (app->current_output->width, app->current_output->height));
if (!combo_select (app->resolution_combo, current))
- g_assert_not_reached ();
+ {
+ int best_w, best_h;
+
+ find_best_mode (modes, &best_w, &best_h);
+ combo_select (app->resolution_combo, idle_free (make_resolution_string (best_w, best_h)));
+ }
}
static void
@@ -654,29 +682,6 @@ on_rate_changed (GtkComboBox *box, gpointer data)
}
static void
-find_best_mode (GnomeRRMode **modes, int *out_width, int *out_height)
-{
- int i;
-
- *out_width = 0;
- *out_height = 0;
-
- for (i = 0; modes[i] != NULL; i++)
- {
- int w, h;
-
- w = gnome_rr_mode_get_width (modes[i]);
- h = gnome_rr_mode_get_height (modes[i]);
-
- if (w * h > *out_width * *out_height)
- {
- *out_width = w;
- *out_height = h;
- }
- }
-}
-
-static void
select_resolution_for_current_output (App *app)
{
GnomeRRMode **modes;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]