Don't use Display.setParent when fullscreen set, some refactoring
This commit is contained in:
parent
d235ae5bf0
commit
f7c64c89dc
|
@ -113,7 +113,7 @@ final class MacOSXDisplay implements DisplayImplementation {
|
||||||
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
|
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
|
||||||
boolean fullscreen = Display.isFullscreen();
|
boolean fullscreen = Display.isFullscreen();
|
||||||
boolean resizable = Display.isResizable();
|
boolean resizable = Display.isResizable();
|
||||||
boolean parented = (parent != null);
|
boolean parented = (parent != null) && !fullscreen;
|
||||||
|
|
||||||
close_requested = false;
|
close_requested = false;
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ static NSAutoreleasePool *pool;
|
||||||
case kVK_Function : mask = NSFunctionKeyMask; break;
|
case kVK_Function : mask = NSFunctionKeyMask; break;
|
||||||
// case 0x?? : mask = NSNumericPadKeyMask; break; // Didn't have the keycode for this one :(
|
// case 0x?? : mask = NSNumericPadKeyMask; break; // Didn't have the keycode for this one :(
|
||||||
default:
|
default:
|
||||||
printf("Unknown modifier with keycode: %d\n", [event keyCode]);
|
NSLog(@"Unknown modifier with keycode: %d\n", [event keyCode]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,16 +310,14 @@ static NSAutoreleasePool *pool;
|
||||||
(*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 1.0f, time);
|
(*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 1.0f, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidMoveToWindow
|
- (void)viewDidMoveToWindow {
|
||||||
{
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(windowResized:)
|
selector:@selector(windowResized:)
|
||||||
name:NSWindowDidResizeNotification
|
name:NSWindowDidResizeNotification
|
||||||
object:[self window]];
|
object:[self window]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc {
|
||||||
{
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -427,11 +425,6 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow(JNIE
|
||||||
MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle);
|
MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle);
|
||||||
MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
|
MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
|
||||||
|
|
||||||
// Cache the necessary info for window-close callbacks into the JVM
|
|
||||||
if (window_info->jdisplay == NULL) {
|
|
||||||
window_info->jdisplay = (*env)->NewGlobalRef(env, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
NSRect view_rect = NSMakeRect(0.0, 0.0, width, height);
|
NSRect view_rect = NSMakeRect(0.0, 0.0, width, height);
|
||||||
window_info->view = [[MacOSXOpenGLView alloc] initWithFrame:view_rect pixelFormat:peer_info->pixel_format];
|
window_info->view = [[MacOSXOpenGLView alloc] initWithFrame:view_rect pixelFormat:peer_info->pixel_format];
|
||||||
if (window_info->context != nil) {
|
if (window_info->context != nil) {
|
||||||
|
@ -452,14 +445,21 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow(JNIE
|
||||||
default_window_mask |= NSResizableWindowMask;
|
default_window_mask |= NSResizableWindowMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parented) {
|
||||||
window_info->window = (MacOSXKeyableWindow*)[[NSApplication sharedApplication] mainWindow];
|
window_info->window = (MacOSXKeyableWindow*)[[NSApplication sharedApplication] mainWindow];
|
||||||
if (window_info->window == nil) {
|
|
||||||
window_info->window = [[MacOSXKeyableWindow alloc] initWithContentRect:window_info->display_rect styleMask:default_window_mask backing:NSBackingStoreBuffered defer:NO];
|
[window_info->window setContentView:window_info->view];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
window_info->window = [[MacOSXKeyableWindow alloc] initWithContentRect:window_info->display_rect styleMask:default_window_mask backing:NSBackingStoreBuffered defer:NO];
|
||||||
|
|
||||||
[window_info->window setContentView:window_info->view];
|
[window_info->window setContentView:window_info->view];
|
||||||
|
|
||||||
if (!parented) {
|
// Cache the necessary info for window-close callbacks into the JVM
|
||||||
|
if (window_info->jdisplay == NULL) {
|
||||||
|
window_info->jdisplay = (*env)->NewGlobalRef(env, this);
|
||||||
|
}
|
||||||
|
|
||||||
// set NSView as delegate of NSWindow to get windowShouldClose events
|
// set NSView as delegate of NSWindow to get windowShouldClose events
|
||||||
[window_info->window setDelegate:window_info->view];
|
[window_info->window setDelegate:window_info->view];
|
||||||
}
|
}
|
||||||
|
@ -514,8 +514,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyWindow(JNIEnv
|
||||||
[pool drain];
|
[pool drain];
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
|
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion(JNIEnv *env, jobject ignored) {
|
||||||
(JNIEnv *env, jobject ignored) {
|
|
||||||
return org_lwjgl_MacOSXSysImplementation_JNI_VERSION;
|
return org_lwjgl_MacOSXSysImplementation_JNI_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue