src/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page




 982         }
 983     }
 984 
 985     private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
 986         //TODO blit. proof-of-concept
 987         if (src != dst && src != null && dst != null
 988             && !(dst instanceof NullSurfaceData)
 989             && !(src instanceof NullSurfaceData)
 990             && src.getSurfaceType().equals(dst.getSurfaceType())) {
 991             final Rectangle size = getSize();
 992             final Blit blit = Blit.locate(src.getSurfaceType(),
 993                                           CompositeType.Src,
 994                                           dst.getSurfaceType());
 995             if (blit != null) {
 996                 blit.Blit(src, dst, AlphaComposite.Src,
 997                           getRegion(), 0, 0, 0, 0, size.width, size.height);
 998             }
 999         }
1000     }
1001 
1002     /*
1003      * Request the window insets from the delegate and compares it
1004      * with the current one. This method is mostly called by the
1005      * delegate, e.g. when the window state is changed and insets
1006      * should be recalculated.
1007      *
1008      * This method may be called on the toolkit thread.
1009      */
1010     public boolean updateInsets(Insets newInsets) {
1011         boolean changed = false;
1012         synchronized (getStateLock()) {
1013             changed = (insets.equals(newInsets));


1014             insets = newInsets;
1015         }
1016 
1017         if (changed) {
1018             replaceSurfaceData();
1019             repaintPeer();
1020         }
1021 
1022         return changed;
1023     }
1024 
1025     public static LWWindowPeer getWindowUnderCursor() {
1026         return lastCommonMouseEventPeer != null ? lastCommonMouseEventPeer.getWindowPeerOrSelf() : null;
1027     }
1028 
1029     public static LWComponentPeer<?, ?> getPeerUnderCursor() {
1030         return lastCommonMouseEventPeer;
1031     }
1032 
1033     /*
1034      * Requests platform to set native focus on a frame/dialog.
1035      * In case of a simple window, triggers appropriate java focus change.
1036      */
1037     public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
1038         if (focusLog.isLoggable(PlatformLogger.FINE)) {
1039             focusLog.fine("requesting native focus to " + this);
1040         }
1041 
1042         if (!focusAllowedFor()) {




 982         }
 983     }
 984 
 985     private void blitSurfaceData(final SurfaceData src, final SurfaceData dst) {
 986         //TODO blit. proof-of-concept
 987         if (src != dst && src != null && dst != null
 988             && !(dst instanceof NullSurfaceData)
 989             && !(src instanceof NullSurfaceData)
 990             && src.getSurfaceType().equals(dst.getSurfaceType())) {
 991             final Rectangle size = getSize();
 992             final Blit blit = Blit.locate(src.getSurfaceType(),
 993                                           CompositeType.Src,
 994                                           dst.getSurfaceType());
 995             if (blit != null) {
 996                 blit.Blit(src, dst, AlphaComposite.Src,
 997                           getRegion(), 0, 0, 0, 0, size.width, size.height);
 998             }
 999         }
1000     }
1001 
1002     /**
1003      * Request the window insets from the delegate and compares it with the
1004      * current one. This method is mostly called by the delegate, e.g. when the
1005      * window state is changed and insets should be recalculated.
1006      * <p/>

1007      * This method may be called on the toolkit thread.
1008      */
1009     public final void updateInsets(final Insets newInsets) {

1010         synchronized (getStateLock()) {
1011             if (insets.equals(newInsets)) {
1012                 return;
1013             }
1014             insets = newInsets;
1015         }
1016         postEvent(new ComponentEvent(getTarget(),
1017                                      ComponentEvent.COMPONENT_RESIZED));

1018         repaintPeer();



1019     }
1020 
1021     public static LWWindowPeer getWindowUnderCursor() {
1022         return lastCommonMouseEventPeer != null ? lastCommonMouseEventPeer.getWindowPeerOrSelf() : null;
1023     }
1024 
1025     public static LWComponentPeer<?, ?> getPeerUnderCursor() {
1026         return lastCommonMouseEventPeer;
1027     }
1028 
1029     /*
1030      * Requests platform to set native focus on a frame/dialog.
1031      * In case of a simple window, triggers appropriate java focus change.
1032      */
1033     public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
1034         if (focusLog.isLoggable(PlatformLogger.FINE)) {
1035             focusLog.fine("requesting native focus to " + this);
1036         }
1037 
1038         if (!focusAllowedFor()) {