Skip to content
  • John Ralls's avatar
    Use consistent coordinates in get_toplevel_from_ns_event. · 345bfb49
    John Ralls authored
    [NSView frame] returns a rectangle in the superview's coordinates, and the
    superview of an NSWindow's content view (which is the only NSView that
    GdkQuartz instantiates) is an undocumented NSThemeFrame. While it happens
    to have the same origin as the content view and the same size as the
    window's frame this isn't documented and so could change without notice.
    Convert the window frame coordinates to the view's coordinate system to
    ensure consistency.
    
    Use the view's bounds instead of its frame: The bounds rectangle is in the
    view's coordinate system. Use the parent NSWindow's frame instead of the
    private NSThemeFrame's. This ensures that all coordinate comparisons have
    the same reference.
    
    Finally, the macOS coordinate systems origin is at the bottom left, so the
    title bar is between the content view's height and the window's height,
    not in negative y in the view's coordinates. Adjust the y comparisons
    accordingly.
    
    Fixes #6297
    345bfb49