diff options
author | Silenio Quarti <silenio> | 2003-04-24 16:22:25 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2003-04-24 16:22:25 +0000 |
commit | 83127b05142300257bddfb9cd0e635c63e53e125 (patch) | |
tree | 025f53521ab0c40223968df3219a2f86655c58c1 | |
parent | 9b7ddabb09820b912d88d5f06079deffb3ad17c6 (diff) | |
download | eclipse.platform.swt-83127b05142300257bddfb9cd0e635c63e53e125.tar.gz eclipse.platform.swt-83127b05142300257bddfb9cd0e635c63e53e125.tar.xz eclipse.platform.swt-83127b05142300257bddfb9cd0e635c63e53e125.zip |
36192 back port
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Tree.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Tree.java index 4fa067eaf1..cf69edc868 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Tree.java @@ -790,6 +790,39 @@ int itemNotificationProc (int browser, int id, int message) { postEvent (SWT.DefaultSelection, event); break; } + case OS.kDataBrowserContainerClosing: { + /* + * Bug in the Macintosh. For some reason, if the selected sub items of an item + * get a kDataBrowserItemDeselected notificaton when the item is collapsed, a + * call to GetDataBrowserSelectionAnchor () will cause a segment fault. The + * fix is to deselect these items ignoring kDataBrowserItemDeselected and them + * issue a selection event. + */ + int ptr = OS.NewHandle (0); + if (OS.GetDataBrowserItems (handle, item.id, true, OS.kDataBrowserItemIsSelected, ptr) == OS.noErr) { + int count = OS.GetHandleSize (ptr) / 4; + if (count > 0) { + int [] ids = new int [count]; + OS.HLock (ptr); + int [] start = new int [1]; + OS.memcpy (start, ptr, 4); + OS.memcpy (ids, start [0], count * 4); + OS.HUnlock (ptr); + ignoreSelect = true; + OS.SetDataBrowserSelectedItems (handle, ids.length, ids, OS.kDataBrowserItemsRemove); + ignoreSelect = false; + Event event = new Event (); + event.item = item; + if (ignoreExpand) { + sendEvent (SWT.Selection, event); + } else { + postEvent (SWT.Selection, event); + } + } + } + OS.DisposeHandle (ptr); + break; + } case OS.kDataBrowserContainerClosed: { if (!ignoreExpand) { Event event = new Event (); |