From da1b81a57de0c6a4ae3efd77a72942d15d1e3307 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 26 Jun 2006 14:24:45 +0000 Subject: [PATCH] Windows: Moved is_dirty from native to java --- src/java/org/lwjgl/opengl/Win32Display.java | 16 +++++++++++++++- src/native/win32/org_lwjgl_opengl_Display.c | 14 -------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/java/org/lwjgl/opengl/Win32Display.java b/src/java/org/lwjgl/opengl/Win32Display.java index 7f11d456..ca5d9b23 100644 --- a/src/java/org/lwjgl/opengl/Win32Display.java +++ b/src/java/org/lwjgl/opengl/Win32Display.java @@ -62,6 +62,7 @@ final class Win32Display implements DisplayImplementation { private final static int WM_QUIT = 0x0012; private final static int WM_SYSCOMMAND = 0x0112; + private final static int WM_PAINT = 0x000F; private final static int SC_SIZE = 0xF000; private final static int SC_MOVE = 0xF010; @@ -90,9 +91,11 @@ final class Win32Display implements DisplayImplementation { private static WindowsMouse mouse; private static boolean close_requested; + private static boolean is_dirty; public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { close_requested = false; + is_dirty = false; nCreateWindow(mode, fullscreen, x, y); peer_info.initDC(); } @@ -136,14 +139,22 @@ final class Win32Display implements DisplayImplementation { private native String nGetVersion(String driver); public native DisplayMode init() throws LWJGLException; public native void setTitle(String title); + public boolean isCloseRequested() { boolean saved = close_requested; close_requested = false; return saved; } + public native boolean isVisible(); public native boolean isActive(); - public native boolean isDirty(); + + public boolean isDirty() { + boolean saved = is_dirty; + is_dirty = false; + return saved; + } + public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { peer_info = new Win32DisplayPeerInfo(pixel_format); return peer_info; @@ -381,6 +392,9 @@ final class Win32Display implements DisplayImplementation { break; } return false; + case WM_PAINT: + is_dirty = true; + return false; default: return false; } diff --git a/src/native/win32/org_lwjgl_opengl_Display.c b/src/native/win32/org_lwjgl_opengl_Display.c index 76fb3cc2..1e22a225 100644 --- a/src/native/win32/org_lwjgl_opengl_Display.c +++ b/src/native/win32/org_lwjgl_opengl_Display.c @@ -54,7 +54,6 @@ static HDC display_hdc = NULL; // Device context static bool isFullScreen = false; // Whether we're fullscreen or not static bool isMinimized = false; // Whether we're minimized or not static bool isFocused = false; // whether we're focused or not -static bool isDirty = false; // Whether we're dirty or not static bool isUndecorated = false; // Whether we're undecorated or not static bool did_maximize = false; // A flag to tell when a window // has recovered from minimized @@ -156,10 +155,6 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd, break; } break; - case WM_PAINT: - { - isDirty = true; - } } env = (JNIEnv *)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA); @@ -232,14 +227,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nUpdate handleMessages(env); } - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isDirty - (JNIEnv *env, jobject self) { - bool result = isDirty; - isDirty = false; - return result ? JNI_TRUE : JNI_FALSE; -} - JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isVisible (JNIEnv *env, jobject self) { return isMinimized ? JNI_FALSE : JNI_TRUE; @@ -272,7 +259,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateWindow(JNIEnv * isMinimized = false; isFocused = false; - isDirty = true; isFullScreen = fullscreen == JNI_TRUE; isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); display_hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, isFullScreen, isUndecorated);