summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Cornu <ccornu>2004-05-27 20:15:18 +0000
committerChristophe Cornu <ccornu>2004-05-27 20:15:18 +0000
commit3e2545a61d8acc0ab3a2f9546b99f72e87042f5c (patch)
tree3d0494081b62119bdf9d686b2b72d0d12dd178aa
parentfac82cc06b0237dd3a4abb50bc97b38a096ee13c (diff)
downloadeclipse.platform.swt-3e2545a61d8acc0ab3a2f9546b99f72e87042f5c.tar.gz
eclipse.platform.swt-3e2545a61d8acc0ab3a2f9546b99f72e87042f5c.tar.xz
eclipse.platform.swt-3e2545a61d8acc0ab3a2f9546b99f72e87042f5c.zip
bug - SetControlBounds sometimes passed negative height
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java6
2 files changed, 9 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
index 2b2298ff00..b294dcc841 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
@@ -669,7 +669,9 @@ public int getBorderWidth () {
public Rectangle getBounds () {
checkWidget();
Rect rect = getControlBounds (topHandle ());
- return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
+ int width = Math.max(0, rect.right - rect.left);
+ int height = Math.max(0, rect.bottom - rect.top);
+ return new Rectangle (rect.left, rect.top, width, height);
}
int getDrawCount (int control) {
@@ -2625,6 +2627,8 @@ void setZOrder () {
newBounds.top = (short) (parentRect.top + inset.top);
newBounds.right = (short) (newBounds.left - inset.right - inset.left);
newBounds.bottom = (short) (newBounds.top - inset.bottom - inset.top);
+ if (newBounds.bottom < newBounds.top) newBounds.bottom = newBounds.top;
+ if (newBounds.right < newBounds.left) newBounds.right = newBounds.left;
OS.SetControlBounds (topHandle, newBounds);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
index 89d0251f8d..45a0081b13 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
@@ -1256,8 +1256,10 @@ int setBounds (int control, int x, int y, int width, int height, boolean move, b
newBounds.left = (short) (parentRect.left + x + inset.left);
newBounds.top = (short) (parentRect.top + y + inset.top);
newBounds.right = (short) (newBounds.left + width - inset.right - inset.left);
- newBounds.bottom = (short) (newBounds.top + height - inset.bottom - inset.top);
-
+ newBounds.bottom = (short) (newBounds.top + height - inset.bottom - inset.top);
+ if (newBounds.bottom < newBounds.top) newBounds.bottom = newBounds.top;
+ if (newBounds.right < newBounds.left) newBounds.right = newBounds.left;
+
/* Get bounds again, since the one above is in SWT coordinates */
OS.GetControlBounds (control, oldBounds);