aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnnika Karjakina2012-04-30 03:08:41 (EDT)
committerLakshmi Shanmugam2012-04-30 03:08:41 (EDT)
commit7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7 (patch)
treed6b4d62294c8ad005fffda521d9590db97a34d76
parentdc8b70b8b17620c5e26d2b27a9531e3a6acaed33 (diff)
downloadeclipse.platform.swt-7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7.zip
eclipse.platform.swt-7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7.tar.gz
eclipse.platform.swt-7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7.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);