View | Details | Raw Unified | Return to bug 1398
Collapse All | Expand All

(-)a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m (-3 / +11 lines)
Lines 14-19 Link Here
14
#endif
14
#endif
15
*/
15
*/
16
16
17
#include <dispatch/dispatch.h>
18
17
#import "MacOSXWindowSystemInterface.h"
19
#import "MacOSXWindowSystemInterface.h"
18
20
19
#import "ContextUpdater.h"
21
#import "ContextUpdater.h"
Lines 556-562 NSOpenGLContext* createContext(NSOpenGLContext* share, Link Here
556
            GLint zeroOpacity = 0;
558
            GLint zeroOpacity = 0;
557
            [ctx setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity];
559
            [ctx setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity];
558
        }
560
        }
559
        [ctx setView:view]; // Bug 1087: Set default framebuffer, hence enforce NSView realization
561
        dispatch_async(dispatch_get_main_queue(), ^{ // Fix for MacOS Catalina: -[NSOpenGLContext setView:] must be called from the main thread.
562
            [ctx setView:view]; // Bug 1087: Set default framebuffer, hence enforce NSView realization
563
        });
560
        if( viewReadyAndLocked ) {
564
        if( viewReadyAndLocked ) {
561
            [view unlockFocus];        
565
            [view unlockFocus];        
562
        }
566
        }
Lines 574-580 void setContextView(NSOpenGLContext* ctx, NSView* view) { Link Here
574
            Bool viewReadyAndLocked = lockViewIfReady(view);
578
            Bool viewReadyAndLocked = lockViewIfReady(view);
575
            DBG_PRINT("setContextView.0: ctx %p, view %p: setView: %d\n", ctx, view, viewReadyAndLocked);
579
            DBG_PRINT("setContextView.0: ctx %p, view %p: setView: %d\n", ctx, view, viewReadyAndLocked);
576
            if( viewReadyAndLocked ) {
580
            if( viewReadyAndLocked ) {
577
                [ctx setView:view];
581
                dispatch_async(dispatch_get_main_queue(), ^{
582
                    [ctx setView:view];
583
                });
578
                [view unlockFocus];        
584
                [view unlockFocus];        
579
            }
585
            }
580
        }
586
        }
Lines 655-661 void updateContext(NSOpenGLContext* ctx) { Link Here
655
  NSView *nsView = [ctx view];
661
  NSView *nsView = [ctx view];
656
  if(NULL != nsView) {
662
  if(NULL != nsView) {
657
      DBG_PRINT("updateContext.0: ctx %p, ctx.view %p\n", ctx, nsView);
663
      DBG_PRINT("updateContext.0: ctx %p, ctx.view %p\n", ctx, nsView);
658
      [ctx update];
664
      dispatch_async(dispatch_get_main_queue(), ^{
665
          [ctx update];
666
      });
659
      DBG_PRINT("updateContext.X\n");
667
      DBG_PRINT("updateContext.X\n");
660
  }
668
  }
661
  [pool release];
669
  [pool release];

Return to bug 1398