1 year ago

#379478

test-img

robbie.huffman

Using Java to paint on an X11 window by ID

My goal is to use Java libraries to paint on an X11 window. The problem is I want to do this on a window that already exists and that I know the window ID of it. I've done this with C and Rust, but would like to use Java now.

I can find in AWT where it creates a window and gets a window ID: https://github.com/openjdk/client/blob/master/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java#L380

I believe that "injecting" the ID here would go a long way to accomplishing the goal.

How should I go about changing this behavior? I've tried making classes to extend the relevant AWT classes, but run into problems with my code not being in the right package. [1]

I've tried reflection, but get stuck with the XFramePeer object and can't access any fields/methods of it's superclass. [2]

Yes, I understand this may be a fool's errand.

Code samples: 1: In Java - https://github.com/robbieh/AWTForeignXWindow 2: In Clojure - https://gist.github.com/robbieh/c4662690abff19fc1cca12decd9b486e

java

clojure

awt

x11

0 Answers

Your Answer

Accepted video resources