Windows: Moved is_dirty from native to java
This commit is contained in:
parent
13d345abce
commit
da1b81a57d
|
@ -62,6 +62,7 @@ final class Win32Display implements DisplayImplementation {
|
||||||
|
|
||||||
private final static int WM_QUIT = 0x0012;
|
private final static int WM_QUIT = 0x0012;
|
||||||
private final static int WM_SYSCOMMAND = 0x0112;
|
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_SIZE = 0xF000;
|
||||||
private final static int SC_MOVE = 0xF010;
|
private final static int SC_MOVE = 0xF010;
|
||||||
|
@ -90,9 +91,11 @@ final class Win32Display implements DisplayImplementation {
|
||||||
private static WindowsMouse mouse;
|
private static WindowsMouse mouse;
|
||||||
|
|
||||||
private static boolean close_requested;
|
private static boolean close_requested;
|
||||||
|
private static boolean is_dirty;
|
||||||
|
|
||||||
public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException {
|
public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException {
|
||||||
close_requested = false;
|
close_requested = false;
|
||||||
|
is_dirty = false;
|
||||||
nCreateWindow(mode, fullscreen, x, y);
|
nCreateWindow(mode, fullscreen, x, y);
|
||||||
peer_info.initDC();
|
peer_info.initDC();
|
||||||
}
|
}
|
||||||
|
@ -136,14 +139,22 @@ final class Win32Display implements DisplayImplementation {
|
||||||
private native String nGetVersion(String driver);
|
private native String nGetVersion(String driver);
|
||||||
public native DisplayMode init() throws LWJGLException;
|
public native DisplayMode init() throws LWJGLException;
|
||||||
public native void setTitle(String title);
|
public native void setTitle(String title);
|
||||||
|
|
||||||
public boolean isCloseRequested() {
|
public boolean isCloseRequested() {
|
||||||
boolean saved = close_requested;
|
boolean saved = close_requested;
|
||||||
close_requested = false;
|
close_requested = false;
|
||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public native boolean isVisible();
|
public native boolean isVisible();
|
||||||
public native boolean isActive();
|
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 {
|
public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException {
|
||||||
peer_info = new Win32DisplayPeerInfo(pixel_format);
|
peer_info = new Win32DisplayPeerInfo(pixel_format);
|
||||||
return peer_info;
|
return peer_info;
|
||||||
|
@ -381,6 +392,9 @@ final class Win32Display implements DisplayImplementation {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
case WM_PAINT:
|
||||||
|
is_dirty = true;
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ static HDC display_hdc = NULL; // Device context
|
||||||
static bool isFullScreen = false; // Whether we're fullscreen or not
|
static bool isFullScreen = false; // Whether we're fullscreen or not
|
||||||
static bool isMinimized = false; // Whether we're minimized or not
|
static bool isMinimized = false; // Whether we're minimized or not
|
||||||
static bool isFocused = false; // whether we're focused 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 isUndecorated = false; // Whether we're undecorated or not
|
||||||
static bool did_maximize = false; // A flag to tell when a window
|
static bool did_maximize = false; // A flag to tell when a window
|
||||||
// has recovered from minimized
|
// has recovered from minimized
|
||||||
|
@ -156,10 +155,6 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_PAINT:
|
|
||||||
{
|
|
||||||
isDirty = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
env = (JNIEnv *)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
env = (JNIEnv *)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||||
|
@ -232,14 +227,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nUpdate
|
||||||
handleMessages(env);
|
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
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isVisible
|
||||||
(JNIEnv *env, jobject self) {
|
(JNIEnv *env, jobject self) {
|
||||||
return isMinimized ? JNI_FALSE : JNI_TRUE;
|
return isMinimized ? JNI_FALSE : JNI_TRUE;
|
||||||
|
@ -272,7 +259,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateWindow(JNIEnv *
|
||||||
|
|
||||||
isMinimized = false;
|
isMinimized = false;
|
||||||
isFocused = false;
|
isFocused = false;
|
||||||
isDirty = true;
|
|
||||||
isFullScreen = fullscreen == JNI_TRUE;
|
isFullScreen = fullscreen == JNI_TRUE;
|
||||||
isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
|
isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated");
|
||||||
display_hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, isFullScreen, isUndecorated);
|
display_hwnd = createWindow(WINDOWCLASSNAME, x, y, width, height, isFullScreen, isUndecorated);
|
||||||
|
|
Loading…
Reference in New Issue