From 350ac7ea12c381dc5115e0a240d8a8f062c62ae4 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Fri, 28 May 2010 19:52:45 +0000
Subject: [PATCH] fixes for old systems

---
 config.h.in           | 3 +++
 configure             | 6 ++++++
 configure.ac          | 4 ++++
 src/common/hostlist.c | 5 +++++
 src/sview/sview.c     | 6 +++++-
 5 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/config.h.in b/config.h.in
index fd9f1e66c17..58985bf9f5b 100644
--- a/config.h.in
+++ b/config.h.in
@@ -27,6 +27,9 @@
 /* Define to 1 if licensed under terms of the GNU General Public License. */
 #undef GPL_LICENSED
 
+/* Define to 1 if using gtk+-2.14.0 or higher */
+#undef GTK2_USE_GET_FOCUS
+
 /* Define to 1 if using gtk+-2.10.0 or higher */
 #undef GTK2_USE_RADIO_SET
 
diff --git a/configure b/configure
index b720279a014..29ff293010a 100755
--- a/configure
+++ b/configure
@@ -18646,6 +18646,12 @@ if test ${gtk_config_minor_version=0} -gt 12 ; then
 
 $as_echo "#define GTK2_USE_TOOLTIP 1" >>confdefs.h
 
+fi
+
+if test ${gtk_config_minor_version=0} -gt 14 ; then
+
+$as_echo "#define GTK2_USE_GET_FOCUS 1" >>confdefs.h
+
 fi
 
 
diff --git a/configure.ac b/configure.ac
index daa1d647ab9..737f909cb15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -189,6 +189,10 @@ if test ${gtk_config_minor_version=0} -gt 12 ; then
        AC_DEFINE([GTK2_USE_TOOLTIP], 1, [Define to 1 if using gtk+-2.12.0 or higher])
 fi
 
+if test ${gtk_config_minor_version=0} -gt 14 ; then
+       AC_DEFINE([GTK2_USE_GET_FOCUS], 1, [Define to 1 if using gtk+-2.14.0 or higher])
+fi
+
 
 X_AC_DATABASES
 
diff --git a/src/common/hostlist.c b/src/common/hostlist.c
index f52ca3a4e68..2aeefcc3930 100644
--- a/src/common/hostlist.c
+++ b/src/common/hostlist.c
@@ -2587,6 +2587,11 @@ void hostlist_parse_int_to_array(int in, int *out, int dims, int hostlist_base)
 			my_pow = my_pow_minus;
 			my_pow_minus /= hostlist_base;
 		}
+		if(out[a] < 0) {
+			fatal("Dim %d returned negitive %d from %d %d %d",
+			      a, out[a], in, my_pow, my_pow_minus);
+			out[a] = 0;
+		}
 	}
 }
 
diff --git a/src/sview/sview.c b/src/sview/sview.c
index fccc66b4b96..733bd616684 100644
--- a/src/sview/sview.c
+++ b/src/sview/sview.c
@@ -930,12 +930,16 @@ extern void _change_cluster_main(GtkComboBox *combo, gpointer extra)
 		GTK_NOTEBOOK(main_notebook), NODE_PAGE);
 	node_tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(main_notebook),
 					      node_tab);
+
+#ifdef GTK2_USE_GET_FOCUS
 	/* ok, now we have a table which we have set up to contain an
 	 * event_box which contains the label we are interested.  We
 	 * setup this label to be the focus child of the table, so all
 	 * we have to do is grab that and we are set. */
 	node_tab = gtk_container_get_focus_child(GTK_CONTAINER(node_tab));
-
+#else
+	g_object_get(node_tab, "child", &node_tab, NULL);
+#endif
 	if(node_tab)
 		gtk_label_set_text(GTK_LABEL(node_tab),
 				   main_display_data[NODE_PAGE].name);
-- 
GitLab