Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-02-05 16:24:08 +0000
committerEric Williams2019-02-05 16:29:46 +0000
commit1befbecaf4583e81f9dfab38ecc4517fbaf36373 (patch)
treeb4a3b540a829520f1af364c269b0ef10ddcbc1d0
parent94bbab9593afe86192ce9ff1c7d23f9003c3ef5e (diff)
downloadeclipse.platform.swt-1befbecaf4583e81f9dfab38ecc4517fbaf36373.tar.gz
eclipse.platform.swt-1befbecaf4583e81f9dfab38ecc4517fbaf36373.tar.xz
eclipse.platform.swt-1befbecaf4583e81f9dfab38ecc4517fbaf36373.zip
Bug 544140: Endless calls to Tree.rendererGetPreferredWidthProc after
clicking on editable PropertySheetPage tree cell Only re-draw the headers of a Table/Tree widget when a scroll event has occurred. This narrows the use of gtk_widget_queue_draw() to the specific case that needs it. It also avoids triggering native callbacks as the enter Table/Tree does not need to be re-drawn. Tested using the Bug535978_TableEditorHeader snippet as well as the snippet attached to this bug report. A cursory check in the IDE yields no regressions. Change-Id: Ia1d4bdf9a55f83658b13cc8c64219efbd1175097 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java26
3 files changed, 51 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 8e8dd7009c..e66f7a75c2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -1459,12 +1459,6 @@ void propagateDraw (long /*int*/ container, long /*int*/ cairo) {
temp = OS.g_list_next (temp);
}
OS.g_list_free (list);
- /*
- * Sometimes the sibling widget needs a draw event to remove any mis-drawn
- * widgets still remaining -- usually only happens when scrolling with the mouse
- * wheel. See bug 535978.
- */
- if (noChildDrawing != null) GTK.gtk_widget_queue_draw(handle);
}
}
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 98c5ade50a..ce861fcdb5 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
@@ -93,7 +93,7 @@ public class Table extends Composite {
double cachedAdjustment, currentAdjustment;
int pixbufHeight, pixbufWidth;
int headerHeight;
- boolean boundsChangedSinceLastDraw, headerVisible;
+ boolean boundsChangedSinceLastDraw, headerVisible, wasScrolled;
boolean rowActivated;
static final int CHECKED_COLUMN = 0;
@@ -2292,6 +2292,14 @@ long /*int*/ gtk_row_inserted (long /*int*/ model, long /*int*/ path, long /*int
}
return 0;
}
+
+@Override
+long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) {
+ long /*int*/ result = super.gtk_scroll_event(widget, eventPtr);
+ if (!wasScrolled) wasScrolled = true;
+ return result;
+}
+
@Override
long /*int*/ gtk_start_interactive_search(long /*int*/ widget) {
if (!searchEnabled()) {
@@ -2485,6 +2493,23 @@ long /*int*/ paintWindow () {
return GTK.gtk_tree_view_get_bin_window (handle);
}
+@Override
+void propagateDraw (long /*int*/ container, long /*int*/ cairo) {
+ /*
+ * Sometimes Tree/Table headers need to be re-drawn, as some of the
+ * "noChildDrawing" widgets might still be partially drawn.
+ */
+ super.propagateDraw(container, cairo);
+ if (headerVisible && noChildDrawing != null && wasScrolled) {
+ for (TableColumn column : columns) {
+ if (column != null) {
+ GTK.gtk_widget_queue_draw(column.buttonHandle);
+ }
+ }
+ wasScrolled = false;
+ }
+}
+
void recreateRenderers () {
if (checkRenderer != 0) {
display.removeWidget (checkRenderer);
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 a96dc3cb05..8f55befaf1 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
@@ -100,7 +100,7 @@ public class Tree extends Composite {
double cachedAdjustment, currentAdjustment;
Color headerBackground, headerForeground;
String headerCSSBackground, headerCSSForeground;
- boolean boundsChangedSinceLastDraw;
+ boolean boundsChangedSinceLastDraw, wasScrolled;
boolean rowActivated;
static final int ID_COLUMN = 0;
@@ -2394,6 +2394,13 @@ long /*int*/ gtk_row_inserted (long /*int*/ model, long /*int*/ path, long /*int
}
@Override
+long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) {
+ long /*int*/ result = super.gtk_scroll_event(widget, eventPtr);
+ if (!wasScrolled) wasScrolled = true;
+ return result;
+}
+
+@Override
long /*int*/ gtk_start_interactive_search(long /*int*/ widget) {
if (!searchEnabled()) {
OS.g_signal_stop_emission_by_name(widget, OS.start_interactive_search);
@@ -2658,6 +2665,23 @@ long /*int*/ paintWindow () {
return GTK.gtk_tree_view_get_bin_window (handle);
}
+@Override
+void propagateDraw (long /*int*/ container, long /*int*/ cairo) {
+ /*
+ * Sometimes Tree/Table headers need to be re-drawn, as some of the
+ * "noChildDrawing" widgets might still be partially drawn.
+ */
+ super.propagateDraw(container, cairo);
+ if (headerVisible && noChildDrawing != null && wasScrolled) {
+ for (TreeColumn column : columns) {
+ if (column != null) {
+ GTK.gtk_widget_queue_draw(column.buttonHandle);
+ }
+ }
+ wasScrolled = false;
+ }
+}
+
void recreateRenderers () {
if (checkRenderer != 0) {
display.removeWidget (checkRenderer);

Back to the top