diff options
author | Steve Northover <steve> | 2007-02-02 16:21:16 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2007-02-02 16:21:16 +0000 |
commit | 0032ecb8246f320b54cd7303d48dcf8c37a0a448 (patch) | |
tree | 2afa528f2897a95b22baa4fd531643bfe88b0179 | |
parent | 1edced90fd40e70cfe7a835cfcac24c9b70c23ac (diff) | |
download | eclipse.platform.swt-0032ecb8246f320b54cd7303d48dcf8c37a0a448.tar.gz eclipse.platform.swt-0032ecb8246f320b54cd7303d48dcf8c37a0a448.tar.xz eclipse.platform.swt-0032ecb8246f320b54cd7303d48dcf8c37a0a448.zip |
Added a Control equality check to Display.map()
6 files changed, 12 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java index 094d80d53a..a1d125c8f6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java @@ -2545,6 +2545,7 @@ public Point map (Control from, Control to, int x, int y) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Point point = new Point (x, y); + if (from == to) return point; Rect rect = new Rect (); if (from != null) { int window = OS.GetControlOwner (from.handle); @@ -2660,6 +2661,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Rectangle rectangle = new Rectangle (x, y, width, height); + if (from == to) return rectangle; Rect rect = new Rect (); if (from != null) { int window = OS.GetControlOwner (from.handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index d666244b03..daea9ed3fe 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -2584,6 +2584,7 @@ public Point map (Control from, Control to, int x, int y) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Point point = new Point (x, y); + if (from == to) return point; if (from != null) { int /*long*/ window = from.eventWindow (); int [] origin_x = new int [1], origin_y = new int [1]; @@ -2709,6 +2710,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Rectangle rect = new Rectangle (x, y, width, height); + if (from == to) return rect; if (from != null) { int /*long*/ window = from.eventWindow (); int [] origin_x = new int [1], origin_y = new int [1]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java index 8054ea9549..77185c7bb9 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java @@ -2507,6 +2507,7 @@ public Point map (Control from, Control to, int x, int y) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Point point = new Point (x, y); + if (from == to) return point; if (from != null) { short [] root_x = new short [1], root_y = new short [1]; OS.XtTranslateCoords (from.handle, (short) x, (short) y, root_x, root_y); @@ -2605,6 +2606,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Rectangle rect = new Rectangle (x, y, width, height); + if (from == to) return rect; if (from != null) { short [] root_x = new short [1], root_y = new short [1]; OS.XtTranslateCoords (from.handle, (short) x, (short) y, root_x, root_y); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java index 60eac6098e..d91cb7d08f 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java @@ -1774,6 +1774,7 @@ public Point map (Control from, Control to, int x, int y) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Point point = new Point (x, y); + if (from == to) return point; if (from != null) { short [] position_x = new short [1], position_y = new short [1]; OS.PtGetAbsPosition (from.handle, position_x, position_y); @@ -1874,6 +1875,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); Rectangle rect = new Rectangle (x, y, width, height); + if (from == to) return rect; if (from != null) { short [] position_x = new short [1], position_y = new short [1]; OS.PtGetAbsPosition (from.handle, position_x, position_y); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 02e1d98bbd..42790e9935 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -2477,6 +2477,7 @@ public Point map (Control from, Control to, int x, int y) { checkDevice (); if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + if (from == to) return new Point (x, y); int hwndFrom = from != null ? from.handle : 0; int hwndTo = to != null ? to.handle : 0; POINT point = new POINT (); @@ -2570,6 +2571,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei checkDevice (); if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + if (from == to) return new Rectangle (x, y, width, height); int hwndFrom = from != null ? from.handle : 0; int hwndTo = to != null ? to.handle : 0; RECT rect = new RECT (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java index d78ad531d8..f966330aed 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Display.java @@ -1734,6 +1734,7 @@ public Point map (Control from, Control to, int x, int y) { checkDevice (); if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + if (from == to) return new Point (x, y); int point = OS.gcnew_Point (x, y); if (from != null && OS.FrameworkElement_IsLoaded(from.handle)) { int result = OS.Visual_PointToScreen (from.handle, point); @@ -1834,6 +1835,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei checkDevice (); if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); + if (from == to) return new Rectangle (x, y, width, height); //FIXME - HACK Point point = map(from, to, x, y); return new Rectangle (point.x, point.y, width, height); |