public void synthesizeFocusInOut(boolean doFocus) {
    XFocusChangeEvent xev = new XFocusChangeEvent();

    XToolkit.awtLock();
    try {
      xev.set_type(doFocus ? FocusIn : FocusOut);
      xev.set_window(getFocusProxy().getWindow());
      xev.set_mode(NotifyNormal);
      XlibWrapper.XSendEvent(
          XToolkit.getDisplay(), getFocusProxy().getWindow(), false, NoEventMask, xev.pData);
    } finally {
      XToolkit.awtUnlock();
      xev.dispose();
    }
  }
Exemplo n.º 2
0
 void forwardKeyEvent(KeyEvent e) {
   xembedLog.fine("Try to forward key event");
   byte[] bdata = getBData(e);
   long data = Native.toData(bdata);
   if (data == 0) {
     return;
   }
   try {
     XKeyEvent ke = new XKeyEvent(data);
     ke.set_window(xembed.handle);
     if (xembedLog.isLoggable(PlatformLogger.FINE))
       xembedLog.fine("Forwarding native key event: " + ke);
     XToolkit.awtLock();
     try {
       XlibWrapper.XSendEvent(
           XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data);
     } finally {
       XToolkit.awtUnlock();
     }
   } finally {
     XlibWrapper.unsafe.freeMemory(data);
   }
 }