diff options
author | Silenio Quarti <silenio> | 2009-09-16 15:54:20 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2009-09-16 15:54:20 +0000 |
commit | 10842ef2b41efd0929f5989ace35bf95d8b1a89e (patch) | |
tree | 59c4a597f515dc9cef15b5081d137f6e6e885853 | |
parent | cf8c5622ea57ec23139983b88a03e647b3d24bc5 (diff) | |
download | eclipse.platform.swt-10842ef2b41efd0929f5989ace35bf95d8b1a89e.tar.gz eclipse.platform.swt-10842ef2b41efd0929f5989ace35bf95d8b1a89e.tar.xz eclipse.platform.swt-10842ef2b41efd0929f5989ace35bf95d8b1a89e.zip |
REMOVED - 279103 - [Cocoa] SelectionChanged events behaviour broken
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java | 21 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java | 28 |
2 files changed, 7 insertions, 42 deletions
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 5ff7efc434..3adf440f17 100755 --- 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 @@ -76,7 +76,7 @@ public class Table extends Composite { NSTextFieldCell dataCell; NSButtonCell buttonCell; int columnCount, itemCount, lastIndexOf, sortDirection; - boolean ignoreSelect, fixScrollWidth, drawExpansion, wasSelected; + boolean ignoreSelect, fixScrollWidth, drawExpansion; Rectangle imageBounds; static int NEXT_ID; @@ -1860,9 +1860,8 @@ int /*long*/ menuForEvent(int /*long*/ id, int /*long*/ sel, int /*long*/ theEve } void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { - NSTableView widget = (NSTableView)view; - NSEvent nsEvent = new NSEvent(theEvent); if (headerView != null && id == headerView.id) { + NSTableView widget = (NSTableView)view; widget.setAllowsColumnReordering(false); NSPoint pt = headerView.convertPoint_fromView_(new NSEvent(theEvent).locationInWindow(), null); int /*long*/ nsIndex = headerView.columnAtPoint(pt); @@ -1881,23 +1880,10 @@ void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { // it from menuForEvent:. This has the side effect, however, of sending control-click to the NSTableView, // which is interpreted as a single click that clears the selection. Fix is to ignore control-click if the // view has a context menu. + NSEvent nsEvent = new NSEvent(theEvent); if ((nsEvent.modifierFlags() & OS.NSControlKeyMask) != 0) return; } - wasSelected = false; super.mouseDown(id, sel, theEvent); - if (isDisposed()) return; - if (!wasSelected) { - NSPoint pt = view.convertPoint_fromView_(nsEvent.locationInWindow(), null); - int /*long*/ row = widget.rowAtPoint(pt); - if (row != -1 && widget.isRowSelected(row)) { - if (0 < row && row <= itemCount) { - Event event = new Event (); - event.item = _getItem ((int)/*64*/row); - postEvent (SWT.Selection, event); - } - } - } - wasSelected = false; } /* @@ -3024,7 +3010,6 @@ void tableViewColumnDidResize (int /*long*/ id, int /*long*/ sel, int /*long*/ a } void tableViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { - wasSelected = true; if (ignoreSelect) return; NSTableView widget = (NSTableView) view; int row = (int)/*64*/widget.selectedRow (); 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 a57219dc3b..ae91f3e1be 100755 --- 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 @@ -84,7 +84,7 @@ public class Tree extends Composite { TreeColumn sortColumn; int columnCount; int sortDirection; - boolean ignoreExpand, ignoreSelect, ignoreRedraw, reloadPending, drawExpansion, wasSelected; + boolean ignoreExpand, ignoreSelect, ignoreRedraw, reloadPending, drawExpansion; Rectangle imageBounds; TreeItem insertItem; boolean insertBefore; @@ -1889,9 +1889,8 @@ int /*long*/ menuForEvent(int /*long*/ id, int /*long*/ sel, int /*long*/ theEve } void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { - NSOutlineView widget = (NSOutlineView)view; - NSEvent nsEvent = new NSEvent(theEvent); if (headerView != null && id == headerView.id) { + NSTableView widget = (NSTableView)view; widget.setAllowsColumnReordering(false); NSPoint pt = headerView.convertPoint_fromView_(new NSEvent(theEvent).locationInWindow(), null); int /*long*/ nsIndex = headerView.columnAtPoint(pt); @@ -1909,28 +1908,10 @@ void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { // Bug/feature in Cocoa: If the tree has a context menu we just set it visible instead of returning // it from menuForEvent:. This has the side effect, however, of sending control-click to the NSTableView, // which is interpreted as a single click that clears the selection. Fix is to ignore control-click, - if ((nsEvent.modifierFlags() & OS.NSControlKeyMask) != 0) return; + NSEvent event = new NSEvent(theEvent); + if ((event.modifierFlags() & OS.NSControlKeyMask) != 0) return; } - wasSelected = false; super.mouseDown(id, sel, theEvent); - if (isDisposed()) return; - if (!wasSelected) { - NSPoint pt = view.convertPoint_fromView_(nsEvent.locationInWindow(), null); - int /*long*/ row = widget.rowAtPoint(pt); - if (row != -1 && widget.isRowSelected(row)) { - NSRect rect = widget.frameOfOutlineCellAtRow(row); - if (!OS.NSPointInRect(pt, rect)) { - id itemID = widget.itemAtRow(row); - Widget item = itemID != null ? display.getWidget (itemID.id) : null; - if (item != null && item instanceof TreeItem) { - Event event = new Event (); - event.item = item; - postEvent (SWT.Selection, event); - } - } - } - } - wasSelected = false; } /* @@ -2101,7 +2082,6 @@ void outlineViewColumnDidResize (int /*long*/ id, int /*long*/ sel, int /*long*/ } void outlineViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { - wasSelected = true; if (ignoreSelect) return; NSOutlineView widget = (NSOutlineView) view; int row = (int)/*64*/widget.selectedRow (); |