diff options
author | Silenio Quarti <silenio> | 2008-06-17 21:20:00 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2008-06-17 21:20:00 +0000 |
commit | 2b01c17df617f244d0504038abaebb5e123d8c83 (patch) | |
tree | be5c32bc6d8b816905a743f9f7fcb8fb5538e04c | |
parent | bb5ab065078a87fb32da94c3cc824b48af95811c (diff) | |
download | eclipse.platform.swt-2b01c17df617f244d0504038abaebb5e123d8c83.tar.gz eclipse.platform.swt-2b01c17df617f244d0504038abaebb5e123d8c83.tar.xz eclipse.platform.swt-2b01c17df617f244d0504038abaebb5e123d8c83.zip |
activate and focus events
3 files changed, 13 insertions, 9 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 805dd87e64..dc182beede 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 @@ -113,21 +113,21 @@ boolean acceptsFirstResponder () { } boolean becomeFirstResponder () { -//TODO - query focusControl() in SWT.FocusIn/Out is the control - sendEvent (SWT.FocusIn); objc_super super_struct = new objc_super(); super_struct.receiver = view.id; super_struct.cls = OS.objc_msgSend(view.id, OS.sel_superclass); - return OS.objc_msgSendSuper(super_struct, OS.sel_becomeFirstResponder) != 0; + boolean result = OS.objc_msgSendSuper(super_struct, OS.sel_becomeFirstResponder) != 0; + if (result) sendFocusEvent (SWT.FocusIn, false); + return result; } boolean resignFirstResponder () { -//TODO - query focusControl() in SWT.FocusIn/Out is the control - sendEvent (SWT.FocusOut); objc_super super_struct = new objc_super(); super_struct.receiver = view.id; super_struct.cls = OS.objc_msgSend(view.id, OS.sel_superclass); - return OS.objc_msgSendSuper(super_struct, OS.sel_resignFirstResponder) != 0; + boolean result = OS.objc_msgSendSuper(super_struct, OS.sel_resignFirstResponder) != 0; + if (result) sendFocusEvent (SWT.FocusOut, false); + return result; } /** @@ -2236,9 +2236,12 @@ void sendFocusEvent (int type, boolean post) { } boolean sendMouseEvent (NSEvent nsEvent, int type, boolean send) { + Shell shell = null; Event event = new Event (); switch (type) { case SWT.MouseDown: + shell = getShell (); + //FALL THROUGH case SWT.MouseUp: case SWT.MouseDoubleClick: int button = nsEvent.buttonNumber(); @@ -2268,6 +2271,7 @@ boolean sendMouseEvent (NSEvent nsEvent, int type, boolean send) { } else { postEvent (type, event); } + if (shell != null) shell.setActiveControl(this); return event.doit; } 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 e253cfd1fd..a054c8ab0d 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 @@ -1594,6 +1594,8 @@ void addEventMethods (int cls, int proc2, int proc3) { OS.class_addMethod(cls, OS.sel_mouseEntered_1, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_mouseExited_1, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); + OS.class_addMethod(cls, OS.sel_resignFirstResponder, proc2, "@:"); + OS.class_addMethod(cls, OS.sel_becomeFirstResponder, proc2, "@:"); } void addFrameMethods(int cls, int setFrameOriginProc, int setFrameSizeProc) { @@ -1662,8 +1664,6 @@ void initClasses () { OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i"); OS.class_addMethod(cls, OS.sel_acceptsFirstResponder, proc2, "@:"); - OS.class_addMethod(cls, OS.sel_resignFirstResponder, proc2, "@:"); - 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_keyDown_1, proc3, "@:@"); 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 a14e83c917..854eb575d3 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 @@ -539,7 +539,7 @@ Cursor findCursor () { void fixShell (Shell newShell, Control control) { if (this == newShell) return; -// if (control == lastActive) setActiveControl (null); + if (control == lastActive) setActiveControl (null); } /** |