java

Nundrum 2022-03-30T13:35:53.239729Z

Time for a crazy java question. My goal is to do in Java/AWT/X11 what happens in vroot.h: find the ID of an existing window and use that ID to draw in that window. Easy to do in C. But Java necessarily covers that up. I believe all I need to do is take the line below and replace the call to XCreateWindow and just assign the window ID I have. https://github.com/openjdk/client/blob/master/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java#L380 The question is how to do that without patching AWT itself.

Nundrum 2022-03-30T13:36:36.132579Z

I think I can do that by extending all of the classes in this tree? Class XWindowPeer

sun.awt.X11.XBaseWindow                     <-- XCreateWindow happens here  
   sun.awt.X11.XWindow                                                     
       sun.awt.X11.XComponentPeer                                          
           sun.awt.X11.XCanvasPeer                                         
               sun.awt.X11.XPanelPeer                                      
                   sun.awt.X11.XWindowPeer                                 

emccue 2022-03-30T13:42:07.509139Z

Why not copy paste those classes and put a 2 on the end?

emccue 2022-03-30T13:42:36.554319Z

No need to be smart particuarly

Nundrum 2022-03-30T14:03:26.793519Z

I guess? I was going to call them, for example, XForeignBaseWindow

Nundrum 2022-03-30T14:03:42.562679Z

I've pretty much tried that but keep running into compile issues

Nundrum 2022-03-30T14:04:25.709699Z

symbol: class ForeignComponentPeer
/home/robbie/Wrkspc/jnatest/src/java/XForeignComponentPeer.java:112: error: cannot find symbol
    XForeignComponentPeer (XCreateWindowParams params) {

Nundrum 2022-03-30T14:04:47.721139Z

I put this in project.clj: *:java-source-paths* ["src/java","/home/robbie/Git/openjdk-client/src/java.desktop"]

Nundrum 2022-03-30T14:45:56.934059Z

Hrm I got some improvement by changing java source paths to:

openjdk-client/src/java.desktop/unix/classes
openjdk-client/src/java.desktop/unix/native 
openjdk-client/src/java.desktop/share/classes

Nundrum 2022-03-30T15:13:41.252569Z

Keep getting stuck on this:

src/java/XForeignComponentPeer.java:1162: error: cannot find symbol                                                                                                                   
    protected boolean isEventDisabled(XEvent e) {
                                      ^
  symbol:   class XEvent
  location: class XForeignComponentPeer

Nundrum 2022-03-30T22:13:48.993499Z

Here's an attempt to separate out just the Java parts https://github.com/robbieh/AWTForeignXWindow/