diff dwt/custom/CCombo.d @ 211:00180515eb65

Update to SWT 3.3.2
author Frank Benoit <benoit@tionex.de>
date Wed, 19 Mar 2008 21:36:28 +0100
parents f2e04420fd6c
children 380bad9f6852
line wrap: on
line diff
--- a/dwt/custom/CCombo.d	Wed Mar 19 20:14:48 2008 +0100
+++ b/dwt/custom/CCombo.d	Wed Mar 19 21:36:28 2008 +0100
@@ -50,6 +50,7 @@
 static import tango.text.convert.Utf;
 static import tango.text.Unicode;
 static import tango.text.convert.Format;
+import dwt.dwthelper.utils;
 
 /**
  * The CCombo class represents a selectable user interface object
@@ -1086,7 +1087,21 @@
             dropDown (false);
             break;
         case DWT.Deactivate:
-            dropDown (false);
+            /*
+             * Bug in GTK. When the arrow button is pressed the popup control receives a
+             * deactivate event and then the arrow button receives a selection event. If
+             * we hide the popup in the deactivate event, the selection event will show
+             * it again. To prevent the popup from showing again, we will let the selection
+             * event of the arrow button hide the popup.
+             */
+            if ("gtk".equals(DWT.getPlatform())) {
+                Point point = arrow.toControl(getDisplay().getCursorLocation());
+                Point size = arrow.getSize();
+                Rectangle rect = new Rectangle(0, 0, size.x, size.y);
+                if (!rect.contains(point)) dropDown (false);
+            } else {
+                dropDown(false);
+            }
             break;
         default:
     }