Ejemplo n.º 1
0
  private void typeKey(int keyCode) {
    if (keyCode == -1) return;

    // press key
    X11.XTest.INSTANCE.XTestFakeKeyEvent(
        display.getX11Display(), keyCode, true, new NativeLong(DELAY));
    X11.INSTANCE.XFlush(display.getX11Display());
    // release key
    X11.XTest.INSTANCE.XTestFakeKeyEvent(
        display.getX11Display(), keyCode, false, new NativeLong(DELAY));
    X11.INSTANCE.XFlush(display.getX11Display());
  }
Ejemplo n.º 2
0
  public XTestDemo() throws InterruptedException {
    IntByReference event_basep = new IntByReference();
    IntByReference error_basep = new IntByReference();
    IntByReference majorp = new IntByReference();
    IntByReference minorp = new IntByReference();

    if (X11.XTest.INSTANCE.XTestQueryExtension(
        display.getX11Display(), event_basep, error_basep, majorp, minorp)) {

      System.out.println("event_basep.getValue() = " + event_basep.getValue());
      System.out.println("error_basep.getValue() = " + error_basep.getValue());
      System.out.println("majorp.getValue() = " + majorp.getValue());
      System.out.println("minorp.getValue() = " + minorp.getValue());
    }

    Thread.sleep(1000);

    type("hello world");
    //        typeKey("Return");
    //        type("it works!");

    Thread.sleep(1000);
  }
Ejemplo n.º 3
0
 private void typeKey(String keyName) {
   X11.KeySym keysym = X11.INSTANCE.XStringToKeysym(keyName);
   typeKey(X11.INSTANCE.XKeysymToKeycode(display.getX11Display(), keysym));
 }