summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2004-11-05 17:52:15 +0000
committerFelipe Heidrich <fheidric>2004-11-05 17:52:15 +0000
commit33e1f4f3c70684709bc0996ba63e176ff54136fb (patch)
tree48a906f4acf67736d9039f0ae61cfce5309815ff /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
parentd4ae5e0d336ed1fdebf316bc3cb16a706e336773 (diff)
downloadeclipse.platform.swt-33e1f4f3c70684709bc0996ba63e176ff54136fb.tar.gz
eclipse.platform.swt-33e1f4f3c70684709bc0996ba63e176ff54136fb.tar.xz
eclipse.platform.swt-33e1f4f3c70684709bc0996ba63e176ff54136fb.zip
77530
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index fbe8c4c349..02bcaf74f7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -1148,10 +1148,10 @@ public void selectAll () {
void selectFocusIndex (int index) {
/*
- * Note that this method both selects and sets the focus to the
- * specified index, so any previous selection in the list will be lost.
- * gtk does not provide a way to just set focus to a specified list item.
- */
+ * Note that this method both selects and sets the focus to the
+ * specified index, so any previous selection in the list will be lost.
+ * gtk does not provide a way to just set focus to a specified list item.
+ */
int count = OS.gtk_tree_model_iter_n_children (modelHandle, 0);
if (!(0 <= index && index < count)) return;
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
@@ -1160,6 +1160,16 @@ void selectFocusIndex (int index) {
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_view_set_cursor (handle, path, 0, false);
+ /*
+ * Bug in GTK. For some reason, when an event loop is run from
+ * within a key pressed handler and a dialog is displayed that
+ * contains a GtkTreeView, gtk_tree_view_set_cursor() does
+ * not set the cursor or select the item. The fix is to select the
+ * item with gtk_tree_selection_select_iter() as well.
+ *
+ * NOTE: This happens in GTK 2.2.1 and is fixed in GTK 2.2.4.
+ */
+ OS.gtk_tree_selection_select_iter (selection, iter);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_path_free (path);
OS.g_free (iter);