From f0f58e120817b57ed3fb70c238001579a68e4064 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Dec 2012 03:59:13 +0100 Subject: Fix Bug 643: SWT 'display.asyncExec(Runnable runnable)' runnable not executed on Windows Turns out that the NEWT Windows impl. didn't properly validated the client region @ WM_PAINT and hence 'exhausted' the message pipeline, i.e. never reached an IDLE state. The latter caused SWT to never reach a point where deferred asyncExec(..) Runnables got processed. Besides this SWT effect, this also caused a NEWT window on Windows to always repaint itself (?). --- src/newt/native/WindowsWindow.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/newt/native/WindowsWindow.c') diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index e3d5cffa0..e7b454580 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -1034,23 +1034,22 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP case WM_PAINT: { RECT r; useDefWindowProc = 0; - if (GetUpdateRect(wnd, &r, TRUE /* erase background */)) { - /* - jint width = r.right-r.left; - jint height = r.bottom-r.top; - if (width > 0 && height > 0) { - (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, r.left, r.top, width, height); - } - ValidateRect(wnd, &r); - */ + if (GetUpdateRect(wnd, &r, FALSE /* do not erase background */)) { + // clear the whole client area and issue repaint for it, w/o looping through erase background + ValidateRect(wnd, NULL); // clear all! + (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1); + } else { + // shall not happen ? + ValidateRect(wnd, NULL); // clear all! } + // return 0 == done break; } case WM_ERASEBKGND: // ignore erase background (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1); useDefWindowProc = 0; - res = 1; // OpenGL, etc .. erases the background, hence we claim to have just done this + res = 1; // return 1 == done, OpenGL, etc .. erases the background, hence we claim to have just done this break; -- cgit v1.2.3