Esempio n. 1
0
  private XRCompositeManager(XRSurfaceData surface) {
    con = new XRBackendNative();
    // con = XRBackendJava.getInstance();

    String gradProp = System.getProperty("sun.java2d.xrgradcache");
    enableGradCache =
        gradProp == null || !(gradProp.equalsIgnoreCase("false") || gradProp.equalsIgnoreCase("f"));

    XRPaints.register(this);

    initResources(surface);

    maskBuffer = new MaskTileManager(this, surface.getXid());
    textRenderer = new XRTextRenderer(this);
    maskImage = new XRMaskImage(this, surface.getXid());
  }
Esempio n. 2
0
  /*
   * Changes focused window on java level.
   */
  protected void changeFocusedWindow(boolean becomesFocused, Window opposite) {
    if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
      focusLog.fine((becomesFocused ? "gaining" : "loosing") + " focus window: " + this);
    }
    if (skipNextFocusChange) {
      focusLog.fine("skipping focus change");
      skipNextFocusChange = false;
      return;
    }
    if (!isFocusableWindow() && becomesFocused) {
      focusLog.fine("the window is not focusable");
      return;
    }
    if (becomesFocused) {
      synchronized (getPeerTreeLock()) {
        if (blocker != null) {
          if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
            focusLog.finest("the window is blocked by " + blocker);
          }
          return;
        }
      }
    }

    // Note, the method is not called:
    // - when the opposite (gaining focus) window is an owned/owner window.
    // - for a simple window in any case.
    if (!becomesFocused && (isGrabbing() || this.isOneOfOwnersOf(grabbingWindow))) {
      if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
        focusLog.fine("ungrabbing on " + grabbingWindow);
      }
      // ungrab a simple window if its owner looses activation.
      grabbingWindow.ungrab();
    }

    KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
    kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null);

    int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS;
    WindowEvent windowEvent =
        new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis());

    // TODO: wrap in SequencedEvent
    postEvent(windowEvent);
  }