diff options
author | Niraj Modi | 2015-05-20 11:57:40 +0000 |
---|---|---|
committer | Niraj Modi | 2015-05-20 11:57:40 +0000 |
commit | aa954a829806c60747c6d3d072adbc875dc61bcd (patch) | |
tree | 281d511a03900cf5a41b81b89dfb1a9e7e76d227 | |
parent | 4b56816ed07a329f964409d0e4a8083328f0170e (diff) | |
download | eclipse.platform.swt-aa954a829806c60747c6d3d072adbc875dc61bcd.tar.gz eclipse.platform.swt-aa954a829806c60747c6d3d072adbc875dc61bcd.tar.xz eclipse.platform.swt-aa954a829806c60747c6d3d072adbc875dc61bcd.zip |
Bug 467656 - CCombo dropdown popup doesn't close automatically
Change-Id: Icedbaaf8bb692861225511711b7adf257cf66bf3
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java index 79aa70220b..7d553a3a55 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java @@ -1618,39 +1618,39 @@ long /*int*/ windowProc () { } long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /*int*/ lParam) { - if (!OS.IsUnicode || handle == 0 || lParam == 0 || (state & HAS_AUTO_DIRECTION) == 0) { - return callWindowProc (hwnd, msg, wParam, lParam); + /* Below code is to support auto text direction. */ + if (OS.IsUnicode && handle != 0 && lParam != 0 && (state & HAS_AUTO_DIRECTION) != 0) { + switch (msg) { + case OS.LB_ADDSTRING: + case OS.LB_INSERTSTRING: + case OS.LB_FINDSTRINGEXACT: + int length = OS.wcslen (lParam); // we are always Unicode here + int cp = getCodePage (); + TCHAR buffer = new TCHAR (cp, length); + OS.MoveMemory (buffer, lParam, buffer.length () * TCHAR.sizeof); + String string = buffer.toString (0, length); + int direction = resolveTextDirection (string); + if (direction == SWT.NONE) { + /* + * Force adding a UCC even when no strong characters are found. + * Otherwise, the List items would retain the old direction, + * which might be inappropriate for the new text. + */ + direction = (style & SWT.RIGHT_TO_LEFT) != 0 ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT; + } + string = (direction == SWT.RIGHT_TO_LEFT ? RLE : LRE) + string; + buffer = new TCHAR (cp, string, true); + long /*int*/ hHeap = OS.GetProcessHeap (); + length = buffer.length() * TCHAR.sizeof; + long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, length); + OS.MoveMemory (pszText, buffer, length); + long /*int*/ code = super.windowProc (hwnd, msg, wParam, pszText); + OS.HeapFree (hHeap, 0, pszText); + addedUCC = true; + return code; + } } - switch (msg) { - case OS.LB_ADDSTRING: - case OS.LB_INSERTSTRING: - case OS.LB_FINDSTRINGEXACT: - int length = OS.wcslen (lParam); // we are always Unicode here - int cp = getCodePage (); - TCHAR buffer = new TCHAR (cp, length); - OS.MoveMemory (buffer, lParam, buffer.length () * TCHAR.sizeof); - String string = buffer.toString (0, length); - int direction = resolveTextDirection (string); - if (direction == SWT.NONE) { - /* - * Force adding a UCC even when no strong characters are found. - * Otherwise, the List items would retain the old direction, - * which might be inappropriate for the new text. - */ - direction = (style & SWT.RIGHT_TO_LEFT) != 0 ? SWT.RIGHT_TO_LEFT : SWT.LEFT_TO_RIGHT; - } - string = (direction == SWT.RIGHT_TO_LEFT ? RLE : LRE) + string; - buffer = new TCHAR (cp, string, true); - long /*int*/ hHeap = OS.GetProcessHeap (); - length = buffer.length() * TCHAR.sizeof; - long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, length); - OS.MoveMemory (pszText, buffer, length); - long /*int*/ code = super.windowProc (hwnd, msg, wParam, pszText); - OS.HeapFree (hHeap, 0, pszText); - addedUCC = true; - return code; - } - return callWindowProc (hwnd, msg, wParam, lParam); + return super.windowProc (hwnd, msg, wParam, lParam); } LRESULT WM_CHAR (long /*int*/ wParam, long /*int*/ lParam) { |