@@ -75,6 +75,19 @@ BOOL isColorMatchingEnabled() {
7575    return  (BOOL )colorMatchingEnabled;
7676}
7777
78+ BOOL  isWindowAnimationEnabled () {
79+     static  int  windowAnimationEnabled = -1 ;
80+     if  (windowAnimationEnabled == -1 ) {
81+         JNIEnv *env = [ThreadUtilities getJNIEnvUncached ];
82+         if  (env == NULL ) return  NO ;
83+         NSString * windowAnimationEnabledProp = [PropertiesUtilities javaSystemPropertyForKey: @" apple.awt.window.animation" 
84+                                                                                      withEnv: env];
85+         windowAnimationEnabled = [@" true"   isCaseInsensitiveLike: windowAnimationEnabledProp] ? YES  : NO ;
86+         J2dRlsTraceLn (J2D_TRACE_INFO, " AWTWindow_windowAnimationEnabled: %d "  , windowAnimationEnabled);
87+     }
88+     return  (BOOL )windowAnimationEnabled;
89+ }
90+ 
7891@interface  NSTitlebarAccessoryViewController  (Private)
7992- (void )_setHidden : (BOOL )h  animated : (BOOL )a ;
8093@end 
@@ -605,6 +618,10 @@ - (id) initWithPlatformWindow:(jobject)platformWindow
605618    if  (self.nsWindow  == nil ) return  nil ; //  no hope either
606619    [self .nsWindow release ]; //  the property retains the object already
607620
621+     if  (!isWindowAnimationEnabled ()
622+         && (self.nsWindow .animationBehavior  != NSWindowAnimationBehaviorNone)) {
623+         self.nsWindow .animationBehavior  = NSWindowAnimationBehaviorNone;
624+     }
608625    if  (isColorMatchingEnabled ()) {
609626        //  Supported by both OpenGL & Metal pipelines
610627        //  Tell the system we have an sRGB backing store
@@ -3008,8 +3025,6 @@ void enableFullScreenSpecial(NSWindow *nsWindow) {
30083025
30093026    NSWindow  *w = (NSWindow  *)jlong_to_ptr (windowPtr);
30103027    [ThreadUtilities performOnMainThreadWaiting: NO  block: ^(){
3011-         w.hasShadow  = YES ;
3012-         w.contentView .wantsLayer  = YES ;
30133028        w.contentView .layer .cornerRadius  = radius;
30143029        w.contentView .layer .masksToBounds  = YES ;
30153030        w.contentView .layer .opaque  = NO ;
@@ -3024,11 +3039,11 @@ void enableFullScreenSpecial(NSWindow *nsWindow) {
30243039            w.contentView .layer .borderWidth  = borderWidth;
30253040            w.contentView .layer .borderColor  = color.CGColor ;
30263041        }
3042+         w.contentView .wantsLayer  = YES ;
30273043
30283044        w.backgroundColor  = NSColor .clearColor ;
30293045        w.opaque  = NO ;
3030-         //  remove corner radius animation
3031-         [w.contentView.layer removeAllAnimations ];
3046+         w.hasShadow  = YES ;
30323047        [w invalidateShadow ];
30333048    }];
30343049
0 commit comments