

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.java.dev.jna.usersInputOnly window to manage read events.| From | Sent On | Attachments |
|---|---|---|
| Kim Eik | Nov 21, 2007 7:14 pm | |
| Timothy Wall | Nov 21, 2007 9:01 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | InputOnly window to manage read events. | Actions... |
|---|---|---|
| From: | Kim Eik (kei...@gmail.com) | |
| Date: | Nov 21, 2007 7:14:50 pm | |
| List: | net.java.dev.jna.users | |
I implemented this javacode, and crossed my fingers. But no, i encountered several issues trying to make this work.
1. There is a structure X11.XSetWindowAttributes which cant be passed along the method XCreateWindow as i recieve this error:
Exception in thread "main" java.lang.IllegalArgumentException: The type "boolean" is not supported as a Structure field at com.sun.jna.Structure.getNativeSize(Structure.java:738) at com.sun.jna.Structure.getNativeSize(Structure.java:758) at com.sun.jna.Structure.calculateSize(Structure.java:640) at com.sun.jna.Structure.allocateMemory(Structure.java:173) at com.sun.jna.Structure.<init>(Structure.java:96) at com.sun.jna.Structure.<init>(Structure.java:90) at com.sun.jna.Structure.<init>(Structure.java:86) at com.sun.jna.examples.unix.X11$XSetWindowAttributes.<init>(X11.java:291) at teste2.main(teste2.java:22)
So i progressed with creating my own structure, but since im extending com.sun.jna.examples.unix.X11 from my X11 interface it will use the X11.XSetWindowAttributes by default instead of XSetWindowAttributes.
i then just set the arguments required to null and hoped for the best. which didnt turn out well :) it seems i create the window, but i dont recieve any events. and if i try to get window information through XGetWMName i recieve segfaults.
im fresh out of ideas on where to go now. Can anyone help me?
import java.awt.Dimension; import java.awt.Toolkit;
import com.sun.jna.Native; import com.sun.jna.NativeLong; import com.sun.jna.examples.unix.X11.Display; import com.sun.jna.examples.unix.X11.Window;
public class teste2 extends Thread {
final static X11 INSTANCE = (X11)Native.loadLibrary("/usr/lib/libX11.so", X11.class); final static Display d = INSTANCE.XOpenDisplay(":0.0");
public static void main(String[] args) throws InterruptedException, InstantiationException, IllegalAccessException {
Window rootWin = INSTANCE.XDefaultRootWindow(d); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); System.out.println(dim.width+"x"+dim.height); Window n = INSTANCE.XCreateWindow(d, rootWin, 0, 0, dim.width, dim.height, 0, 0, 0, null,0,null); System.out.println(INSTANCE.XSelectInput(d, n, new NativeLong(X11.PointerMotionMask))); System.out.println(INSTANCE.XMapWindow(d, n)); INSTANCE.XRaiseWindow(d, n);
System.out.println(n.toNative());
/*XTextProperty t = null; INSTANCE.XGetWMName(d, n, t); System.out.println(t.value);*/
XEvent e = null; while(true){ INSTANCE.XNextEvent(d,e); System.out.println(e); } } }
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/







