Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2013-01-30 19:05:07 +0000
committerXavier Raynaud2013-04-05 08:00:06 +0000
commit6a420c08dd1c59f0afa126dddddbf28bab29d385 (patch)
tree21efd70ea8beeee8953df74176964ed40d0b4a58
parent801a5abf1466b7546508ef7bd180b61771c71d6d (diff)
downloadorg.eclipse.linuxtools-6a420c08dd1c59f0afa126dddddbf28bab29d385.tar.gz
org.eclipse.linuxtools-6a420c08dd1c59f0afa126dddddbf28bab29d385.tar.xz
org.eclipse.linuxtools-6a420c08dd1c59f0afa126dddddbf28bab29d385.zip
lttng/o.e.l.tmf.ui: disable menu detected event during mouse drag
Change-Id: I432296df9774862f1c56a58f3e8245c6ea226de7 Reviewed-on: https://git.eclipse.org/r/8709 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Xavier Raynaud <xavier.raynaud@kalray.eu> IP-Clean: Xavier Raynaud <xavier.raynaud@kalray.eu> Tested-by: Xavier Raynaud <xavier.raynaud@kalray.eu>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java
index a540aba409..b4fdd6d111 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java
@@ -115,6 +115,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
private final Cursor _dragCursor3;
private final Cursor _WaitCursor;
private final List<ViewerFilter> _filters = new ArrayList<ViewerFilter>();
+ private MenuDetectEvent fPendingMenuDetectEvent = null;
// Vertical formatting formatting for the state control view
private final boolean _visibleVerticalScroll = true;
@@ -1143,7 +1144,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
if (DRAG_SPLIT_LINE == _dragState) {
gc.setForeground(_colors.getColor(TimeGraphColorScheme.BLACK));
gc.drawLine(bounds.x + nameSpace, bounds.y, bounds.x + nameSpace, bounds.y + bounds.height - 1);
- } else if (DRAG_ZOOM == _dragState && Math.max(_dragX, _dragX0) > nameSpace) {
+ } else if (DRAG_ZOOM == _dragState && Math.max(_dragX, _dragX0) > nameSpace && _dragX != _dragX0) {
gc.setForeground(_colors.getColor(TimeGraphColorScheme.TOOL_FOREGROUND));
gc.drawLine(_dragX0, bounds.y, _dragX0, bounds.y + bounds.height - 1);
gc.drawLine(_dragX, bounds.y, _dragX, bounds.y + bounds.height - 1);
@@ -1738,6 +1739,9 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
@Override
public void mouseUp(MouseEvent e) {
+ if (fPendingMenuDetectEvent != null && e.button == 3) {
+ menuDetected(fPendingMenuDetectEvent);
+ }
if (DRAG_NONE != _dragState) {
setCapture(false);
if (e.button == 1 && DRAG_TRACE_ITEM == _dragState) {
@@ -2141,6 +2145,24 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
if (null == _timeProvider) {
return;
}
+ if (e.detail == SWT.MENU_MOUSE) {
+ if (fPendingMenuDetectEvent == null) {
+ /* Feature in Linux. The MenuDetectEvent is received before mouseDown.
+ * Store the event and trigger it later just before handling mouseUp.
+ * This allows for the method to detect if mouse is used to drag zoom.
+ */
+ fPendingMenuDetectEvent = e;
+ return;
+ }
+ fPendingMenuDetectEvent = null;
+ if (_dragState != DRAG_ZOOM || _dragX != _dragX0) {
+ return;
+ }
+ } else {
+ if (_dragState != DRAG_NONE) {
+ return;
+ }
+ }
Point p = toControl(e.x, e.y);
int idx = getItemIndexAtY(p.y);
if (idx >= 0 && idx < _data._expandedItems.length) {

Back to the top