tmf: Fix time scale not visible at first in Control Flow view (GTK3)
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 7 May 2015 22:37:10 +0000 (18:37 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Sat, 9 May 2015 05:10:27 +0000 (01:10 -0400)
Bug 466791
Change-Id: Ide2431eb9a48f5430e04f53bd3d76c28c03577d3
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/47505
Reviewed-by: Hudson CI
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphScale.java

index fa813bd3ed4fa813782edc762153d5754fc69c35..3ac8dda27bf8087fe2a8f2295b4767f778e36614 100644 (file)
@@ -395,8 +395,6 @@ public class TimeGraphCombo extends Composite {
 
         // Feature in Windows. The tree vertical bar reappears when
         // the control is resized so we need to hide it again.
-        // Bug in Linux. The tree header height is 0 in constructor,
-        // so we need to reset it later when the control is resized.
         tree.addControlListener(new ControlAdapter() {
             private int depth = 0;
             @Override
@@ -408,7 +406,20 @@ public class TimeGraphCombo extends Composite {
                     tree.getVerticalBar().setVisible(false);
                     depth--;
                 }
-                fTimeGraphViewer.setHeaderHeight(tree.getHeaderHeight());
+            }
+        });
+        // Bug in Linux. The tree header height is 0 in constructor,
+        // so we need to reset it later when the control is painted.
+        // This work around used to be done on control resized but the header
+        // height was not initialized on the initial resize on GTK3.
+        tree.addPaintListener(new PaintListener() {
+            @Override
+            public void paintControl(PaintEvent e) {
+                int headerHeight = tree.getHeaderHeight();
+                if (headerHeight > 0) {
+                    fTimeGraphViewer.setHeaderHeight(headerHeight);
+                    tree.removePaintListener(this);
+                }
             }
         });
 
index 70343ed80aa379c339b882c4fdee760dc90cabae..e3b7f59eb003d357fee01dcf7d6e789cde55cb4e 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
@@ -170,7 +171,10 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
      *            The height to use
      */
     public void setHeight(int height) {
-        this.fHeight = height;
+        if (fHeight != height) {
+            fHeight = height;
+            getParent().layout(new Control[] { this });
+        }
     }
 
     /**
This page took 0.057792 seconds and 5 git commands to generate.