Issues With JAWT_MacOSXDrawingSurfaceInfo
Issues With JAWT_MacOSXDrawingSurfaceInfo
- Subject: Issues With JAWT_MacOSXDrawingSurfaceInfo
- From: "Satisha A M." <email@hidden>
- Date: Thu, 9 Aug 2007 11:08:07 +0530
- Thread-topic: Issues With JAWT_MacOSXDrawingSurfaceInfo
Hello Group,
We have a standalone java application which (among other things) plays
Quicktime videos. On Mac, we were using QT for Java. We are now
replacing this with the native QuickTime framework APIs.
We require the media to play in a child window (java frame) of the main
window. We are facing some problem while getting the child window
reference from the Drawing Surface Information. Whatever the window
reference we are getting from the Drawing Surface Information is the
main window reference. If we set the port of this main window then our
movie start playing in the center of the window, instead of the place
where we actually want to play (centre of the frame, which is in a
corner of the window). The snippet of the code that we used to get the
window reference is below.
The code below works fine on Windows, but not on Mac. The only change in
the code is that in Mac we replaced JAWT_Win32DrawingSurfaceInfo
structure with JAWT_MacOSXDrawingSurfaceInfo structure and used some
Cocoa APIs to get the window reference. We checked if there are any
child window/sub views attached to the main window, but the APIs return
no child window and no sub views.
Is there a solution or workaround for this problem? Are there
alternative approaches in Mac to get the required child window
reference.
Code Snippet:
JAWT awt;
JAWT_DrawingSurface* ds;
JAWT_DrawingSurfaceInfo* dsi;
JAWT_MacOSXDrawingSurfaceInfo *dsi_mac;
#ifdef WINDOWS
JAWT_Win32DrawingSurfaceInfo* dsi_w32;
#endif
jint lock;
/* Get the AWT */
awt.version = JAWT_VERSION_1_4;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
printf("AWT Not found\n");
return false;
}
/* Get the drawing surface */
ds = awt.GetDrawingSurface(env, canvas);
if (ds == NULL) {
printf("NULL drawing surface\n");
return false;
}
/* Lock the drawing surface */
lock = ds->Lock(ds);
if((lock & JAWT_LOCK_ERROR) != 0) {
printf("Error locking surface\n");
awt.FreeDrawingSurface(ds);
return false;
}
/* Get the drawing surface info */
dsi = ds->GetDrawingSurfaceInfo(ds);
if (dsi == NULL) {
printf("Error getting surface info\n");
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
return false;
}
/* Get the platform-specific drawing info */
#ifdef WINDOWS
dsi_w32 = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
hWnd = dsi_w32->hwnd;
hDC = dsi_w32->hdc;
#endif
dsi_mac = new JAWT_MacOSXDrawingSurfaceInfo;
memset( dsi_mac, 0, sizeof(JAWT_MacOSXDrawingSurfaceInfo));
dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo;
NSView *view = dsi_mac->cocoaViewRef;
NSWindow *window = [view window];
WindowRef myWindowRef =(WindowRef) [window windowRef];
NSArray *childViews = [view subviews];
printf(" count: %d\n", [childViews count]);
NSArray *childWindows = [window childWindows];
printf(" count: %d\n", [childWindows count]);
// [window setTitle:[NSString stringWithCString:"ABCDEF"]];
hWnd = myWindowRef;
delete dsi_mac;
Thanks in advance...
Best Regards,
Satish
______________________________________________________________
DISCLAIMER:
This electronic message and any attachments to this electronic message is
intended for the exclusive use of the addressee(s) named herein and may contain
legally privileged and confidential information. It is the property of Celstream
Technologies Limited. If you are not the intended recipient, you are hereby
strictly notified not to copy, forward, distribute or use this message or any
attachments thereto. If you have received this message in error, please delete
it and all copies thereof, from your system and notify the sender at Celstream
Technologies or email@hidden, immediately.
__________________________________________________________
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden