From 5d74999766f9e86d70ddcdddef0aa7477038ff84 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Sat, 13 Jul 2013 10:44:23 +0300 Subject: Remove hacks for GtkTree from pre Gtk 2.10. --- .../gtk/org/eclipse/swt/widgets/List.java | 17 -- .../gtk/org/eclipse/swt/widgets/Table.java | 17 -- .../gtk/org/eclipse/swt/widgets/TableItem.java | 106 ------------ .../gtk/org/eclipse/swt/widgets/Tree.java | 32 ---- .../gtk/org/eclipse/swt/widgets/TreeItem.java | 178 --------------------- 5 files changed, 350 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 cbaabb6fa1..3d260e275f 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 @@ -1480,23 +1480,6 @@ public void setTopIndex (int index) { OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, index); long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0, 0); - if (OS.GTK_VERSION < OS.VERSION (2, 8, 0)) { - /* - * Bug in GTK. According to the documentation, gtk_tree_view_scroll_to_cell - * should vertically scroll the cell to the top if use_align is true and row_align is 0. - * However, prior to version 2.8 it does not scroll at all. The fix is to determine - * the new location and use gtk_tree_view_scroll_to_point. - * If the widget is a pinhead, calling gtk_tree_view_scroll_to_point - * will have no effect. Therefore, it is still neccessary to call - * gtk_tree_view_scroll_to_cell. - */ - OS.gtk_widget_realize (handle); - GdkRectangle cellRect = new GdkRectangle (); - OS.gtk_tree_view_get_cell_area (handle, path, 0, cellRect); - int[] tx = new int[1], ty = new int[1]; - OS.gtk_tree_view_widget_to_tree_coords(handle, cellRect.x, cellRect.y, tx, ty); - OS.gtk_tree_view_scroll_to_point (handle, -1, ty[0]); - } 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 2a8d1e5c7f..739e271191 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 @@ -3426,23 +3426,6 @@ public void setTopIndex (int index) { if (!(0 <= index && index < itemCount)) return; long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, _getItem (index).handle); OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0f, 0f); - if (OS.GTK_VERSION < OS.VERSION (2, 8, 0)) { - /* - * Bug in GTK. According to the documentation, gtk_tree_view_scroll_to_cell - * should vertically scroll the cell to the top if use_align is true and row_align is 0. - * However, prior to version 2.8 it does not scroll at all. The fix is to determine - * the new location and use gtk_tree_view_scroll_to_point. - * If the widget is a pinhead, calling gtk_tree_view_scroll_to_point - * will have no effect. Therefore, it is still neccessary to call - * gtk_tree_view_scroll_to_cell. - */ - OS.gtk_widget_realize (handle); - GdkRectangle cellRect = new GdkRectangle (); - OS.gtk_tree_view_get_cell_area (handle, path, 0, cellRect); - int[] tx = new int[1], ty = new int[1]; - OS.gtk_tree_view_widget_to_tree_coords(handle, cellRect.x, cellRect.y, tx, ty); - OS.gtk_tree_view_scroll_to_point (handle, -1, ty[0]); - } OS.gtk_tree_path_free (path); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java index 39ac93ffbf..bcc009b028 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java @@ -221,16 +221,6 @@ void clear () { for (int i=Table.FOREGROUND_COLUMN; i rect.x + rect.width; } else { @@ -2676,15 +2670,6 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo OS.gtk_tree_view_get_cell_area (handle, path, columnHandle, rect); OS.gtk_tree_view_get_background_area (handle, path, columnHandle, clipRect); OS.gtk_tree_path_free (path); - if (OS.GTK_VERSION < OS.VERSION (2, 8, 18) && OS.gtk_tree_view_get_expander_column (handle) == columnHandle) { - int [] buffer = new int [1]; - OS.gtk_widget_style_get (handle, OS.expander_size, buffer, 0); - rect.x += buffer [0] + TreeItem.EXPANDER_EXTRA_PADDING; - rect.width -= buffer [0] + TreeItem.EXPANDER_EXTRA_PADDING; - //OS.gtk_widget_style_get (handle, OS.horizontal_separator, buffer, 0); - //rect.x += buffer[0]; - //rect.width -= buffer [0]; // TODO Is this required for some versions? - } ignoreSize = true; int [] contentX = new int [1], contentWidth = new int [1]; gtk_cell_renderer_get_preferred_size (cell, handle, contentWidth, null); @@ -3253,23 +3238,6 @@ public void setTopItem (TreeItem item) { long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle); showItem (path, false); OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0f, 0f); - if (OS.GTK_VERSION < OS.VERSION (2, 8, 0)) { - /* - * Bug in GTK. According to the documentation, gtk_tree_view_scroll_to_cell - * should vertically scroll the cell to the top if use_align is true and row_align is 0. - * However, prior to version 2.8 it does not scroll at all. The fix is to determine - * the new location and use gtk_tree_view_scroll_to_point. - * If the widget is a pinhead, calling gtk_tree_view_scroll_to_point - * will have no effect. Therefore, it is still neccessary to call - * gtk_tree_view_scroll_to_cell. - */ - OS.gtk_widget_realize (handle); - GdkRectangle cellRect = new GdkRectangle (); - OS.gtk_tree_view_get_cell_area (handle, path, 0, cellRect); - int[] tx = new int[1], ty = new int[1]; - OS.gtk_tree_view_widget_to_tree_coords(handle, cellRect.x, cellRect.y, tx, ty); - OS.gtk_tree_view_scroll_to_point (handle, -1, ty[0]); - } OS.gtk_tree_path_free (path); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java index b630d19caa..08e28b2fd6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java @@ -302,16 +302,6 @@ void clear () { for (int i=Tree.FOREGROUND_COLUMN; i