diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-09-06 09:49:14 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-09-06 09:49:14 -0400 |
commit | 904726b3be2bccd3138b183ec66e6878016a6ed0 (patch) | |
tree | ce68e522dc6dbb38d184af1101006148f307c667 | |
parent | 572d213ab35a497c10eab2f88d0a1f11c36bb71c (diff) | |
download | eclipse.platform.swt-904726b3be2bccd3138b183ec66e6878016a6ed0.tar.gz eclipse.platform.swt-904726b3be2bccd3138b183ec66e6878016a6ed0.tar.xz eclipse.platform.swt-904726b3be2bccd3138b183ec66e6878016a6ed0.zip |
Bug 387338 - Cocoa: [New SWT style required]single click only bring a
window to the top but do not take effective for the click object
9 files changed, 56 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 2038c03f8a..3372577a18 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -3992,6 +3992,9 @@ <method selector="mouseDownCanMoveWindow" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="needsPanelToBecomeKey" swt_gen="true"> + <retval swt_gen="true"></retval> + </method> <method selector="registerForDraggedTypes:" swt_gen="true"> <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -4683,6 +4686,7 @@ <enum name="NSAlphaFirstBitmapFormat" swt_gen="true"></enum> <enum name="NSAlphaNonpremultipliedBitmapFormat" swt_gen="true"></enum> <enum name="NSAlternateKeyMask" swt_gen="true"></enum> + <enum name="NSAppKitDefined" swt_gen="true"></enum> <enum name="NSApplicationDefined" swt_gen="true"></enum> <enum name="NSApplicationDelegateReplySuccess" swt_gen="true"></enum> <enum name="NSAtTop" swt_gen="true"></enum> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java index fd70c7f9bb..7bfb67fc9f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -211,6 +211,10 @@ public boolean mouseDownCanMoveWindow() { return OS.objc_msgSend_bool(this.id, OS.sel_mouseDownCanMoveWindow); } +public boolean needsPanelToBecomeKey() { + return OS.objc_msgSend_bool(this.id, OS.sel_needsPanelToBecomeKey); +} + public void registerForDraggedTypes(NSArray newTypes) { OS.objc_msgSend(this.id, OS.sel_registerForDraggedTypes_, newTypes != null ? newTypes.id : 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 85c7e05db6..dadc558f17 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1551,6 +1551,7 @@ public static final int /*long*/ sel_moveUp_ = sel_registerName("moveUp:"); public static final int /*long*/ sel_mutableCopy = sel_registerName("mutableCopy"); public static final int /*long*/ sel_mutableString = sel_registerName("mutableString"); public static final int /*long*/ sel_name = sel_registerName("name"); +public static final int /*long*/ sel_needsPanelToBecomeKey = sel_registerName("needsPanelToBecomeKey"); public static final int /*long*/ sel_nextEventMatchingMask_untilDate_inMode_dequeue_ = sel_registerName("nextEventMatchingMask:untilDate:inMode:dequeue:"); public static final int /*long*/ sel_nextObject = sel_registerName("nextObject"); public static final int /*long*/ sel_nextState = sel_registerName("nextState"); @@ -2289,6 +2290,7 @@ public static final int NSAlertThirdButtonReturn = 1002; public static final int NSAlphaFirstBitmapFormat = 1; public static final int NSAlphaNonpremultipliedBitmapFormat = 2; public static final int NSAlternateKeyMask = 524288; +public static final int NSAppKitDefined = 13; public static final int NSApplicationDefined = 15; public static final int NSApplicationDelegateReplySuccess = 0; public static final int NSAtTop = 2; 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 6678d079cb..e2622c6878 100644 --- 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 @@ -127,6 +127,13 @@ Control [] _getTabList () { return tabList; } +boolean acceptsFirstMouse (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { + if ((state & CANVAS) != 0) { + return true; + } + return super.acceptsFirstMouse (id, sel, theEvent); +} + boolean acceptsFirstResponder (int /*long*/ id, int /*long*/ sel) { if ((state & CANVAS) != 0) { if ((style & SWT.NO_FOCUS) == 0 && hooksKeys ()) { 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 a6b1299851..9c606fd4d7 100644 --- 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 @@ -2603,6 +2603,8 @@ void initClasses () { OS.class_addMethod(cls, OS.sel_expandItem_expandChildren_, proc4, "@:@Z"); OS.class_addMethod(cls, OS.sel_collapseItem_collapseChildren_, proc4, "@:@Z"); OS.class_addMethod(cls, OS.sel_drawBackgroundInClipRect_, drawBackgroundInClipRectProc, "@:{NSRect}"); + OS.class_addMethod(cls, OS.sel_acceptsFirstResponder, proc2, "@:"); + OS.class_addMethod(cls, OS.sel_needsPanelToBecomeKey, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); @@ -2782,6 +2784,8 @@ void initClasses () { OS.class_addMethod(cls, OS.sel_deselectAll_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_tableView_writeRowsWithIndexes_toPasteboard_, proc5, "@:@@@"); OS.class_addMethod(cls, OS.sel_drawBackgroundInClipRect_, drawBackgroundInClipRectProc, "@:{NSRect}"); + OS.class_addMethod(cls, OS.sel_acceptsFirstResponder, proc2, "@:"); + OS.class_addMethod(cls, OS.sel_needsPanelToBecomeKey, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); @@ -4989,7 +4993,7 @@ void applicationSendEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ event } break; } - sendEvent = true; + if (type != OS.NSAppKitDefined) sendEvent = true; /* * Feature in Cocoa. The help key triggers context-sensitive help but doesn't get forwarded to the window as a key event. @@ -5011,7 +5015,7 @@ void applicationSendEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ event super_struct.super_class = OS.objc_msgSend (id, OS.sel_superclass); OS.objc_msgSendSuper (super_struct, sel, event); } - sendEvent = false; + if (type != OS.NSAppKitDefined) sendEvent = false; } void applicationWillFinishLaunching (int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { @@ -5371,6 +5375,8 @@ static int /*long*/ windowProc(int /*long*/ id, int /*long*/ sel) { return widget.isFlipped(id, sel) ? 1 : 0; } else if (sel == OS.sel_canBecomeKeyView) { return widget.canBecomeKeyView(id,sel) ? 1 : 0; + } else if (sel == OS.sel_needsPanelToBecomeKey) { + return widget.needsPanelToBecomeKey(id,sel) ? 1 : 0; } else if (sel == OS.sel_becomeKeyWindow) { widget.becomeKeyWindow(id, sel); } else if (sel == OS.sel_unmarkText) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java index 2fc57e3873..72cd7a9bd4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java @@ -96,6 +96,10 @@ int /*long*/ accessibilityAttributeValue (int /*long*/ id, int /*long*/ sel, int return super.accessibilityAttributeValue(id, sel, arg0); } +boolean acceptsFirstResponder (int /*long*/ id, int /*long*/ sel) { + return true; +} + /** * Adds the argument to the end of the receiver's list. * @@ -766,6 +770,10 @@ void mouseDownSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { didSelect = false; } +boolean needsPanelToBecomeKey (int /*long*/ id, int /*long*/ sel) { + return false; +} + int /*long*/ numberOfRowsInTableView(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView) { return itemCount; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java index 2bc300acf5..bee0d9b369 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java @@ -126,6 +126,10 @@ public Table (Composite parent, int style) { super (parent, checkStyle (style)); } +boolean acceptsFirstResponder (int /*long*/ id, int /*long*/ sel) { + return true; +} + int /*long*/ accessibilityAttributeValue(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { int /*long*/ returnValue = 0; NSString attributeName = new NSString(arg0); @@ -252,7 +256,7 @@ boolean canDragRowsWithIndexes_atPoint(int /*long*/ id, int /*long*/ sel, int /* } // The clicked row must be selected to initiate a drag. - return (widget.isRowSelected(row) && drag); + return (widget.isRowSelected(row) && drag) || !hasFocus(); } boolean checkData (TableItem item) { @@ -2005,6 +2009,10 @@ void mouseDownSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { didSelect = false; } +boolean needsPanelToBecomeKey (int /*long*/ id, int /*long*/ sel) { + return false; +} + /* * Feature in Cocoa. If a checkbox is in multi-state mode, nextState cycles * from off to mixed to on and back to off again. This will cause the on state diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java index e379bf5a7c..f71d48025d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java @@ -158,6 +158,10 @@ TreeItem _getItem (TreeItem parentItem, int index, boolean create) { return item; } +boolean acceptsFirstResponder (int /*long*/ id, int /*long*/ sel) { + return true; +} + int /*long*/ accessibilityAttributeValue(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { int /*long*/ returnValue = 0; NSString attributeName = new NSString(arg0); @@ -304,7 +308,7 @@ boolean canDragRowsWithIndexes_atPoint(int /*long*/ id, int /*long*/ sel, int /* } // The clicked row must be selected to initiate a drag. - return (widget.isRowSelected(row) && drag); + return (widget.isRowSelected(row) && drag) || !hasFocus(); } boolean checkData (TreeItem item) { @@ -2054,6 +2058,10 @@ void mouseDownSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { didSelect = false; } +boolean needsPanelToBecomeKey (int /*long*/ id, int /*long*/ sel) { + return false; +} + /* * Feature in Cocoa. If a checkbox is in multi-state mode, nextState cycles * from off to mixed to on and back to off again. This will cause the on state diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java index 0edfe16fff..1e5f964597 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java @@ -260,6 +260,10 @@ boolean canBecomeKeyWindow (int /*long*/ id, int /*long*/ sel) { return callSuperBoolean (id, sel); } +boolean needsPanelToBecomeKey (int /*long*/ id, int /*long*/ sel) { + return callSuperBoolean (id, sel); +} + void cancelOperation(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { } |