summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnnika Karjakina2012-04-30 03:08:41 (EDT)
committer Lakshmi Shanmugam2012-04-30 10:37:27 (EDT)
commit743bbe6bcb95ceb0df99352c9ddc9136760a4acc (patch)
tree5fddfc92bd9a8c94954450d3ea2914695f01725f
parent2a4aad21a72520009f76af4b237422aafe0c3532 (diff)
downloadeclipse.platform.swt-743bbe6bcb95ceb0df99352c9ddc9136760a4acc.zip
eclipse.platform.swt-743bbe6bcb95ceb0df99352c9ddc9136760a4acc.tar.gz
eclipse.platform.swt-743bbe6bcb95ceb0df99352c9ddc9136760a4acc.tar.bz2
Bug 377155-CCombo dropdown list can go off the top screen bound
-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 f835690..d2e5a87 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);