Exemple #1
0
 public void run() {
   for (XClipboard clpbrd : targetsAtom2Clipboard.values()) {
     clpbrd.getTargetsDelayed();
   }
   synchronized (XClipboard.classLock) {
     if (targetsAtom2Clipboard != null && !targetsAtom2Clipboard.isEmpty()) {
       XToolkit.schedule(this, XClipboard.getPollInterval());
     }
   }
 }
Exemple #2
0
 public void dispatchEvent(XEvent ev) {
   if (ev.get_type() == XConstants.SelectionNotify) {
     final XSelectionEvent xse = ev.get_xselection();
     XClipboard clipboard = null;
     synchronized (XClipboard.classLock) {
       if (targetsAtom2Clipboard != null && !targetsAtom2Clipboard.isEmpty()) {
         XToolkit.removeEventDispatcher(XWindow.getXAWTRootWindow().getWindow(), this);
         return;
       }
       final long propertyAtom = xse.get_property();
       clipboard = targetsAtom2Clipboard.get(propertyAtom);
     }
     if (null != clipboard) {
       clipboard.checkChange(xse);
     }
   }
 }
Exemple #3
0
  protected void registerClipboardViewerChecked() {
    // for XConvertSelection() to be called for the first time in getTargetsDelayed()
    isSelectionNotifyProcessed = true;

    boolean mustSchedule = false;
    synchronized (XClipboard.classLock) {
      if (targetsAtom2Clipboard == null) {
        targetsAtom2Clipboard = new HashMap<Long, XClipboard>(2);
      }
      mustSchedule = targetsAtom2Clipboard.isEmpty();
      targetsAtom2Clipboard.put(getTargetsPropertyAtom().getAtom(), this);
      if (mustSchedule) {
        XToolkit.addEventDispatcher(
            XWindow.getXAWTRootWindow().getWindow(), new SelectionNotifyHandler());
      }
    }
    if (mustSchedule) {
      XToolkit.schedule(new CheckChangeTimerTask(), XClipboard.getPollInterval());
    }
  }