summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Kovatch <skovatch>2010-11-01 22:06:27 +0000
committerScott Kovatch <skovatch>2010-11-01 22:06:27 +0000
commite379287ec5e166c277b3a4f8df3f70c1e5720d36 (patch)
tree373c395f269526161c62764c9d481fab706e97df
parent08f33584521f7dc01a49e4043f4dcfe4e52e761f (diff)
downloadeclipse.platform.swt-e379287ec5e166c277b3a4f8df3f70c1e5720d36.tar.gz
eclipse.platform.swt-e379287ec5e166c277b3a4f8df3f70c1e5720d36.tar.xz
eclipse.platform.swt-e379287ec5e166c277b3a4f8df3f70c1e5720d36.zip
251446 - ignore next mouseUp after clicking on a link.
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
index 70b021f7d8..171cffc105 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
@@ -45,6 +45,7 @@ public class Link extends Control {
int [] mnemonics;
NSColor linkColor;
int focusIndex;
+ boolean ignoreNextMouseUp;
/**
* Constructs a new instance of this class given its parent
@@ -123,6 +124,7 @@ boolean textView_clickOnLink_atIndex(int /*long*/ id, int /*long*/ sel, int /*lo
}
}
redrawWidget(view, false);
+ ignoreNextMouseUp = true;
return true;
}
@@ -341,11 +343,18 @@ public String getText () {
return text;
}
-// This code prevents selection events from firing.
-//boolean mouseEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent, int type) {
-// super.mouseEvent (id, sel, theEvent, type);
-// return new NSEvent (theEvent).type () != OS.NSLeftMouseDown;
-//}
+void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
+ /*
+ * Feature in Cocoa: Link click notices are sent on mouseDown, but for some reason, Cocoa
+ * re-sends the mouseUp that follows the click on a link. Fix is to ignore the next mouseUp
+ * fired after a link selection.
+ */
+ if (ignoreNextMouseUp) {
+ ignoreNextMouseUp = false;
+ return;
+ }
+ super.mouseUp(id, sel, theEvent);
+}
boolean shouldDrawInsertionPoint(int /*long*/ id, int /*long*/ sel) {
return false;