Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2008-06-13 18:52:59 +0000
committerGrant Gayed2008-06-13 18:52:59 +0000
commit932d450a4f72f04fe01a716839f938ce69cfa9f7 (patch)
tree7d33274a7a015dddff143e956fea5715782c4d53
parentf820540f9bb45c85c8821653a4e1191ecaea8557 (diff)
downloadeclipse.platform.swt-932d450a4f72f04fe01a716839f938ce69cfa9f7.tar.gz
eclipse.platform.swt-932d450a4f72f04fe01a716839f938ce69cfa9f7.tar.xz
eclipse.platform.swt-932d450a4f72f04fe01a716839f938ce69cfa9f7.zip
dispatch NSFlagsChanged from Shell.windowSendEvent()
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java7
3 files changed, 15 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index e68662ce0a..36ad059312 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -832,27 +832,22 @@ void flagsChanged(int theEvent) {
if ((modifiers & OS.NSShiftKeyMask) != 0 && (lastModifiers & OS.NSShiftKeyMask) == 0) type = SWT.KeyDown;
if ((modifiers & OS.NSControlKeyMask) != 0 && (lastModifiers & OS.NSControlKeyMask) == 0) type = SWT.KeyDown;
if ((modifiers & OS.NSCommandKeyMask) != 0 && (lastModifiers & OS.NSCommandKeyMask) == 0) type = SWT.KeyDown;
- Control target = display.getFocusControl();
if (type == SWT.KeyUp && (modifiers & OS.NSAlphaShiftKeyMask) == 0 && (lastModifiers & OS.NSAlphaShiftKeyMask) != 0) {
- if (target != null) {
- Event event = new Event ();
- event.keyCode = SWT.CAPS_LOCK;
- setInputState(event, nsEvent, type);
- target.sendKeyEvent (SWT.KeyDown, event);
- }
+ Event event = new Event ();
+ event.keyCode = SWT.CAPS_LOCK;
+ setInputState(event, nsEvent, type);
+ sendKeyEvent (SWT.KeyDown, event);
}
Event event = new Event ();
event.keyCode = Display.translateKey(nsEvent.keyCode());
setInputState(event, nsEvent, type);
if (event.keyCode == 0 && event.character == 0) return;
- boolean result = sendKeyEvent (type, event);
+ sendKeyEvent (type, event);
if (type == SWT.KeyDown && (modifiers & OS.NSAlphaShiftKeyMask) != 0 && (lastModifiers & OS.NSAlphaShiftKeyMask) == 0) {
- if (target != null) {
- event = new Event ();
- event.keyCode = SWT.CAPS_LOCK;
- // setInputState (event, SWT.KeyUp, chord, modifiers);
- target.sendKeyEvent (SWT.KeyUp, event);
- }
+ event = new Event ();
+ event.keyCode = SWT.CAPS_LOCK;
+// setInputState (event, SWT.KeyUp, chord, modifiers);
+ sendKeyEvent (SWT.KeyUp, event);
}
display.lastModifiers = modifiers;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index 5699ce1150..82ebaa29fe 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -1666,7 +1666,6 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_becomeFirstResponder, proc2, "@:");
OS.class_addMethod(cls, OS.sel_isOpaque, proc2, "@:");
OS.class_addMethod(cls, OS.sel_hitTest_1, hitTestProc, "@:{NSPoint}");
- OS.class_addMethod(cls, OS.sel_flagsChanged_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_keyDown_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_keyUp_1, proc3, "@:@");
addEventMethods(cls, proc2, proc3);
@@ -1847,7 +1846,6 @@ void initClasses () {
cls = OS.objc_allocateClassPair(OS.class_NSWindow, className, 0);
OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendEvent_1, proc3, "@:@");
- OS.class_addMethod(cls, OS.sel_flagsChanged_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_helpRequested_1, proc3, "@:@");
OS.objc_registerClassPair(cls);
}
@@ -3394,8 +3392,6 @@ int windowDelegateProc(int id, int sel, int arg0) {
widget.mouseExited(id, sel, arg0);
} else if (sel == OS.sel_menuForEvent_1) {
return widget.menuForEvent(id);
- } else if (sel == OS.sel_flagsChanged_1) {
- widget.flagsChanged(arg0);
} else if (sel == OS.sel_numberOfRowsInTableView_1) {
return widget.numberOfRowsInTableView(arg0);
} else if (sel == OS.sel_comboBoxSelectionDidChange_1) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
index 9273108737..9514c2b5f9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
@@ -1400,7 +1400,12 @@ void windowWillClose(int notification) {
void windowSendEvent(int id, int event) {
NSEvent nsEvent = new NSEvent(event);
int type = nsEvent.type();
- if (type == OS.NSKeyDown || type == OS.NSKeyUp) {
+ if (type == OS.NSFlagsChanged) {
+ Control eventTarget = display.getFocusControl();
+ if (eventTarget != null) {
+ eventTarget.flagsChanged(event);
+ }
+ } else if (type == OS.NSKeyDown || type == OS.NSKeyUp) {
Control eventTarget = display.getFocusControl();
if (eventTarget != null) {
if (type == OS.NSKeyDown) {

Back to the top