コード例 #1
0
  public void setOpaque(boolean isOpaque) {
    synchronized (getStateLock()) {
      if (this.isOpaque == isOpaque) {
        return;
      }
    }

    Window target = (Window) getTarget();

    if (!isOpaque) {
      SunToolkit sunToolkit = (SunToolkit) target.getToolkit();
      if (!sunToolkit.isWindowTranslucencySupported()
          || !sunToolkit.isTranslucencyCapable(target.getGraphicsConfiguration())) {
        return;
      }
    }

    boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();

    if (this.isOpaque != isOpaque && !isVistaOS) {
      // non-Vista OS: only replace the surface data if the opacity
      // status changed (see WComponentPeer.isAccelCapable() for more)
      replaceSurfaceDataRecursively(target);
    }

    synchronized (getStateLock()) {
      this.isOpaque = isOpaque;
      setOpaqueImpl(isOpaque);
      if (isOpaque) {
        TranslucentWindowPainter currentPainter = painter;
        if (currentPainter != null) {
          currentPainter.flush();
          painter = null;
        }
      } else {
        painter = TranslucentWindowPainter.createInstance(this);
      }
    }

    if (isVistaOS) {
      // On Vista: setting the window non-opaque makes the window look
      // rectangular, though still catching the mouse clicks within
      // its shape only. To restore the correct visual appearance
      // of the window (i.e. w/ the correct shape) we have to reset
      // the shape.
      Shape shape = target.getShape();
      if (shape != null) {
        target.setShape(shape);
      }
    }

    if (target.isVisible()) {
      updateWindow(true);
    }
  }
コード例 #2
0
  // WComponentPeer overrides
  @SuppressWarnings("unchecked")
  protected void disposeImpl() {
    AppContext appContext = SunToolkit.targetToAppContext(target);
    synchronized (appContext) {
      List<WWindowPeer> l = (List<WWindowPeer>) appContext.get(ACTIVE_WINDOWS_KEY);
      if (l != null) {
        l.remove(this);
      }
    }

    // Remove ourself from the Map of DisplayChangeListeners
    GraphicsConfiguration gc = getGraphicsConfiguration();
    ((Win32GraphicsDevice) gc.getDevice()).removeDisplayChangedListener(this);

    synchronized (getStateLock()) {
      TranslucentWindowPainter currentPainter = painter;
      if (currentPainter != null) {
        currentPainter.flush();
        // don't set the current one to null here; reduces the chances of
        // MT issues (like NPEs)
      }
    }

    super.disposeImpl();
  }
コード例 #3
0
 /*
  * Called from native code when we have been dragged onto another screen.
  */
 void draggedToNewScreen() {
   SunToolkit.executeOnEventHandlerThread(
       (Component) target,
       new Runnable() {
         public void run() {
           displayChanged();
         }
       });
 }
コード例 #4
0
 public void updateIconImages() {
   java.util.List<Image> imageList = ((Window) target).getIconImages();
   if (imageList == null || imageList.size() == 0) {
     setIconImagesData(null, 0, 0, null, 0, 0);
   } else {
     int w = getSysIconWidth();
     int h = getSysIconHeight();
     int smw = getSysSmIconWidth();
     int smh = getSysSmIconHeight();
     DataBufferInt iconData = SunToolkit.getScaledIconData(imageList, w, h);
     DataBufferInt iconSmData = SunToolkit.getScaledIconData(imageList, smw, smh);
     if (iconData != null && iconSmData != null) {
       setIconImagesData(iconData.getData(), w, h, iconSmData.getData(), smw, smh);
     } else {
       setIconImagesData(null, 0, 0, null, 0, 0);
     }
   }
 }
コード例 #5
0
 public void setXEmbedDropTarget() {
   // Register a drop site on the top level.
   Runnable r =
       new Runnable() {
         public void run() {
           target.setDropTarget(new XEmbedDropTarget());
         }
       };
   SunToolkit.executeOnEventHandlerThread(target, r);
 }
コード例 #6
0
 static byte[] getBData(KeyEvent e) {
   try {
     if (bdataField == null) {
       bdataField = SunToolkit.getField(java.awt.AWTEvent.class, "bdata");
     }
     return (byte[]) bdataField.get(e);
   } catch (IllegalAccessException ex) {
     return null;
   }
 }
コード例 #7
0
 public void removeXEmbedDropTarget() {
   // Unregister a drop site on the top level.
   Runnable r =
       new Runnable() {
         public void run() {
           if (target.getDropTarget() instanceof XEmbedDropTarget) {
             target.setDropTarget(null);
           }
         }
       };
   SunToolkit.executeOnEventHandlerThread(target, r);
 }
コード例 #8
0
 public void propertyChange(PropertyChangeEvent e) {
   Window w = (Window) e.getNewValue();
   if (w == null) {
     return;
   }
   AppContext appContext = SunToolkit.targetToAppContext(w);
   synchronized (appContext) {
     WWindowPeer wp = (WWindowPeer) w.getPeer();
     // add/move wp to the end of the list
     List<WWindowPeer> l = (List<WWindowPeer>) appContext.get(ACTIVE_WINDOWS_KEY);
     if (l != null) {
       l.remove(wp);
       l.add(wp);
     }
   }
 }
コード例 #9
0
ファイル: LWWindowPeer.java プロジェクト: JetBrains/jdk8u_jdk
  /** Returns true if the GraphicsDevice has been changed, false otherwise. */
  public boolean updateGraphicsDevice() {
    GraphicsDevice newGraphicsDevice = platformWindow.getGraphicsDevice();
    synchronized (getStateLock()) {
      if (graphicsDevice == newGraphicsDevice) {
        return false;
      }
      graphicsDevice = newGraphicsDevice;
    }

    final GraphicsConfiguration newGC = newGraphicsDevice.getDefaultConfiguration();

    if (!setGraphicsConfig(newGC)) return false;

    SunToolkit.executeOnEventHandlerThread(
        getTarget(),
        new Runnable() {
          public void run() {
            AWTAccessor.getComponentAccessor().setGraphicsConfiguration(getTarget(), newGC);
          }
        });
    return true;
  }
コード例 #10
0
 public boolean supportsXEmbed() {
   return supportsXEmbed && SunToolkit.needsXEmbed();
 }