summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
index f835690345..d2e5a87d22 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
@@ -583,7 +583,17 @@ void dropDown (boolean drop) {
int height = listRect.height + 2;
int x = parentRect.x;
int y = parentRect.y + comboSize.y;
- if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
+ if (y + height > displayRect.y + displayRect.height) {
+ int popUpwardsHeight = (parentRect.y - height < displayRect.y) ? parentRect.y - displayRect.y : height;
+ int popDownwardsHeight = displayRect.y + displayRect.height - y;
+ if (popUpwardsHeight > popDownwardsHeight) {
+ height = popUpwardsHeight;
+ y = parentRect.y - popUpwardsHeight;
+ } else {
+ height = popDownwardsHeight;
+ }
+ list.setSize (listRect.width, height - 2);
+ }
if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width;
popup.setBounds (x, y, width, height);
popup.setVisible (true);