summaryrefslogtreecommitdiffstats
path: root/src/newt/native/MacWindow.m
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-27 12:20:38 +0200
committerSven Gothel <[email protected]>2011-09-27 12:20:38 +0200
commit472a9c60b5599bb01883c628339ab29628511ed5 (patch)
tree3431c8bc9da58f7e371b18657d0db99422e96245 /src/newt/native/MacWindow.m
parentdf85f0dfafc09e147f9d422adf5ee8eabf67977b (diff)
NEWT: Adapt to GlueGen's Lock ChangeSet, all java callbacks for native have 'defer' 1st argument
- Adapt to GlueGen's Lock ChangeSet: e4baba27507ce78e64a150ec6f69fb96f5721a34 - All java callbacks for native have 'defer' 1st argument. This allows enqueuing resulting events to the EDT if required, ie. the native thread may not be 'compatible' (MacOSX). - MacOSX-Native: enqueue key/mouse events and defer:=true for all java callbacks Since we are comming from a 3rd-party thread (AWT/NSApp-MainThread) we shall not abuse it.
Diffstat (limited to 'src/newt/native/MacWindow.m')
-rw-r--r--src/newt/native/MacWindow.m76
1 files changed, 59 insertions, 17 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 946ac489c..a149c74af 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -249,7 +249,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_createWindow0
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NewtView* myView = (NewtView*) (intptr_t) jview ;
- DBG_PRINT( "createWindow0 - %p (this), %p (parent), %d/%d %dx%d, opaque %d, fs %d, style %X, buffType %X, screenidx %d, view %p\n",
+ DBG_PRINT( "createWindow0 - %p (this), %p (parent), %d/%d %dx%d, opaque %d, fs %d, style %X, buffType %X, screenidx %d, view %p (START)\n",
(void*)(intptr_t)jthis, (void*)(intptr_t)parent, (int)x, (int)y, (int)w, (int)h, (int) opaque, (int)fullscreen,
(int)styleMask, (int)bufferingType, (int)screen_idx, myView);
@@ -302,18 +302,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_createWindow0
[myWindow setBackgroundColor: [NSColor clearColor]];
}
- /**
- if (fullscreen) {
- [myWindow setOpaque: YES];
- } else {
- // If the window is undecorated, assume we want the possibility of
- // a shaped window, so make it non-opaque and the background color clear
- if ((styleMask & NSTitledWindowMask) == 0) {
- [myWindow setOpaque: NO];
- [myWindow setBackgroundColor: [NSColor clearColor]];
- }
- } */
-
// specify we want mouse-moved events
[myWindow setAcceptsMouseMovedEvents:YES];
@@ -341,6 +329,9 @@ NS_ENDHANDLER
// right mouse button down events
[myView setNextResponder: myWindow];
+ DBG_PRINT( "createWindow0 - %p (this), %p (parent): new window: %p (END)\n",
+ (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow);
+
[pool release];
return (jlong) ((intptr_t) myWindow);
@@ -356,8 +347,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_makeKeyAndOrderF
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "makeKeyAndOrderFront0 - window: %p (START)\n", win);
+
[win performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:win waitUntilDone:NO];
// [win makeKeyAndOrderFront: win];
+
+ DBG_PRINT( "makeKeyAndOrderFront0 - window: %p (END)\n", win);
+
[pool release];
}
@@ -371,8 +368,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_makeKey0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "makeKey0 - window: %p (START)\n", win);
+
[win performSelectorOnMainThread:@selector(makeKeyWindow:) withObject:nil waitUntilDone:NO];
// [win makeKeyWindow];
+
+ DBG_PRINT( "makeKey0 - window: %p (END)\n", win);
+
[pool release];
}
@@ -386,8 +389,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_orderOut0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "orderOut0 - window: %p (START)\n", win);
+
[win performSelectorOnMainThread:@selector(orderOut:) withObject:win waitUntilDone:NO];
// [win orderOut: win];
+
+ DBG_PRINT( "orderOut0 - window: %p (END)\n", win);
+
[pool release];
}
@@ -431,10 +440,16 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setTitle0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "setTitle0 - window: %p (START)\n", win);
+
NSString* str = jstringToNSString(env, title);
[str autorelease];
[win performSelectorOnMainThread:@selector(setTitle:) withObject:str waitUntilDone:NO];
// [win setTitle: str];
+
+ DBG_PRINT( "setTitle0 - window: %p (END)\n", win);
+
[pool release];
}
@@ -448,7 +463,13 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_contentView0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "contentView0 - window: %p (START)\n", win);
+
jlong res = (jlong) ((intptr_t) [win contentView]);
+
+ DBG_PRINT( "contentView0 - window: %p (END)\n", win);
+
[pool release];
return res;
}
@@ -463,6 +484,11 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_changeContentVi
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSWindow* win = (NewtMacWindow*) ((intptr_t) window);
+ NewtView* newView = (NewtView *) ((intptr_t) jview);
+
+ DBG_PRINT( "changeContentView0 - window: %p (START)\n", win);
+
NSObject *nsParentObj = (NSObject*) ((intptr_t) parentWindowOrView);
NSWindow* pWin = NULL;
NSView* pView = NULL;
@@ -476,11 +502,10 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_MacWindow_changeContentVi
}
}
- NSWindow* win = (NewtMacWindow*) ((intptr_t) window);
- NewtView* newView = (NewtView *) ((intptr_t) jview);
-
NewtView* oldView = changeContentView(env, jthis, pWin, pView, win, newView);
+ DBG_PRINT( "changeContentView0 - window: %p (END)\n", win);
+
[pool release];
return (jlong) ((intptr_t) oldView);
@@ -496,8 +521,14 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setContentSize0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "setContentSize0 - window: %p (START)\n", win);
+
NSSize sz = NSMakeSize(w, h);
[win setContentSize: sz];
+
+ DBG_PRINT( "setContentSize0 - window: %p (END)\n", win);
+
[pool release];
}
@@ -512,7 +543,13 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setFrameTopLeftP
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* pwin = (NSWindow*) ((intptr_t) parent);
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "setFrameTopLeftPoint0 - window: %p (START)\n", win);
+
setFrameTopLeftPoint(pwin, win, x, y);
+
+ DBG_PRINT( "setFrameTopLeftPoint0 - window: %p (END)\n", win);
+
[pool release];
}
@@ -526,12 +563,17 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_setAlwaysOnTop0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
+
+ DBG_PRINT( "setAlwaysOnTop0 - window: %p (START)\n", win);
+
if(atop) {
[win setLevel:NSFloatingWindowLevel];
} else {
[win setLevel:NSNormalWindowLevel];
}
+
+ DBG_PRINT( "setAlwaysOnTop0 - window: %p (END)\n", win);
+
[pool release];
}
-