From 2106f867b6f637d6c40710272da2bb7f8795ba4f Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 28 Oct 2018 16:22:05 +0000 Subject: [PATCH] Fixed first drawing of a layer-backed OpenGL window. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13087 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 98fa750c0..0b50353d8 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2161,7 +2161,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil; FLView implements displayLayer:. Consequently, FLView objects are drawn by the displayLayer: method. An FLView manages also a member variable CGContextRef layer_gc, a bitmap context the size of the view (double on Retina). - All Quartz drawings go to this bitmap. updateLayer finishes by using an image copy + All Quartz drawings go to this bitmap. displayLayer: finishes by using an image copy of the bitmap as the layer's contents. That step fills the window. When resized or when the window flips between low/high resolution displays, FLView receives the viewFrameDidChange message which deletes the bitmap and zeros layer_gc. @@ -2199,11 +2199,7 @@ static CGContextRef prepare_bitmap_for_layer(int w, int h ) { if (d->wait_for_expose_value) { // 1st drawing of GL window [self did_view_resolution_change]; - NSRect r = [[self window] frame]; - r.size.width -= 1; - [[self window] setFrame:r display:NO]; // very dirty but works. Should find something better. - r.size.width += 1; - [[self window] setFrame:r display:YES]; + [window->as_gl_window()->context() update]; // GL window is empty without this d->wait_for_expose_value = 0; } through_drawRect = YES;