Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich2011-07-21 19:00:17 +0000
committerFelipe Heidrich2011-07-21 19:00:17 +0000
commit86e590387fc98740eb431ea80c5942750b2c6d0c (patch)
tree20150e76afd9261510ce263652496e507fd7c87d
parent0b2dd8f10b95731440fc336b0817c8bf2fa61c57 (diff)
downloadeclipse.platform.swt-86e590387fc98740eb431ea80c5942750b2c6d0c.tar.gz
eclipse.platform.swt-86e590387fc98740eb431ea80c5942750b2c6d0c.tar.xz
eclipse.platform.swt-86e590387fc98740eb431ea80c5942750b2c6d0c.zip
Bug 335857 - Keyboard moves sash the other way when controls have
SWT.RIGHT_TO_LEFT on it
-rw-r--r--[-rwxr-xr-x]bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java32
1 files changed, 14 insertions, 18 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
index a260dd97cd..e87b67adda 100755..100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
@@ -204,41 +204,37 @@ LRESULT WM_KEYDOWN (int /*long*/ wParam, int /*long*/ lParam) {
/* Calculate the new x or y position */
if (OS.GetKeyState (OS.VK_LBUTTON) < 0) return result;
int step = OS.GetKeyState (OS.VK_CONTROL) < 0 ? INCREMENT : PAGE_INCREMENT;
- POINT pt = new POINT ();
if ((style & SWT.VERTICAL) != 0) {
if (wParam == OS.VK_UP || wParam == OS.VK_DOWN) break;
- pt.x = wParam == OS.VK_LEFT ? -step : step;
+ if (wParam == OS.VK_LEFT) step = -step;
+ if ((parent.style & SWT.MIRRORED) != 0) step = -step;
} else {
if (wParam == OS.VK_LEFT || wParam == OS.VK_RIGHT) break;
- pt.y = wParam == OS.VK_UP ? -step : step;
+ if (wParam == OS.VK_UP) step = -step;
}
- int /*long*/ hwndTrack = parent.handle;
- OS.MapWindowPoints (handle, hwndTrack, pt, 1);
- RECT rect = new RECT (), clientRect = new RECT ();
+ RECT rect = new RECT ();
OS.GetWindowRect (handle, rect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
+ int /*long*/ hwndTrack = parent.handle;
+ RECT clientRect = new RECT ();
OS.GetClientRect (hwndTrack, clientRect);
int clientWidth = clientRect.right - clientRect.left;
int clientHeight = clientRect.bottom - clientRect.top;
- int newX = lastX, newY = lastY;
+ OS.MapWindowPoints (0, hwndTrack, rect, 2);
+ POINT cursorPt = new POINT ();
+ int newX = rect.left, newY = rect.top;
if ((style & SWT.VERTICAL) != 0) {
- newX = Math.min (Math.max (0, pt.x - startX), clientWidth - width);
+ cursorPt.x = newX = Math.min (Math.max (clientRect.left, newX + step), clientWidth - width);
+ cursorPt.y = rect.top + height / 2;
} else {
- newY = Math.min (Math.max (0, pt.y - startY), clientHeight - height);
+ cursorPt.x = rect.left + width / 2;
+ cursorPt.y = newY = Math.min (Math.max (clientRect.top, newY + step), clientHeight - height);
}
- if (newX == lastX && newY == lastY) return result;
+ if (newX == rect.left && newY == rect.top) return result;
/* Update the pointer position */
- POINT cursorPt = new POINT ();
- cursorPt.x = pt.x; cursorPt.y = pt.y;
OS.ClientToScreen (hwndTrack, cursorPt);
- if ((style & SWT.VERTICAL) != 0) {
- cursorPt.y += height / 2;
- }
- else {
- cursorPt.x += width / 2;
- }
OS.SetCursorPos (cursorPt.x, cursorPt.y);
Event event = new Event ();

Back to the top