summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2009-10-23 19:16:19 +0000
committerFelipe Heidrich <fheidric>2009-10-23 19:16:19 +0000
commit548533ad759a88444affd19fae3ef362d7331f8b (patch)
treeb428fee07235a260cb0f8f532a62914cf53addfd
parent5b29a12fc8f54a16ee9d51ff6a6787120cdba944 (diff)
downloadeclipse.platform.swt-548533ad759a88444affd19fae3ef362d7331f8b.tar.gz
eclipse.platform.swt-548533ad759a88444affd19fae3ef362d7331f8b.tar.xz
eclipse.platform.swt-548533ad759a88444affd19fae3ef362d7331f8b.zip
Bug 65679 - SelectionEvent.stateMask remains 0 even Ctrl (Shift, Alt) were pressed during push operation on button
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DateTime.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MenuItem.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Sash.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scale.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip/org/eclipse/swt/widgets/ToolTip.java2
20 files changed, 63 insertions, 52 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java
index b744a5d113..67f85a2bd2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java
@@ -184,7 +184,7 @@ static int checkStyle (int style) {
}
void click () {
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
@@ -586,7 +586,7 @@ void sendSelection () {
((NSButton)view).setState(OS.NSOnState);
}
}
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
@@ -729,7 +729,7 @@ boolean setRadioSelection (boolean value){
if ((style & SWT.RADIO) == 0) return false;
if (getSelection () != value) {
setSelection (value);
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
return true;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java
index 1b21582361..91af7c5be3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java
@@ -354,7 +354,7 @@ void comboBoxSelectionDidChange(int /*long*/ id, int /*long*/ sel, int /*long*/
NSAttributedString attStr = new NSAttributedString (widget.itemObjectValueAtIndex(tableSelection));
NSString nsString = attStr.string();
if (nsString != null) setText(nsString.getString(), true);
- if (!ignoreSelection) sendEvent(SWT.Selection, null, display.trackingControl != this);
+ if (!ignoreSelection) sendSelectionEvent (SWT.Selection, null, display.trackingControl != this);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
@@ -1213,7 +1213,7 @@ public void select (int index) {
void sendSelection () {
sendEvent(SWT.Modify);
- if (!ignoreSelection) postEvent(SWT.Selection);
+ if (!ignoreSelection) sendSelectionEvent(SWT.Selection);
}
boolean sendKeyEvent (NSEvent nsEvent, int type) {
@@ -1248,7 +1248,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
}
return result;
}
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 3d32c59b00..cead56154e 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
@@ -819,7 +819,7 @@ void scrollWheel (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
bar.setSelection (selection);
Event event = new Event ();
event.detail = delta > 0 ? SWT.PAGE_UP : SWT.PAGE_DOWN;
- bar.sendEvent (SWT.Selection, event);
+ bar.sendSelectionEvent (SWT.Selection, event, true);
handled = true;
}
if (!doit) handled = true;
@@ -838,7 +838,7 @@ void scrollWheel (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
bar.setSelection (selection);
Event event = new Event ();
event.detail = delta > 0 ? SWT.PAGE_UP : SWT.PAGE_DOWN;
- bar.sendEvent (SWT.Selection, event);
+ bar.sendSelectionEvent (SWT.Selection, event, true);
handled = true;
}
if (!doit) handled = true;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DateTime.java
index 6e5ac89d97..ed5269ccd2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DateTime.java
@@ -347,7 +347,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
}
}
return result;
@@ -357,12 +357,12 @@ void sendSelection () {
NSEvent event = NSApplication.sharedApplication().currentEvent();
if (event != null && (style & SWT.CALENDAR) != 0) {
if (event.clickCount() == 2) {
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
} else if (event.type() == OS.NSLeftMouseUp) {
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
} else { // SWT.DATE or SWT.TIME
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
index ba7f10b0ad..60e2ce7830 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Link.java
@@ -114,7 +114,7 @@ boolean textView_clickOnLink_atIndex(int /*long*/ id, int /*long*/ sel, int /*lo
NSString str = new NSString (link);
Event event = new Event ();
event.text = str.getString();
- sendEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, true);
return true;
}
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 e8310745cc..d8e96393a2 100755
--- 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
@@ -1098,7 +1098,7 @@ public void selectAll () {
void sendDoubleSelection() {
if (((NSTableView)view).clickedRow () != -1) {
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
}
}
@@ -1110,7 +1110,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: { /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
break;
}
}
@@ -1429,7 +1429,7 @@ public void showSelection () {
void tableViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) {
if (ignoreSelect) return;
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
boolean tableView_shouldEditTableColumn_row(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView, int /*long*/ aTableColumn, int /*long*/ rowIndex) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MenuItem.java
index 13afe9510a..c841250a22 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/MenuItem.java
@@ -522,10 +522,7 @@ void sendSelection () {
}
}
}
- Event event = new Event ();
- NSEvent nsEvent = NSApplication.sharedApplication ().currentEvent ();
- if (nsEvent != null) setInputState (event, nsEvent, 0);
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection);
}
/**
@@ -685,7 +682,7 @@ boolean setRadioSelection (boolean value) {
if ((style & SWT.RADIO) == 0) return false;
if (getSelection () != value) {
setSelection (value);
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
return true;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Sash.java
index dd1454aab4..e4754f4ab9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Sash.java
@@ -324,7 +324,7 @@ boolean sendKeyEvent(NSEvent nsEvent, int type) {
event.y = newY;
event.width = width;
event.height = height;
- sendEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, true);
if (isDisposed ()) break;
if (event.doit) {
setBounds (event.x, event.y, width, height);
@@ -363,7 +363,7 @@ void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
event.y = (int)frame.y;
event.width = (int)frame.width;
event.height = (int)frame.height;
- sendEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, true);
if (isDisposed ()) return;
if (event.doit) {
lastX = event.x;
@@ -400,7 +400,7 @@ void mouseDragged(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
event.y = newY;
event.width = (int)frame.width;
event.height = (int)frame.height;
- sendEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, true);
if (isDisposed ()) return;
if (event.doit) {
lastX = event.x;
@@ -421,7 +421,7 @@ void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
event.y = lastY;
event.width = (int)frame.width;
event.height = (int)frame.height;
- sendEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, true);
if (isDisposed ()) return;
if (event.doit) {
setBounds (event.x, event.y, (int)frame.width, (int)frame.height);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scale.java
index 2d120fe32d..13e4c49dcb 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scale.java
@@ -262,7 +262,7 @@ void sendSelection () {
NSEvent currEvent = NSApplication.sharedApplication().currentEvent();
if (currEvent.type() != OS.NSLeftMouseUp)
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java
index cb00bd3e7a..26b8a24808 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java
@@ -478,7 +478,7 @@ void sendSelection () {
setSelection(value);
}
}
- sendEvent(SWT.Selection, event);
+ sendSelectionEvent(SWT.Selection, event, true);
} finally {
if (disableFlush) {
window.enableFlushWindow ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java
index c55cef6429..f62d24c951 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java
@@ -351,7 +351,7 @@ void sendSelection () {
if (event.detail != SWT.DRAG) {
setSelection(value);
}
- sendEvent(SWT.Selection, event);
+ sendSelectionEvent(SWT.Selection, event, true);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java
index d4dac55b7a..a436e58f48 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java
@@ -675,7 +675,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: { /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
return true;
}
@@ -913,7 +913,7 @@ void setSelection (int value, boolean setPos, boolean setText, boolean notify) {
if (fieldEditor != null) fieldEditor.setSelectedRange(selection);
sendEvent (SWT.Modify);
}
- if (notify) postEvent (SWT.Selection);
+ if (notify) sendSelectionEvent (SWT.Selection);
}
void setSmallSize () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java
index 1700990322..87044fb0b3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java
@@ -597,7 +597,7 @@ void setSelection (int index, boolean notify, boolean force) {
if (notify) {
Event event = new Event ();
event.item = item;
- sendEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, true);
}
}
}
@@ -665,7 +665,7 @@ void tabView_didSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long*
if (!ignoreSelect) {
Event event = new Event ();
event.item = item;
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, false);
}
}
}
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 e1fa9bceec..0d4e569284 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
@@ -2935,7 +2935,7 @@ void sendDoubleSelection() {
}
Event event = new Event ();
event.item = _getItem (rowIndex);
- postEvent (SWT.DefaultSelection, event);
+ sendSelectionEvent (SWT.DefaultSelection, event, false);
}
}
@@ -2947,7 +2947,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: { /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
break;
}
}
@@ -3049,20 +3049,20 @@ void tableViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*
NSTableView widget = (NSTableView) view;
int row = (int)/*64*/widget.selectedRow ();
if(row == -1)
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
else {
TableItem item = _getItem (row);
Event event = new Event ();
event.item = item;
event.index = row;
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, false);
}
}
void tableView_didClickTableColumn (int /*long*/ id, int /*long*/ sel, int /*long*/ tableView, int /*long*/ tableColumn) {
TableColumn column = getColumn (new id (tableColumn));
if (column == null) return; /* either CHECK column or firstColumn in 0-column Table */
- column.postEvent (SWT.Selection);
+ column.sendSelectionEvent (SWT.Selection);
}
int /*long*/ tableView_objectValueForTableColumn_row (int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView, int /*long*/ aTableColumn, int /*long*/ rowIndex) {
@@ -3094,7 +3094,7 @@ void tableView_setObjectValue_forTableColumn_row (int /*long*/ id, int /*long*/
event.detail = SWT.CHECK;
event.item = item;
event.index = (int)/*64*/rowIndex;
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, false);
item.redraw (-1);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
index bcce12d15a..76d5e4dd1d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
@@ -1457,7 +1457,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
}
}
return result;
@@ -1469,7 +1469,7 @@ void sendSearchSelection () {
}
Event event = new Event ();
event.detail = SWT.ICON_SEARCH;
- postEvent (SWT.DefaultSelection, event);
+ sendSelectionEvent (SWT.DefaultSelection, event, false);
}
void sendCancelSelection () {
@@ -1478,7 +1478,7 @@ void sendCancelSelection () {
}
Event event = new Event ();
event.detail = SWT.ICON_CANCEL;
- postEvent (SWT.DefaultSelection, event);
+ sendSelectionEvent (SWT.DefaultSelection, event, false);
}
void setBackgroundColor(NSColor nsColor) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java
index 1521106b04..fbfd12d7c8 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java
@@ -561,7 +561,7 @@ void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
event.detail = SWT.ARROW;
event.x = (int)frame.x;
event.y = (int)(frame.y + frame.height);
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, false);
}
}
@@ -678,7 +678,7 @@ void sendSelection () {
}
}
if ((style & SWT.CHECK) != 0) setSelection (!getSelection ());
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
void setBounds (int x, int y, int width, int height) {
@@ -824,7 +824,7 @@ boolean setRadioSelection (boolean value) {
if ((style & SWT.RADIO) == 0) return false;
if (getSelection () != value) {
setSelection (value);
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
}
return true;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java
index ec0a782aa6..5213df76d2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java
@@ -511,7 +511,7 @@ void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
if (highlight) {
NSEvent nsEvent = new NSEvent(theEvent);
if (nsEvent.type() == OS.NSLeftMouseUp) {
- postEvent(nsEvent.clickCount() == 2 ? SWT.DefaultSelection : SWT.Selection);
+ sendSelectionEvent(nsEvent.clickCount() == 2 ? SWT.DefaultSelection : SWT.Selection);
}
}
highlight = false;
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 108d7cd2c4..f18257bc7b 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
@@ -1958,7 +1958,7 @@ int /*long*/ outlineView_child_ofItem (int /*long*/ id, int /*long*/ sel, int /*
void outlineView_didClickTableColumn (int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ tableColumn) {
TreeColumn column = getColumn (new id (tableColumn));
if (column == null) return; /* either CHECK column or firstColumn in 0-column Tree */
- column.postEvent (SWT.Selection);
+ column.sendSelectionEvent (SWT.Selection);
}
int /*long*/ outlineView_objectValueForTableColumn_byItem (int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ tableColumn, int /*long*/ itemID) {
@@ -2117,14 +2117,14 @@ void outlineViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*lon
NSOutlineView widget = (NSOutlineView) view;
int row = (int)/*64*/widget.selectedRow ();
if (row == -1)
- postEvent (SWT.Selection);
+ sendSelectionEvent (SWT.Selection);
else {
id _id = widget.itemAtRow (row);
TreeItem item = (TreeItem) display.getWidget (_id.id);
Event event = new Event ();
event.item = item;
event.index = row;
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, false);
}
}
@@ -2135,7 +2135,7 @@ void outlineView_setObjectValue_forTableColumn_byItem (int /*long*/ id, int /*lo
Event event = new Event ();
event.detail = SWT.CHECK;
event.item = item;
- postEvent (SWT.Selection, event);
+ sendSelectionEvent (SWT.Selection, event, false);
item.redraw (-1);
}
}
@@ -2359,7 +2359,7 @@ void sendDoubleSelection() {
TreeItem item = (TreeItem) display.getWidget (outlineView.itemAtRow (rowIndex).id);
Event event = new Event ();
event.item = item;
- postEvent (SWT.DefaultSelection, event);
+ sendSelectionEvent (SWT.DefaultSelection, event, false);
}
}
@@ -2371,7 +2371,7 @@ boolean sendKeyEvent (NSEvent nsEvent, int type) {
switch (keyCode) {
case 76: /* KP Enter */
case 36: { /* Return */
- postEvent (SWT.DefaultSelection);
+ sendSelectionEvent (SWT.DefaultSelection);
break;
}
}
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 db4f9eb676..f7d16a09b6 100755
--- 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
@@ -1334,6 +1334,20 @@ void sendSearchSelection () {
void sendSelection () {
}
+void sendSelectionEvent (int eventType) {
+ sendSelectionEvent (eventType, null, false);
+}
+
+void sendSelectionEvent (int eventType, Event event, boolean send) {
+ if (eventTable == null && !display.filters (eventType)) {
+ return;
+ }
+ if (event == null) event = new Event ();
+ NSEvent nsEvent = NSApplication.sharedApplication ().currentEvent ();
+ if (nsEvent != null) setInputState (event, nsEvent, 0);
+ sendEvent(eventType, event, send);
+}
+
void sendVerticalSelection () {
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip/org/eclipse/swt/widgets/ToolTip.java
index 3edac98b97..5059ba568c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/tooltip/org/eclipse/swt/widgets/ToolTip.java
@@ -417,7 +417,7 @@ void onDispose (Event event) {
}
void onMouseDown (Event event) {
- notifyListeners (SWT.Selection, new Event ());
+ sendSelectionEvent (SWT.Selection, null, true);
setVisible (false);
}