summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
diff options
context:
space:
mode:
authorSteve Northover <steve>2007-11-20 19:35:49 +0000
committerSteve Northover <steve>2007-11-20 19:35:49 +0000
commita79421b289a1456a8fdd45128d93bc71655bcab4 (patch)
tree3a7e958be4d3c44c688f354a46335b5d0cc6276f /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
parent192f7b9c21778450242073e90e5aa6e9fdd698d4 (diff)
downloadeclipse.platform.swt-a79421b289a1456a8fdd45128d93bc71655bcab4.tar.gz
eclipse.platform.swt-a79421b289a1456a8fdd45128d93bc71655bcab4.tar.xz
eclipse.platform.swt-a79421b289a1456a8fdd45128d93bc71655bcab4.zip
209960 - Combo widgets cause area beneath them to flicker when resized
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java45
1 files changed, 43 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
index d0b7744e46..93ee41b305 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
@@ -54,7 +54,7 @@ import org.eclipse.swt.events.*;
*/
public class Combo extends Composite {
- boolean noSelection, ignoreDefaultSelection, ignoreCharacter, ignoreModify;
+ boolean noSelection, ignoreDefaultSelection, ignoreCharacter, ignoreModify, ignoreResize;
int scrollWidth, visibleCount = 5;
int /*long*/ cbtHook;
/**
@@ -279,6 +279,14 @@ public void addVerifyListener (VerifyListener listener) {
int /*long*/ callWindowProc (int /*long*/ hwnd, int msg, int /*long*/ wParam, int /*long*/ lParam) {
if (handle == 0) return 0;
if (hwnd == handle) {
+ switch (msg) {
+ case OS.WM_SIZE: {
+ ignoreResize = true;
+ int result = OS.CallWindowProc (ComboProc, hwnd, msg, wParam, lParam);
+ ignoreResize = false;
+ break;
+ }
+ }
return OS.CallWindowProc (ComboProc, hwnd, msg, wParam, lParam);
}
int /*long*/ hwndText = OS.GetDlgItem (handle, CBID_EDIT);
@@ -2107,7 +2115,17 @@ LRESULT WM_SETFOCUS (int /*long*/ wParam, int /*long*/ lParam) {
return null;
}
-LRESULT WM_SIZE (int /*long*/ wParam, int /*long*/ lParam) {
+LRESULT WM_SIZE (int /*long*/ wParam, int /*long*/ lParam) {
+ /*
+ * Feature in Windows. When a combo box is resized,
+ * the size of the drop down rectangle is specified
+ * using the height and then the combo box resizes
+ * to be the height of the text field. This causes
+ * two WM_SIZE messages to be sent and two SWT.Resize
+ * events to be issued. The fix is to ignore the
+ * second resize.
+ */
+ if (ignoreResize) return null;
/*
* Bug in Windows. If the combo box has the CBS_SIMPLE style,
* the list portion of the combo box is not redrawn when the
@@ -2182,6 +2200,29 @@ LRESULT WM_SIZE (int /*long*/ wParam, int /*long*/ lParam) {
return result;
}
+LRESULT WM_WINDOWPOSCHANGING (int /*long*/ wParam, int /*long*/ lParam) {
+ /*
+ * Feature in Windows. When a combo box is resized,
+ * the size of the drop down rectangle is specified
+ * using the height and then the combo box resizes
+ * to be the height of the text field. This causes
+ * sibling windows that intersect with the original
+ * bounds to redrawn. The fix is to stop the redraw
+ * using SWP_NOREDRAW and then damage only the combo
+ * box text field.
+ */
+ WINDOWPOS lpwp = new WINDOWPOS ();
+ OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
+ if ((lpwp.flags & OS.SWP_NOSIZE) == 0) {
+ if (ignoreResize) {
+ lpwp.flags |= OS.SWP_NOREDRAW;
+ OS.MoveMemory (lParam, lpwp, WINDOWPOS.sizeof);
+ OS.InvalidateRect (handle, null, true);
+ }
+ }
+ return super.WM_WINDOWPOSCHANGING (wParam, lParam);
+}
+
LRESULT wmChar (int /*long*/ hwnd, int /*long*/ wParam, int /*long*/ lParam) {
if (ignoreCharacter) return null;
LRESULT result = super.wmChar (hwnd, wParam, lParam);