summaryrefslogtreecommitdiffstats
path: root/src/newt/native/WindowsWindow.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-10-01 23:58:43 +0200
committerSven Gothel <[email protected]>2015-10-01 23:58:43 +0200
commitf60bc2eb827a89d5d26d7348761da268306c0623 (patch)
tree9eedd9b4a58618c41172b7a34b983614df68b68f /src/newt/native/WindowsWindow.c
parenta9b3f6d13b45284e81b91a1e1e31b35c31dd3670 (diff)
Bug 1205: Revert clear background to support fix for Bug 1232: NEWT Translucency Windows >= 8
Reverting 'clear backrgound' portion of commit f607c0148736fa198fb91b60123824e53366022e. It has been identified, that Windows does initialize onscreen windows (i.e. w/ white/DESKTOP color). This is also required for allowing translucent windows, since clearing the background intefers on Windows >= 8 (undecorated windows).
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rw-r--r--src/newt/native/WindowsWindow.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index c004f48a1..882559551 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -936,6 +936,7 @@ static void sendTouchScreenEvent(JNIEnv *env, jobject window,
jNames, jX, jY, jPressure, (jfloat)maxPressure);
}
+// #define DO_ERASEBKGND 1
static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam) {
LRESULT res = 0;
@@ -1077,9 +1078,15 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
case WM_PAINT: {
if( wud->isInCreation ) {
+ #ifdef DO_ERASEBKGND
if (GetUpdateRect(wnd, NULL, TRUE /* erase background */)) {
DBG_PRINT("*** WindowsWindow: WM_PAINT.0 (dirty)\n");
// WM_ERASEBKGND sent!
+ #else
+ if (GetUpdateRect(wnd, NULL, FALSE /* do not erase background */)) {
+ DBG_PRINT("*** WindowsWindow: WM_PAINT.0 (dirty)\n");
+ ValidateRect(wnd, NULL); // clear all!
+ #endif
} else {
DBG_PRINT("*** WindowsWindow: WM_PAINT.0 (clean)\n");
}
@@ -1100,13 +1107,23 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
}
case WM_ERASEBKGND:
if( wud->isInCreation ) {
- PAINTSTRUCT ps;
- HDC hdc;
- hdc = BeginPaint(wnd, &ps);
- DBG_PRINT("*** WindowsWindow: WM_ERASEBKGND.0 (erasure) l/b %d/%d r/t %d/%d\n",
- ps.rcPaint.left, ps.rcPaint.bottom, ps.rcPaint.right, ps.rcPaint.top);
- FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW+1));
- EndPaint(wnd, &ps);
+ #ifdef DO_ERASEBKGND
+ // On Windows the initial window is clean?!
+ // This fill destroys translucency on Windows 10
+ // (which only seem to work on undecorated windows)
+ PAINTSTRUCT ps;
+ HDC hdc;
+ hdc = BeginPaint(wnd, &ps);
+ DBG_PRINT("*** WindowsWindow: WM_ERASEBKGND.0 (erasure) l/b %d/%d r/t %d/%d\n",
+ ps.rcPaint.left, ps.rcPaint.bottom, ps.rcPaint.right, ps.rcPaint.top);
+ // FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW+1));
+ // FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_APPWORKSPACE+1));
+ // A black color also sets alpha to zero for translucency!
+ FillRect(hdc, &ps.rcPaint, (HBRUSH)GetStockObject(BLACK_PEN));
+ EndPaint(wnd, &ps);
+ #else
+ ValidateRect(wnd, NULL); // clear all!
+ #endif
res = 1; // return 1 == done
} else {
// ignore erase background, but let NEWT render the whole client area