Windows: moved closerequested from native to java
This commit is contained in:
parent
6cf49718db
commit
c2dfea3214
|
@ -60,12 +60,39 @@ final class Win32Display implements DisplayImplementation {
|
||||||
private final static int WM_MBUTTONDBLCLK = 0x0209;
|
private final static int WM_MBUTTONDBLCLK = 0x0209;
|
||||||
private final static int WM_MOUSEWHEEL = 0x020A;
|
private final static int WM_MOUSEWHEEL = 0x020A;
|
||||||
|
|
||||||
|
private final static int WM_QUIT = 0x0012;
|
||||||
|
private final static int WM_SYSCOMMAND = 0x0112;
|
||||||
|
|
||||||
|
private final static int SC_SIZE = 0xF000;
|
||||||
|
private final static int SC_MOVE = 0xF010;
|
||||||
|
private final static int SC_MINIMIZE = 0xF020;
|
||||||
|
private final static int SC_MAXIMIZE = 0xF030;
|
||||||
|
private final static int SC_NEXTWINDOW = 0xF040;
|
||||||
|
private final static int SC_PREVWINDOW = 0xF050;
|
||||||
|
private final static int SC_CLOSE = 0xF060;
|
||||||
|
private final static int SC_VSCROLL = 0xF070;
|
||||||
|
private final static int SC_HSCROLL = 0xF080;
|
||||||
|
private final static int SC_MOUSEMENU = 0xF090;
|
||||||
|
private final static int SC_KEYMENU = 0xF100;
|
||||||
|
private final static int SC_ARRANGE = 0xF110;
|
||||||
|
private final static int SC_RESTORE = 0xF120;
|
||||||
|
private final static int SC_TASKLIST = 0xF130;
|
||||||
|
private final static int SC_SCREENSAVE = 0xF140;
|
||||||
|
private final static int SC_HOTKEY = 0xF150;
|
||||||
|
private final static int SC_DEFAULT = 0xF160;
|
||||||
|
private final static int SC_MONITORPOWER = 0xF170;
|
||||||
|
private final static int SC_CONTEXTHELP = 0xF180;
|
||||||
|
private final static int SC_SEPARATOR = 0xF00F;
|
||||||
|
|
||||||
private static Win32DisplayPeerInfo peer_info;
|
private static Win32DisplayPeerInfo peer_info;
|
||||||
|
|
||||||
private static WindowsKeyboard keyboard;
|
private static WindowsKeyboard keyboard;
|
||||||
private static WindowsMouse mouse;
|
private static WindowsMouse mouse;
|
||||||
|
|
||||||
|
private static boolean close_requested;
|
||||||
|
|
||||||
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;
|
||||||
nCreateWindow(mode, fullscreen, x, y);
|
nCreateWindow(mode, fullscreen, x, y);
|
||||||
peer_info.initDC();
|
peer_info.initDC();
|
||||||
}
|
}
|
||||||
|
@ -109,7 +136,11 @@ 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 native boolean isCloseRequested();
|
public boolean isCloseRequested() {
|
||||||
|
boolean saved = close_requested;
|
||||||
|
close_requested = false;
|
||||||
|
return saved;
|
||||||
|
}
|
||||||
public native boolean isVisible();
|
public native boolean isVisible();
|
||||||
public native boolean isActive();
|
public native boolean isActive();
|
||||||
public native boolean isDirty();
|
public native boolean isDirty();
|
||||||
|
@ -333,6 +364,23 @@ final class Win32Display implements DisplayImplementation {
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
handleMouseButton(2, 0);
|
handleMouseButton(2, 0);
|
||||||
return true;
|
return true;
|
||||||
|
case WM_QUIT:
|
||||||
|
close_requested = true;
|
||||||
|
return true;
|
||||||
|
case WM_SYSCOMMAND:
|
||||||
|
switch ((int)wParam) {
|
||||||
|
case SC_KEYMENU:
|
||||||
|
case SC_MOUSEMENU:
|
||||||
|
case SC_SCREENSAVE:
|
||||||
|
case SC_MONITORPOWER:
|
||||||
|
return true;
|
||||||
|
case SC_CLOSE:
|
||||||
|
close_requested = true;
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,6 @@ static bool isUndecorated = false; // Whether we're undecorated o
|
||||||
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
|
||||||
|
|
||||||
static bool closerequested;
|
|
||||||
|
|
||||||
#define WINDOWCLASSNAME "LWJGL"
|
#define WINDOWCLASSNAME "LWJGL"
|
||||||
|
|
||||||
bool getCurrentFullscreen() {
|
bool getCurrentFullscreen() {
|
||||||
|
@ -136,24 +134,6 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
|
||||||
setupCursorClipping();
|
setupCursorClipping();
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
// disable screen saver and monitor power down messages which wreak havoc
|
// disable screen saver and monitor power down messages which wreak havoc
|
||||||
case WM_SYSCOMMAND:
|
|
||||||
{
|
|
||||||
switch (wParam) {
|
|
||||||
case SC_KEYMENU:
|
|
||||||
case SC_MOUSEMENU:
|
|
||||||
// Ignore system menu retrieval
|
|
||||||
case SC_SCREENSAVE:
|
|
||||||
case SC_MONITORPOWER:
|
|
||||||
return 0L;
|
|
||||||
break;
|
|
||||||
case SC_CLOSE:
|
|
||||||
closerequested = true;
|
|
||||||
//don't continue processing this command since this
|
|
||||||
//would shutdown the window, which the application might not want to
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
case WA_ACTIVE:
|
case WA_ACTIVE:
|
||||||
|
@ -176,11 +156,6 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_QUIT:
|
|
||||||
{
|
|
||||||
closerequested = true;
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
|
@ -270,13 +245,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isVisible
|
||||||
return isMinimized ? JNI_FALSE : JNI_TRUE;
|
return isMinimized ? JNI_FALSE : JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isCloseRequested
|
|
||||||
(JNIEnv *env, jobject self) {
|
|
||||||
bool saved = closerequested;
|
|
||||||
closerequested = false;
|
|
||||||
return saved;
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isActive
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isActive
|
||||||
(JNIEnv *env, jobject self) {
|
(JNIEnv *env, jobject self) {
|
||||||
return isFocused;
|
return isFocused;
|
||||||
|
@ -302,7 +270,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nCreateWindow(JNIEnv *
|
||||||
oneShotInitialised = true;
|
oneShotInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
closerequested = false;
|
|
||||||
isMinimized = false;
|
isMinimized = false;
|
||||||
isFocused = false;
|
isFocused = false;
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
|
|
Loading…
Reference in New Issue