summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
diff options
context:
space:
mode:
authorScott Kovatch <skovatch>2009-03-04 22:00:13 +0000
committerScott Kovatch <skovatch>2009-03-04 22:00:13 +0000
commit78162d7c5b825a81c04f68e69604ea562fda4b41 (patch)
treed9dbabcb7b6426b24fb4547c753df5999f4ee103 /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
parentc0373262f56fcc043cb0d322b9443796dc24d91f (diff)
downloadeclipse.platform.swt-78162d7c5b825a81c04f68e69604ea562fda4b41.tar.gz
eclipse.platform.swt-78162d7c5b825a81c04f68e69604ea562fda4b41.tar.xz
eclipse.platform.swt-78162d7c5b825a81c04f68e69604ea562fda4b41.zip
266405 - override next- and previousValidKeyView to catch modified tab keys
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
index c31758cfe2..fc60dba2a4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
@@ -829,6 +829,43 @@ void scrollWheel (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
super.scrollWheel (id, sel, theEvent);
}
+/*
+ * Feature in Cocoa. Some combinations of tab + modifier key do not trigger key events but instead
+ * attempt to move the focus elsewhere. next- and previousValidKeyView get called when this happens,
+ * so intercept those messages in the Canvas case. Otherwise let Cocoa handle it.
+ */
+int /*long*/ nextValidKeyView(int /*long*/ id, int /*long*/ sel) {
+ if (view.window ().firstResponder ().id == id) {
+ // Forward the current event to keyDown...
+ if ((state & CANVAS) != 0) {
+ NSEvent event = NSApplication.sharedApplication().currentEvent();
+
+ if (event.type() == OS.NSKeyDown) {
+ this.keyDown(id, sel, event.id);
+ return 0;
+ }
+ }
+ }
+
+ return super.nextValidKeyView(id, sel);
+}
+
+int /*long*/ previousValidKeyView(int /*long*/ id, int /*long*/ sel) {
+ if (view.window ().firstResponder ().id == id) {
+ // Forward the current event to keyDown...
+ if ((state & CANVAS) != 0) {
+ NSEvent event = NSApplication.sharedApplication().currentEvent();
+
+ if (event.type() == OS.NSKeyDown) {
+ this.keyDown(id, sel, event.id);
+ return 0;
+ }
+ }
+ }
+
+ return super.previousValidKeyView(id, sel);
+}
+
/**
* Sets the background drawing mode to the argument which should
* be one of the following constants defined in class <code>SWT</code>: