From bae07700a18db0a462d37f0558063aaa9040ed3d Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Sun, 4 Apr 2010 18:11:37 +0200 Subject: [PATCH] shell_global_get_primary_monitor: Use variable to store number of monitors See https://bugzilla.gnome.org/show_bug.cgi?id=608647#c5 (forgot to add it before commiting). --- src/shell-global.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell-global.c b/src/shell-global.c index 92855c5c3..8077b9d1f 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1107,8 +1107,9 @@ shell_global_get_primary_monitor (ShellGlobal *global) GdkRectangle rect; gint i, primary = 0; gchar *output_name = NULL; + gint num_monitors = gdk_screen_get_n_monitors (screen); - for (i = 0; i < gdk_screen_get_n_monitors (screen); i++) + for (i = 0; i < num_monitors; i++) { /* Prefer the laptop's internal screen if present */ output_name = gdk_screen_get_monitor_plug_name (screen, i);