summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-12-02 03:59:13 +0100
committerSven Gothel <[email protected]>2012-12-02 03:59:13 +0100
commitf0f58e120817b57ed3fb70c238001579a68e4064 (patch)
tree4e0fc6e85785ae19a14d9db9feffd7a5fe859ff2
parentb6f54d1714597ba2799160569b56139277db9e07 (diff)
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 (?).
-rw-r--r--src/newt/native/WindowsWindow.c19
1 files changed, 9 insertions, 10 deletions
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;