Hello, I'm working on a feasibility to start xquartz from a java process with JNI. My goal would be to keep the X server in the same process as my java application so this way I can manipulate the X windows itself (mainly reparent, resize and show/hide). To able to do the window manipulation I have to keep X and java in the same process. First I compiled xquartz as a shared object and started with server_main, but this crashed my application since the Java AWT already has an NSApplication, then I went lower level and tried with the dix_main which ended up in a segfault what I haven't debugged yet. Could somebody help me what's the right approach to do this? Thanks in advance! Lorinc
On Dec 7, 2008, at 13:13, Lorinc Hever wrote:
Hello,
I'm working on a feasibility to start xquartz from a java process with JNI. My goal would be to keep the X server in the same process as my java application so this way I can manipulate the X windows itself (mainly reparent, resize and show/hide). To able to do the window manipulation I have to keep X and java in the same process.
That's not really possible... I think what you want to do is write a window manager in java (in which case you don't actually need the server to be in the same process).
Thanks Jeremy for the prompt response! My goal is to use an X window as a plugin in a java application. In this case I have a native Aqua window with java and X11 window from the X based app. Since OS X doesn't allow you control windows from other processes it opts out the writing a window manager in java option :( Could you help me to point out why is it not possible to run XQuartz within an application on separate threads? Or give some reference where should I look it up? Thanks for your help! Lorinc On Sun, Dec 7, 2008 at 3:57 PM, Jeremy Huddleston <jeremyhu@apple.com> wrote:
On Dec 7, 2008, at 13:13, Lorinc Hever wrote:
Hello,
I'm working on a feasibility to start xquartz from a java process with JNI. My goal would be to keep the X server in the same process as my java application so this way I can manipulate the X windows itself (mainly reparent, resize and show/hide). To able to do the window manipulation I have to keep X and java in the same process.
That's not really possible... I think what you want to do is write a window manager in java (in which case you don't actually need the server to be in the same process).
_______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/xquartz-dev
7 dec 2008 kl. 22.57 skrev Jeremy Huddleston:
On Dec 7, 2008, at 13:13, Lorinc Hever wrote:
Hello,
I'm working on a feasibility to start xquartz from a java process with JNI. My goal would be to keep the X server in the same process as my java application so this way I can manipulate the X windows itself (mainly reparent, resize and show/hide). To able to do the window manipulation I have to keep X and java in the same process.
That's not really possible... I think what you want to do is write a window manager in java (in which case you don't actually need the server to be in the same process).
Actually, CrossOver seems to do this, though not in Java... I'm pretty sure they have a heavily customised X server though, they probably started with X11.app and built their interfaces around it (don't take my word for it, I'm just guessing). Maybe if you really want this you can take the same approach. Instead of embedding X11 in your app, customize X11.app to load your java code. It's probably quite a bit of work though... -- Pelle Johansson
I'm working on a feasibility to start xquartz from a java process with JNI. My goal would be to keep the X server in the same process as my java application so this way I can manipulate the X windows itself (mainly reparent, resize and show/hide). To able to do the window manipulation I have to keep X and java in the same process.
That's not really possible... I think what you want to do is write a window manager in java (in which case you don't actually need the server to be in the same process).
Actually, CrossOver seems to do this, though not in Java... I'm pretty sure they have a heavily customised X server though, they probably started with X11.app and built their interfaces around it (don't take my word for it, I'm just guessing).
Maybe if you really want this you can take the same approach. Instead of embedding X11 in your app, customize X11.app to load your java code. It's probably quite a bit of work though...
It's not that much of a mystery. They use quartz-wm, just like X11.app does ;) Like I said, what you're looking for is the functionality of a window manager, not the X server itself. --Jeremy
Thanks for the reply Pelle, Jeremy! Yes if I both the target and the parent Window is an X window then controlling a window of an other process is easy, you just need XReparentWindow, which will take care of the show/hide, move and XResizeWindow which going to take care of the resize (ConfigRequest) I have working code for this under Linux. However a Java window doesn't have any X11 context on Mac the xwininfo won't return anything, also OS X doesn't have Window Manager API (HIView applies only for Aqua windows in the same process). Let's say I'm implementing the quartz-wm functionality on native side of my java app (which makes me a regular Cocoa app essentially) then I still cannot reparent (NSView::addSubview?) a window since the X Window itself is created in the X server process. So could please how can quartz-wm can help me? Thanks in advance! Lorinc On Mon, Dec 8, 2008 at 1:57 PM, Jeremy Huddleston <jeremyhu@apple.com> wrote:
I'm working on a feasibility to start xquartz from a java process with JNI. My goal would be to keep the X server in the same process as my java application so this way I can manipulate the X windows itself (mainly reparent, resize and show/hide). To able to do the window manipulation I have to keep X and java in the same process.
That's not really possible... I think what you want to do is write a window manager in java (in which case you don't actually need the server to be in the same process).
Actually, CrossOver seems to do this, though not in Java... I'm pretty sure they have a heavily customised X server though, they probably started with X11.app and built their interfaces around it (don't take my word for it, I'm just guessing).
Maybe if you really want this you can take the same approach. Instead of embedding X11 in your app, customize X11.app to load your java code. It's probably quite a bit of work though...
It's not that much of a mystery. They use quartz-wm, just like X11.app does ;)
Like I said, what you're looking for is the functionality of a window manager, not the X server itself.
--Jeremy
_______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/xquartz-dev
participants (3)
-
Jeremy Huddleston
-
Lorinc Hever
-
Pelle Johansson