Windows: Moved is_dirty from native to java

This commit is contained in:
Elias Naur 2006-06-26 14:24:45 +00:00
parent 13d345abce
commit da1b81a57d
2 changed files with 15 additions and 15 deletions

View File

@ -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;
}

View File

@ -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);