From 176554545f88725a8dba5fdaa95ff1f1e48cdef5 Mon Sep 17 00:00:00 2001 From: trembovetski Date: Fri, 14 Aug 2009 18:04:15 -0700 Subject: newt: added expose/paint event notification needed for passive rendering. Currently only implemented on Windows. --- src/newt/native/WindowsWindow.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/newt/native/WindowsWindow.c') diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 67fbd3f07..5bd929ef7 100755 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -103,6 +103,7 @@ static jmethodID windowDestroyNotifyID = NULL; static jmethodID windowDestroyedID = NULL; static jmethodID sendMouseEventID = NULL; static jmethodID sendKeyEventID = NULL; +static jmethodID sendPaintEventID = NULL; typedef struct { JNIEnv* jenv; @@ -761,6 +762,20 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, useDefWindowProc = 1; break; + case WM_PAINT: { + RECT r; + if (GetUpdateRect(wnd, &r, FALSE)) { + if ((r.right-r.left) > 0 && (r.bottom-r.top) > 0) { + (*env)->CallVoidMethod(env, window, sendPaintEventID, + 0, r.left, r.top, r.right-r.left, r.bottom-r.top); + } + ValidateRect(wnd, &r); + useDefWindowProc = 0; + } else { + useDefWindowProc = 1; + } + break; + } case WM_ERASEBKGND: // ignore erase background useDefWindowProc = 0; @@ -902,13 +917,16 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initID windowDestroyedID = (*env)->GetMethodID(env, clazz, "windowDestroyed", "()V"); sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(IIIIII)V"); sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V"); + sendPaintEventID = (*env)->GetMethodID(env, clazz, "sendPaintEvent", "(IIIII)V"); if (sizeChangedID == NULL || positionChangedID == NULL || focusChangedID == NULL || windowDestroyNotifyID == NULL || windowDestroyedID == NULL || sendMouseEventID == NULL || - sendKeyEventID == NULL) { + sendPaintEventID == NULL || + sendKeyEventID == NULL) + { return JNI_FALSE; } BuildDynamicKeyMapTable(); -- cgit v1.2.3