2 messages in net.java.dev.jna.usersget the pointer for a Canvas
FromSent OnAttachments
Diego Conde PérezAug 8, 2007 9:05 am 
Timothy WallAug 8, 2007 9:36 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:get the pointer for a CanvasActions...
From:Diego Conde Pérez (dcon@gmail.com)
Date:Aug 8, 2007 9:05:27 am
List:net.java.dev.jna.users

Hi,

First of all, good work!!! This library is incredible, I've been dreaming for something similar for years.

I've been trying to use the libvlc (http://www.videolan.org) throught jna, and it worked perfectly (divX inside a JFrame seems to be a dream). The problem is that the only way that I can tell the libvlc where it has to display the multimedia content is with a drawable (Drawable on X11, CGrafPort on MacOSX, HWND on Win32). Now, there is a method com.sun.jna.Native.getWindowPointer that works well for JFrames, but if I want to put the video inside a Canvas and I can't (well, actually I can but with JNI, and I use jna to avoid this).

The solution seems to be simple, in the com.sun.jna.Native class create the couterparts of getWindowPointer and getWindowHandle0, in this case getCanvasPointer and getCanvasHandle0 (maybe a generic getComponentPointer). I'm not completely sure, but I think that the implementation of getCanvasHandle0 can be identical to getWindowHandle0 because awt.GetDrawingSurface(env, w) can receive a canvas instead of a window.

I think that this functionality can be really useful to embed native display (I think that Gecko has a similar method).

Thanks again for this great job.

Diego