-
Notifications
You must be signed in to change notification settings - Fork 31
NEWT Integration #13
Comments
I actually haven't done anything with NEWT yet. My experience has been This also aligns with issue #10, writing to an image. I need to try to |
For reference: Assuming that above issue is something simple, I should be able to provide the test case by the end of the week. |
So I'm not going to worry about the multi-screen issue at the moment. The following test demonstrates basic integration between NEWT and GLG2D. I'm currently on Windows 7 x64, since that is what we deploy to.
I have a basic pipeline to handle the conversion from NEWT events to AWT events. You'll notice the upper button lights up when moused over, but the bottom button only partially renders. The console output indicates that Swing is aware of the bottom button's location however, which is interesting. So anyway, this is a very basic idea of what I am trying to do. |
Thanks, Dan, I'll take a look at this. |
I'm including a patch of the work I did to make your NEWT test work for I did several things
Do you mind if I merge some of your code into the main glg2d trunk? I diff --git a/src/main/java/org/jogamp/glg2d/newt/NewtAWTEventFactory.java import jogamp.newt.awt.event.AWTNewtEventFactory; @@ -22,43 +25,42 @@
- private final static IntIntHashMap BUTTON_MASKS_NEWT_2_AWT;- private static final int KEY_NOT_FOUND = 0xFFFFFFFF;
- EVENT_TYPE_NEWT_2_AWT.setKeyNotFoundValue(KEY_NOT_FOUND);
- }
- BUTTON_MASKS_NEWT_2_AWT.put(0, 0);
- }
|
Take whatever you need. If you need me to do anything let me know, I'm new to Git and Github. I might also have a solution for the non-visible swing hierarchy. I'll keep you posted here. |
What do you mean by 'non-visible swing hierarchy'? Your NEWT example
and that tricks the JComponent into thinking it should allow painting. |
By non-visible I mean a swing hierarchy outside of a top-level container (aka Window). I'm pretty sure the notifyAdd() generates the native peer for the hierarchy. The peer used on a non-window hierarchy is a NullComponentPeer, which essentially provides bare bones support for the EDT. I'm afraid some Swing functionality may be lost because of this. I'll work on a test case to verify this. |
I'm closing this with commit 30cb550. You can see https://raw.github.com/brandonborkholder/glg2d/master/src/test/java/org/jogamp/glg2d/examples/NewtExample.java for an example of how I've integrated glg2d into NEWT. Thanks for your help and code! I merged one of your commits into my branch, but your masterav10 name didn't get linked properly to the commit, sorry about that. If you have more comments or issues related to Newt, just re-open this issue. |
First, I've done some significant work with the integration of NEWT and GLG2D. See org.jogamp.glg2d.newt. Got a couple new issues. Notice the text fields have no cursors. This is likely a combination of not porting KeyEvents from NEWT over to AWT and a lack of focus management from native peers. When you click on a button and then drag off it, the button remains "clicked" in. Not sure what is causing this, but I think it is GLG2D. Both tests should be run with the following: -Dawt.toolkit=org.jogamp.glg2d.newt.GLG2DWindowToolkit |
What JVM and version did you use to build this? I'm getting some errors with the implementation of the GLG2DWindowToolkit. Missing methods, non-existent classes and such. I'm using Oracle's 1.6.0_30 |
Oracle JDK 1.7.0_09. Platform is Windows 7 x64. But if you are asking that question, I'm afraid this may be a lot more work than I originally intended. As you know, our current implementation uses a windowless component as the root. This is a problem because we use methods like isVisible() or isDisplayable() which do not work properly in a windowless container. So far the only solution I see is to create a custom toolkit and provide a "native" window peer, which essentially hooks into the GLWindow provided. I was hoping I could leave most methods as stubs, but it looks like the peer interfaces are used differently depending on the platform and JDK version. In addition to the problem above, some components do not behave correctly. At this time I cannot deduce if the problem is caused by Swing or GLG2D. The following components are a problem:
I'm planning on making individual test cases for the components specified here: |
Well, I'm not giving up yet. I did some work over the weekend. Somebody As far as I can tell, a new Toolkit implementation is the only way to use |
Tests for newt have been updated: Whew... and now I know why caciocavallo exists. I recommend using Java 1.7 for my test cases. The peer interfaces have changed radically between 1.6 and 1.7 to point where it will become a nightmare to try and maintain compatability with both. I'll leave the stubs in there for now, however. If I can figure out how to build OpenJDK on Windows, I'll give caciocavallo a shot. |
Agreed. it really is quite a task. Since this is really such a hack, I I figured out why your button example doesn't work and that's going to take Thanks for pushing these examples, any tests you can send me are |
Made a bunch of changes over the past couple of days. I moved all Newt-related code into the org.jogamp.glg2d.newt. I've also done significant work with the peer components. The following now works:
I recommend using this test case for identifying issues: I'm currently running through my tests to see what else needs to be done. I assume when you fix that button issue it will fix some of the other funny business I'm attributing to mouse dragging (such as selecting text in a textbox). Also, to get JTrees and Internal Frames to work, I had to modify the following class. Look for the XXX comment. |
I've create a new branch to address a repaint issue. GLG2D performs slow with complex structures such as JTables. TabbedPaneTest in master should demonstrate this (watch the flickering canvas). I created a new branch for painting using the [paint immediately](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#paintImmediately(int, int, int, int) function inside of a custom repaint manager. A new listener in GLG2DWindow paints dirty components to an FBO that maintains cumulative changes, and then blits the framebuffer over to the main framebuffer as the final step during each draw. Still has some kinks in it. In general, I think I'm missing a significant amount of AWT generated events, and that is why some of the components do not behave like I expect them to. GLG2DWindow is no longer headless, and I'm planning on pushing all GLWindow-related functionality into the peer layer. It will extends JFrame once I am done, and behave just like one. Take a look at the immediate-paints branch, I'm curious what you think about my approach. |
I would like to know what needs to be done to integrate this library with a NEWT Window. My particular requirements are as follows:
I had minor success integrating a GLWindow and JPanel with a single button using GLG2D, but adding more components resulted in weird drawing behavior I haven't been able to track down.
Let me know how interested you are in incorporating this feature. If it seems feasible, I most certainly can offer some assistance in its development. I doubt I'm the only person interested in seeing a solution to this problem. At the very least, I think some correspondence will bring the issues to light and create a road map for the solution.
The text was updated successfully, but these errors were encountered: