diff options
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java | 9 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | 9 |
2 files changed, 16 insertions, 2 deletions
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 e3f873b043..5b6728bd60 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 @@ -2890,6 +2890,7 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /* void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) { TableItem item = null; + boolean wasSelected = false; long /*int*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2); if (iter != 0) { long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); @@ -2968,7 +2969,12 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo if (hooks (SWT.EraseItem)) { - boolean wasSelected = (drawState & SWT.SELECTED) != 0; + /* + * Cache the selection state so that it is not lost if a + * PaintListener wants to draw custom selection foregrounds. + * See bug 528155. + */ + wasSelected = (drawState & SWT.SELECTED) != 0; if (wasSelected) { Control control = findBackgroundControl (); if (control == null) control = this; @@ -3082,6 +3088,7 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo if (item != null) { if (OS.GTK_IS_CELL_RENDERER_TEXT (cell)) { if (hooks (SWT.PaintItem)) { + if (wasSelected) drawState |= SWT.SELECTED; GdkRectangle rect = new GdkRectangle (); long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); OS.gtk_tree_view_get_background_area (handle, path, columnHandle, rect); 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 130ec4bed2..d81078a6b9 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 @@ -2946,6 +2946,7 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /* void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) { TreeItem item = null; + boolean wasSelected = false; long /*int*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2); if (iter != 0) item = _getItem (iter); long /*int*/ columnHandle = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX1); @@ -3016,7 +3017,12 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo if (textRenderer != 0) gtk_cell_renderer_get_preferred_size (textRenderer, handle, null, null); if (hooks (SWT.EraseItem)) { - boolean wasSelected = (drawState & SWT.SELECTED) != 0; + /* + * Cache the selection state so that it is not lost if a + * PaintListener wants to draw custom selection foregrounds. + * See bug 528155. + */ + wasSelected = (drawState & SWT.SELECTED) != 0; if (wasSelected) { Control control = findBackgroundControl (); if (control == null) control = this; @@ -3120,6 +3126,7 @@ void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, lo if (item != null) { if (OS.GTK_IS_CELL_RENDERER_TEXT (cell)) { if (hooks (SWT.PaintItem)) { + if (wasSelected) drawState |= SWT.SELECTED; GdkRectangle rect = new GdkRectangle (); long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter); OS.gtk_tree_view_get_cell_area (handle, path, columnHandle, rect); |