Project: SWT
Bug 37519 Bug in Decorations.setPlacement method
Reported: 2003-05-12 16:13:28 | Status: resolved fixed

The setPlacement method in Decorations contains the following code: if ((flags & OS.SWP_NOMOVE) == 0) { lpwndpl.left = x; lpwndpl.top = y; } if ((flags & OS.SWP_NOSIZE) == 0) { lpwndpl.right = x + width; lpwndpl.bottom = x + height; } I believe this should be changed to: if ((flags & OS.SWP_NOMOVE) == 0) { lpwndpl.left = x; lpwndpl.top = y; } else { x = lpwndpl.left; y = lpwndpl.top; } if ((flags & OS.SWP_NOSIZE) == 0) { lpwndpl.right = x + width; lpwndpl.bottom = y + height; } The problem with the current code occurs when the 1st test is false (ie. NO_MOVE is true) and the 2nd test is true (ie NOSIZE is false). Consider what happens if setPlacement is called with the values (0, 0, 400, 400), where the current window placement is (50, 50, 500, 500). The current code sets the window placement to (50, 50, 400, 400), which violates the requested width and height.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java