From: Patrick Tasse Date: Thu, 17 Dec 2015 17:25:06 +0000 (-0500) Subject: tmf: Fix GTK bug when setting top item after changing tree font X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=179d1473854f4864ca8c2f03d34b9dab242c7597;p=deliverable%2Ftracecompass.git tmf: Fix GTK bug when setting top item after changing tree font Change-Id: If2658c1bdcd98f6a34ce31a76af0dc57c959de2c Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/62953 Reviewed-by: Hudson CI Reviewed-by: Marc-Andre Laperle Tested-by: Marc-Andre Laperle --- diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java index 745d156a42..47b9ef26eb 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java @@ -1248,6 +1248,16 @@ public class TimeGraphCombo extends Composite { tree.removePaintListener(this); doAlignTreeItems(); redraw(); + /* + * Bug in GTK. Calling setTopItem() can scroll to the wrong item + * when the 'tree view' is dirty. Set it again once it is clean. + */ + if (SWT.getPlatform().equals("gtk")) { //$NON-NLS-1$ + TreeItem topItem = tree.getTopItem(); + tree.getDisplay().asyncExec(() -> { + tree.setTopItem(topItem); + }); + } } }); /* Make sure the paint event is triggered. */