diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-05-10 09:51:45 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-05-10 09:53:30 -0400 |
commit | c54345ef5d6be8118afb01d09a4b3cc711aff613 (patch) | |
tree | 3934d1d7dd898983b10216ccebc5550ef571cb17 /bundles/org.eclipse.swt | |
parent | 9aa5c5b524701582a15646a49b2aee0612f6ce80 (diff) | |
download | eclipse.platform.swt-c54345ef5d6be8118afb01d09a4b3cc711aff613.tar.gz eclipse.platform.swt-c54345ef5d6be8118afb01d09a4b3cc711aff613.tar.xz eclipse.platform.swt-c54345ef5d6be8118afb01d09a4b3cc711aff613.zip |
Bug 378081 - Combo should not send ModifyEvent on #select(int) if item unchanged
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Combo.java | 4 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java | 13 |
2 files changed, 5 insertions, 12 deletions
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 a7789bae86..fb63667959 100644 --- 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 @@ -1255,6 +1255,7 @@ public void select (int index) { int count = getItemCount (); ignoreSelection = true; if (0 <= index && index < count) { + if (index == getSelectionIndex()) return; if ((style & SWT.READ_ONLY) != 0) { ((NSPopUpButton)view).selectItemAtIndex(index); sendEvent (SWT.Modify); @@ -1563,9 +1564,8 @@ void setText (String string, boolean notify) { } if ((style & SWT.READ_ONLY) != 0) { int index = indexOf (string); - if (index != -1 && index != getSelectionIndex ()) { + if (index != -1) { select (index); - if (notify) sendEvent (SWT.Modify); } } else { char[] buffer = new char [Math.min(string.length (), textLimit)]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index c4b4978bd1..e9ee34b2df 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -1632,10 +1632,11 @@ public void removeVerifyListener (VerifyListener listener) { public void select (int index) { checkWidget(); if (index < 0 || index >= items.length) return; + int selected = OS.gtk_combo_box_get_active (handle); OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); OS.gtk_combo_box_set_active (handle, index); OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); - if ((style & SWT.READ_ONLY) != 0) { + if ((style & SWT.READ_ONLY) != 0 && selected != index) { /* * Feature in GTK. Read Only combo boxes do not get a chance to send out a * Modify event in the gtk_changed callback. The fix is to send a Modify event @@ -1867,15 +1868,7 @@ public void setText (String string) { if ((style & SWT.READ_ONLY) != 0) { int index = indexOf (string); if (index == -1) return; - OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); - OS.gtk_combo_box_set_active (handle, index); - OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED); - /* - * Feature in GTK. Read Only combo boxes do not get a chance to send out a - * Modify event in the gtk_changed callback. The fix is to send a Modify event - * here. - */ - sendEvent (SWT.Modify); + select (index); return; } /* |