diff options
3 files changed, 158 insertions, 22 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 6e74071256..21a5318ad1 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 @@ -214,6 +214,30 @@ void createHandle (int index) { int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); if ((style & SWT.BORDER) != 0) OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); + /* + * Bug in GTK. When a treeview is the child of an override shell, + * and if the user has ever invokes the interactive search field, + * and the treeview is disposed on a focus out event, it segment + * faults. The fix is to disable the search field in an override + * shell. + */ + if ((getShell ().style & SWT.ON_TOP) != 0) { + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } + } } public Point computeSize (int wHint, int hHint, boolean changed) { 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 6124f132a2..9a99b430bd 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 @@ -561,11 +561,25 @@ void createColumn (TableColumn column, int index) { column.handle = columnHandle; column.modelIndex = modelIndex; } - /* Set the search column whenever the model changes */ + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } else { + /* Set the search column whenever the model changes */ int firstColumn = columnCount == 0 ? FIRST_COLUMN : columns [0].modelIndex; OS.gtk_tree_view_set_search_column (handle, firstColumn + CELL_TEXT); } @@ -600,13 +614,27 @@ void createHandle (int index) { int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); if ((style & SWT.BORDER) != 0) OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { /* The fixed_height_mode property only exists in GTK 2.3.2 and greater */ if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2)) { OS.g_object_set (handle, OS.fixed_height_mode, true, 0); } - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } } @@ -989,11 +1017,25 @@ void destroyItem (TableColumn column) { createRenderers (checkColumn.handle, checkColumn.modelIndex, true, checkColumn.style); } } - /* Set the search column whenever the model changes */ + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } else { + /* Set the search column whenever the model changes */ int firstColumn = columnCount == 0 ? FIRST_COLUMN : columns [0].modelIndex; OS.gtk_tree_view_set_search_column (handle, firstColumn + CELL_TEXT); } @@ -2259,11 +2301,25 @@ public void removeAll () { OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); resetCustomDraw (); - /* Set the search column whenever the model changes */ + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)){ + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } else { + /* Set the search column whenever the model changes */ int firstColumn = columnCount == 0 ? FIRST_COLUMN : columns [0].modelIndex; OS.gtk_tree_view_set_search_column (handle, firstColumn + CELL_TEXT); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index f87bca0325..1d575e23ab 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -629,11 +629,25 @@ void createColumn (TreeColumn column, int index) { column.handle = columnHandle; column.modelIndex = modelIndex; } - /* Set the search column whenever the model changes */ + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } else { + /* Set the search column whenever the model changes */ int firstColumn = columnCount == 0 ? FIRST_COLUMN : columns [0].modelIndex; OS.gtk_tree_view_set_search_column (handle, firstColumn + CELL_TEXT); } @@ -668,13 +682,27 @@ void createHandle (int index) { int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); if ((style & SWT.BORDER) != 0) OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { /* The fixed_height_mode property only exists in GTK 2.3.2 and greater */ if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2)) { OS.g_object_set (handle, OS.fixed_height_mode, true, 0); } - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search(handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + }; } } @@ -951,11 +979,25 @@ void destroyItem (TreeColumn column) { createRenderers (firstColumn.handle, firstColumn.modelIndex, true, firstColumn.style); } } - /* Set the search column whenever the model changes */ + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } else { + /* Set the search column whenever the model changes */ int firstColumn = columnCount == 0 ? FIRST_COLUMN : columns [0].modelIndex; OS.gtk_tree_view_set_search_column (handle, firstColumn + CELL_TEXT); } @@ -2195,11 +2237,25 @@ public void removeAll () { modelHandle = newModel; OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); - /* Set the search column whenever the model changes */ + /* Disable searching when using VIRTUAL */ if ((style & SWT.VIRTUAL) != 0) { - /* Disable searching when using VIRTUAL */ - OS.gtk_tree_view_set_enable_search (handle, false); + /* + * Bug in GTK. Until GTK 2.6.5, calling gtk_tree_view_set_enable_search(FALSE) + * would prevent the user from being able to type in text to search the tree. + * After 2.6.5, GTK introduced Ctrl+F as being the key binding for interactive + * search. This meant that even if FALSE was passed to enable_search, the user + * can still bring up the search pop up using the keybinding. GTK also introduced + * the notion of passing a -1 to gtk_set_search_column to disable searching + * (including the search key binding). The fix is to use the right calls + * for the right version. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 6, 5)) { + OS.gtk_tree_view_set_search_column (handle, -1); + } else { + OS.gtk_tree_view_set_enable_search (handle, false); + } } else { + /* Set the search column whenever the model changes */ int firstColumn = columnCount == 0 ? FIRST_COLUMN : columns [0].modelIndex; OS.gtk_tree_view_set_search_column (handle, firstColumn + CELL_TEXT); } |