diff options
| author | Alexander Kurtakov | 2012-01-20 09:40:01 +0000 |
|---|---|---|
| committer | Silenio Quarti | 2012-01-20 20:28:48 +0000 |
| commit | a5730346b2941e8fcd1f3e126cea623d204e89ab (patch) | |
| tree | 6af41f8916b7a556276762841b9e107a4f02fddc | |
| parent | fa5f2489bdf14a8636f01b8292ce465b8e1cfb0a (diff) | |
| download | eclipse.platform.swt-a5730346b2941e8fcd1f3e126cea623d204e89ab.tar.gz eclipse.platform.swt-a5730346b2941e8fcd1f3e126cea623d204e89ab.tar.xz eclipse.platform.swt-a5730346b2941e8fcd1f3e126cea623d204e89ab.zip | |
Kill pre GTK 2.4 leftovers from List.
This cleanups the code and eases the task to remove deprecated gtk
functions usage.
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java | 55 |
1 files changed, 2 insertions, 53 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 5edfc18fec..7a2c305cc7 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 @@ -577,12 +577,6 @@ public String [] getSelection () { public int getSelectionCount () { checkWidget(); int /*long*/ selection = OS.gtk_tree_view_get_selection (handle); - if (OS.GTK_VERSION < OS.VERSION (2, 2, 0)) { - display.treeSelectionLength = 0; - display.treeSelection = null; - OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle); - return display.treeSelectionLength; - } return OS.gtk_tree_selection_count_selected_rows (selection); } @@ -600,20 +594,7 @@ public int getSelectionCount () { public int getSelectionIndex () { checkWidget(); int /*long*/ selection = OS.gtk_tree_view_get_selection (handle); - if (OS.GTK_VERSION < OS.VERSION (2, 2, 0)) { - int itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, 0); - display.treeSelectionLength = 0; - display.treeSelection = new int [itemCount]; - OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle); - if (display.treeSelectionLength == 0) return -1; - return display.treeSelection [0]; - } - /* - * Bug in GTK. gtk_tree_selection_get_selected_rows() segmentation faults - * in versions smaller than 2.2.4 if the model is NULL. The fix is - * to give a valid pointer instead. - */ - int /*long*/ [] model = OS.GTK_VERSION < OS.VERSION (2, 2, 4) ? new int /*long*/ [1] : null; + int /*long*/ [] model = null; int /*long*/ list = OS.gtk_tree_selection_get_selected_rows (selection, model); if (list != 0) { int count = OS.g_list_length (list); @@ -656,22 +637,7 @@ public int getSelectionIndex () { public int [] getSelectionIndices () { checkWidget(); int /*long*/ selection = OS.gtk_tree_view_get_selection (handle); - if (OS.GTK_VERSION < OS.VERSION (2, 2, 0)) { - int itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, 0); - display.treeSelectionLength = 0; - display.treeSelection = new int [itemCount]; - OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle); - if (display.treeSelectionLength == display.treeSelection.length) return display.treeSelection; - int [] result = new int [display.treeSelectionLength]; - System.arraycopy (display.treeSelection, 0, result, 0, display.treeSelectionLength); - return result; - } - /* - * Bug in GTK. gtk_tree_selection_get_selected_rows() segmentation faults - * in versions smaller than 2.2.4 if the model is NULL. The fix is - * to give a valid pointer instead. - */ - int /*long*/ [] model = OS.GTK_VERSION < OS.VERSION (2, 2, 4) ? new int /*long*/ [1] : null; + int /*long*/ [] model = null; int /*long*/ list = OS.gtk_tree_selection_get_selected_rows (selection, model); if (list != 0) { int count = OS.g_list_length (list); @@ -804,23 +770,6 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ result = super.gtk_key_press_event (widget, event); if (result != 0) return result; - if (OS.GTK_VERSION < OS.VERSION (2, 2 ,0)) { - /* - * Feature in GTK 2.0.x. When an item is default selected using - * the return key, GTK does not issue notification. The fix is - * to issue this notification when the return key is pressed. - */ - GdkEventKey keyEvent = new GdkEventKey (); - OS.memmove (keyEvent, event, GdkEventKey.sizeof); - int key = keyEvent.keyval; - switch (key) { - case OS.GDK_Return: - case OS.GDK_KP_Enter: { - sendSelectionEvent (SWT.DefaultSelection); - break; - } - } - } return result; } |
