diff options
author | Felipe Heidrich <fheidric> | 2004-11-05 17:52:15 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2004-11-05 17:52:15 +0000 |
commit | 33e1f4f3c70684709bc0996ba63e176ff54136fb (patch) | |
tree | 48a906f4acf67736d9039f0ae61cfce5309815ff /bundles/org.eclipse.swt | |
parent | d4ae5e0d336ed1fdebf316bc3cb16a706e336773 (diff) | |
download | eclipse.platform.swt-33e1f4f3c70684709bc0996ba63e176ff54136fb.tar.gz eclipse.platform.swt-33e1f4f3c70684709bc0996ba63e176ff54136fb.tar.xz eclipse.platform.swt-33e1f4f3c70684709bc0996ba63e176ff54136fb.zip |
77530
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java | 18 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java | 18 |
2 files changed, 28 insertions, 8 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); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index f389f8d38c..877fd488e2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -1967,16 +1967,26 @@ 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. + */ if (!(0 <= index && index < itemCount)) return; TableItem item = _getItem (index); int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle); 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, item.handle); OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); OS.gtk_tree_path_free (path); } |