• Ken Thomases's avatar
    winemac: Queue an event to reassert the WinAPI window position before Cocoa… · 9372af77
    Ken Thomases authored
    winemac: Queue an event to reassert the WinAPI window position before Cocoa adjusts its position for a display change.
    
    When the display mode changes such that the screen height changes, we'd like
    our windows to keep their position relative to the top-left of the primary
    screen.  That's how WinAPI's coordinate system works and we want the WinAPI
    position of the window to not change just because the display mode changed.
    
    Unfortunately that's not achievable in Cocoa.  Cocoa keeps the window
    stationary relative to the screen it's on, not necessarily the primary screen,
    and it's sometimes relative to the bottom-left and sometimes the top-left of
    that screen.
    
    So, what we do instead is queue an event to get the back end to reassert the
    WinAPI position of the window.  This is queued before Cocoa can adjust the
    Cocoa position of the window which would queue a WINDOW_FRAME_CHANGED to the
    back end and mess up the WinAPI position.  The back end's reassertion of the
    WinAPI position won't be processed by the Cocoa thread until after Cocoa has
    adjusted the position and will thus override it.  It will also discard any
    wrong WINDOW_FRAME_CHANGED that may have been queued.
    Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com>
    9372af77
event.c 10.8 KB