From 179d1473854f4864ca8c2f03d34b9dab242c7597 Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Thu, 17 Dec 2015 12:25:06 -0500 Subject: [PATCH 1/1] 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 --- .../tmf/ui/widgets/timegraph/TimeGraphCombo.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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. */ -- 2.34.1