Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java63
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java4
2 files changed, 63 insertions, 4 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 e8814cec90..b23aff16d4 100644
--- 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
@@ -659,7 +659,7 @@ boolean dragDetect (int /*long*/ hwnd, int x, int y, boolean filter, boolean []
boolean getBufferredPaint() {
Shell shell = getShell ();
- if ((shell.style & SWT.TRIM_FILL) != 0) return true;
+ if (((shell.style & SWT.TRIM_FILL) != 0) && ((this.style & SWT.TRIM_FILL) != 0)) return true;
return false;
}
@@ -2218,7 +2218,18 @@ int /*long*/ windowProc (int /*long*/ hwnd, int msg, int /*long*/ wParam, int /*
case OS.WM_XBUTTONUP: result = wmXButtonUp (hwnd, wParam, lParam); break;
/* Paint messages */
- case OS.WM_PAINT: result = wmPaint (hwnd, wParam, lParam); break;
+ case OS.WM_PAINT:
+ // the Edit child control of the ComboBox requires special paint handling if glass is on
+ if (hwnd == hwndText && getBufferredPaint()) {
+ result = drawBufferedText(hwnd);
+
+ // a side-effect of the glass painting is that the caret gets turned off, so we need
+ // to turn it back on once the painting is done
+ OS.ShowCaret(0);
+ } else {
+ result = wmPaint (hwnd, wParam, lParam);
+ }
+ break;
/* Menu messages */
case OS.WM_CONTEXTMENU: result = wmContextMenu (hwnd, wParam, lParam); break;
@@ -2705,4 +2716,52 @@ LRESULT wmSysKeyDown (int /*long*/ hwnd, int /*long*/ wParam, int /*long*/ lPara
return result;
}
+LRESULT wmColorChild (int /*long*/ wParam, int /*long*/ lParam) {
+ int /*long*/ hwndEdit = OS.GetDlgItem (handle, CBID_EDIT);
+ if (lParam == hwndEdit) { // is this from the Edit control?
+ // a WM_CTLCOLOREDIT message is issued by the Win32 Edit control whenever it's about to be redrawn; the
+ // Control#windowProc routes that message into here, and if glass is turned on we invalidate the window to
+ // trigger a glass-aware repaint of the control
+ if (this.getBufferredPaint() && !bPrintingClient) {
+ RECT lpRect = new RECT();
+ OS.GetClientRect(hwndEdit, lpRect);
+ OS.InvalidateRect(hwndEdit, lpRect, false);
+ }
+ }
+
+ return super.wmColorChild (wParam, lParam);
+}
+
+// this flag is used to prevent the Text#wmColorChild method from triggering a perpetual series of repaints
+private boolean bPrintingClient = false;
+
+LRESULT drawBufferedText (int /*long*/ hWnd) {
+ int /*long*/ paintDC = 0;
+ PAINTSTRUCT ps = new PAINTSTRUCT ();
+ paintDC = OS.BeginPaint (hWnd, ps);
+
+ RECT rect = new RECT();
+ OS.GetClientRect(hWnd, rect);
+
+ // set up the buffered device context - the alpha will be set to 100%, making the device context entirely opaque
+ int /*long*/ [] hdcBuffered = new int /*long*/ [1];
+ int /*long*/ hBufferedPaint = OS.BeginBufferedPaint(paintDC, rect, OS.BPBF_TOPDOWNDIB, null, hdcBuffered);
+
+ if (hdcBuffered[0] != 0) {
+ // ask the Edit control to render itself into the buffered device context; note that this will result in
+ // the Edit control issuing a WM_CTLCOLOREDIT message and we need to set the 'bPrintingClient' flag to prevent
+ // a perpetual paint sequence from being triggered
+ bPrintingClient = true;
+ OS.SendMessage(hWnd, OS.WM_PRINTCLIENT, hdcBuffered[0], OS.PRF_CLIENT);
+ bPrintingClient = false;
+
+ // entirely opaque
+ OS.BufferedPaintSetAlpha(hBufferedPaint, rect, (byte)0xFF);
+ OS.EndBufferedPaint(hBufferedPaint, true);
+ }
+
+ OS.EndPaint (handle, ps);
+ return LRESULT.ZERO;
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
index 3ec9f5c8ef..54af7c24fc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
@@ -2656,7 +2656,7 @@ boolean getBufferredPaint() {
return false;
}
-// this flag is used to prevent the Text#wmColorChild method from endlessly triggering a series of repaints
+// this flag is used to prevent the Text#wmColorChild method from triggering a perpetual series of repaints
private boolean bPrintingClient = false;
LRESULT wmBufferedPaint (int /*long*/ hWnd, int /*long*/ wParam, int /*long*/ lParam) {
@@ -2667,7 +2667,7 @@ LRESULT wmBufferedPaint (int /*long*/ hWnd, int /*long*/ wParam, int /*long*/ lP
RECT rect = new RECT();
OS.GetClientRect(hWnd, rect);
- // set up the buffered device context - the alpha is set to 100%, making the device context entirely opaque
+ // set up the buffered device context - the alpha will be set to 100%, making the device context entirely opaque
int /*long*/ [] hdcBuffered = new int /*long*/ [1];
int /*long*/ hBufferedPaint = OS.BeginBufferedPaint(paintDC, rect, OS.BPBF_TOPDOWNDIB, null, hdcBuffered);

Back to the top