diff options
author | Veronika Irvine <veronika> | 2006-02-13 22:45:05 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2006-02-13 22:45:05 +0000 |
commit | e6b45546639e64b93ec66b49a61667a587a95198 (patch) | |
tree | 72dc31857864def5269c33c00564c439b8f24a78 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java | |
parent | 87ca0b2c9048c87ab1533b549c17948e0d1b70ec (diff) | |
download | eclipse.platform.swt-e6b45546639e64b93ec66b49a61667a587a95198.tar.gz eclipse.platform.swt-e6b45546639e64b93ec66b49a61667a587a95198.tar.xz eclipse.platform.swt-e6b45546639e64b93ec66b49a61667a587a95198.zip |
Bug 126966 more bad drawing when scrolling
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java | 85 |
1 files changed, 51 insertions, 34 deletions
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 84ab3c443e..1fc6277b5a 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 @@ -133,26 +133,15 @@ void clear () { OS.gtk_list_store_set (parent.modelHandle, handle, i, 0, -1); } /* - * Bug in GTK. When using fixed-height-mode on versions before 2.6.3, + * Bug in GTK. When using fixed-height-mode, * row changes do not cause the row to be repainted. The fix is to * invalidate the row when it is cleared. */ if ((parent.style & SWT.VIRTUAL) != 0) { - if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2) && OS.GTK_VERSION < OS.VERSION (2, 6, 3)) { - if ((OS.GTK_WIDGET_FLAGS (parent.handle) & OS.GTK_REALIZED) != 0) { - int /*long*/ parentHandle = parent.handle; - int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle); - GdkRectangle rect = new GdkRectangle (); - OS.gtk_tree_view_get_cell_area (parentHandle, path, 0, rect); - OS.gtk_tree_path_free (path); - int /*long*/ window = OS.gtk_tree_view_get_bin_window (parentHandle); - rect.x = 0; - rect.width = OS.GTK_WIDGET_WIDTH (parentHandle); - OS.gdk_window_invalidate_rect (window, rect, false); - } + if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2)) { + redraw (); } } - } cached = false; font = null; @@ -555,6 +544,22 @@ public String getText (int index) { return new String (Converter.mbcsToWcs (null, buffer)); } +void redraw () { + if ((OS.GTK_WIDGET_FLAGS (parent.handle) & OS.GTK_REALIZED) != 0) { + int /*long*/ parentHandle = parent.handle; + int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle); + GdkRectangle rect = new GdkRectangle (); + OS.gtk_tree_view_get_cell_area (parentHandle, path, 0, rect); + OS.gtk_tree_path_free (path); + int /*long*/ window = OS.gtk_tree_view_get_bin_window (parentHandle); + rect.x = 0; + int [] w = new int [1], h = new int [1]; + OS.gdk_drawable_get_size (window, w, h); + rect.width = w [0]; + OS.gdk_window_invalidate_rect (window, rect, false); + } +} + void releaseHandle () { if (handle != 0) OS.g_free (handle); handle = 0; @@ -908,27 +913,34 @@ public void setImage (int index, Image image) { } int modelIndex = parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_list_store_set (parent.modelHandle, handle, modelIndex + Table.CELL_PIXBUF, pixbuf, -1); - if (image != null) { - int /*long*/parentHandle = parent.handle; - int /*long*/ column = OS.gtk_tree_view_get_column (parentHandle, index); - if (OS.gtk_tree_view_column_get_sizing (column) == OS.GTK_TREE_VIEW_COLUMN_FIXED) { - parent.setScrollWidth (column, this); + if ((parent.style & SWT.VIRTUAL) != 0) { + if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2)) { + /* + * Bug in GTK. When using fixed-height-mode, + * row changes do not cause the row to be repainted. The fix is to + * invalidate the row when it is cleared. + */ + redraw (); /* * Bug in GTK. When in fixed height mode, GTK does not recalculate the cell renderer width * when the image is changed in the model. The fix is to force it to recalculate the width if * more space is required. */ - int [] w = new int [1]; - int /*long*/ pixbufRenderer = parent.getPixbufRenderer(column); - OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, null, w); - if (w[0] < image.getBounds().width) { - /* - * There is no direct way to clear the cell renderer width so we - * are relying on the fact that it is done as part of modifying - * the style. - */ - int /*long*/ style = OS.gtk_widget_get_modifier_style (parentHandle); - OS.gtk_widget_modify_style (parentHandle, style); + if (image != null) { + int /*long*/parentHandle = parent.handle; + int /*long*/ column = OS.gtk_tree_view_get_column (parentHandle, index); + int [] w = new int [1]; + int /*long*/ pixbufRenderer = parent.getPixbufRenderer(column); + OS.gtk_tree_view_column_cell_get_position (column, pixbufRenderer, null, w); + if (w[0] < image.getBounds().width) { + /* + * There is no direct way to clear the cell renderer width so we + * are relying on the fact that it is done as part of modifying + * the style. + */ + int /*long*/ style = OS.gtk_widget_get_modifier_style (parentHandle); + OS.gtk_widget_modify_style (parentHandle, style); + } } } } @@ -1004,10 +1016,15 @@ public void setText (int index, String string) { byte[] buffer = Converter.wcsToMbcs (null, string, true); int modelIndex = parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_list_store_set (parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, buffer, -1); - int /*long*/parentHandle = parent.handle; - int /*long*/ column = OS.gtk_tree_view_get_column (parentHandle, index); - if (OS.gtk_tree_view_column_get_sizing (column) == OS.GTK_TREE_VIEW_COLUMN_FIXED) { - parent.setScrollWidth (column, this); + /* + * Bug in GTK. When using fixed-height-mode, + * row changes do not cause the row to be repainted. The fix is to + * invalidate the row when it is cleared. + */ + if ((parent.style & SWT.VIRTUAL) != 0) { + if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2)) { + redraw (); + } } cached = true; } |