• Ken Thomases's avatar
    winemac: Set windows to transparent until they have content to draw, to reduce flicker. · fdd7db05
    Ken Thomases authored
    When a window is shown, it may not have drawn its content into the backing
    surface, yet.  Cocoa will draw the window, starting with its standard light
    gray background and then the content view.  However, the content view won't
    have anything to draw, yet, though, so the window background is not drawn over.
    
    A short while later, usually, the app will paint its content into the window
    backing surface and Cocoa will be told to redraw the window.  This works, but
    the user can often see the flash of the window background color first.  This
    is especially visible for windows with dark content.
    
    Part of the fix is to set the window background to transparent until the
    content view has actually drawn once since the window was shown.
    
    That's not sufficient on its own, though.  We had disabled Cocoa's automatic
    display mechanism for windows and put display on a display-link timer.  This
    meant that the window was not actually cleared to its transparent color.  When
    the window was shown, the Window Server displayed a white backing buffer.  It
    is the app process which should fill that backing buffer with clear color but,
    because we had disabled auto-display, that wasn't getting done at the same
    time the window was displayed.  It was happening some time after.  Again, the
    result was a visible flicker of white.
    
    So, we now temporarily re-enable auto-display just before showing a window.
    Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    fdd7db05
cocoa_window.m 121 KB