diff options
author | Ian Pun | 2017-05-30 18:47:34 +0000 |
---|---|---|
committer | Eric Williams | 2017-06-19 15:57:43 +0000 |
commit | 21eb5f4d55cb2c376c33329aea0b9c471eab4ab4 (patch) | |
tree | 22f090caf9f0e848fd2da3cd7b71455d3f1432c1 | |
parent | 6522e9830ce20dc690d6fb44fb7fc7f800914bcb (diff) | |
download | eclipse.platform.swt-21eb5f4d55cb2c376c33329aea0b9c471eab4ab4.tar.gz eclipse.platform.swt-21eb5f4d55cb2c376c33329aea0b9c471eab4ab4.tar.xz eclipse.platform.swt-21eb5f4d55cb2c376c33329aea0b9c471eab4ab4.zip |
Bug 97863 - [consistency] dragging TableColumns fires too many control
events
There is now a new check on minimumResizeSignal which will only have
tableColumn check for move/resize if the widget isn't allocated to be a
1x1 size at position 0,0. This is to fix the issue of dragging
tabcolumns causing unreliable control event spam.
This can be tested through the snippet in Bug 97863 Comment 1.
Tested with AllNoneBrowserTests for GTK2, GTk3.22, 3.18, 3.14 with no
additional errors.
Change-Id: I06061df7c256644e2a9a8587d982f462796ca24c
Signed-off-by: Ian Pun <ipun@redhat.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java index 88482feb43..84197ebe47 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java @@ -393,13 +393,21 @@ long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) { useFixedWidth = false; GtkAllocation widgetAllocation = new GtkAllocation (); OS.gtk_widget_get_allocation (widget, widgetAllocation); + /* + * GTK Feature: gtk_size_allocate is not a reliable signal to tell if the resizes are correct. + * There is a phantom signal that is sent with size of 1x1 at x,y = 0,0 before sending out the + * correct size allocation signal during a drag. This check will prevent any excessive firing of + * control events. See bug 97863. + */ + boolean minimumResizeSignal = (widgetAllocation.width == 1 && widgetAllocation.height == 1); + boolean movingSignal = (widgetAllocation.x == 0 && widgetAllocation.y == 0); int x = widgetAllocation.x; int width = widgetAllocation.width; - if (x != lastX) { + if (x != lastX && !movingSignal) { lastX = x; sendEvent (SWT.Move); } - if (width != lastWidth) { + if (width != lastWidth && !minimumResizeSignal) { lastWidth = width; sendEvent (SWT.Resize); } |