Repository: AvaloniaUI/Avalonia
File: native/Avalonia.Native/src/OSX/AvnWindow.mm (Objective-C++)

Code before:
            [parent->View otherMouseDragged:event];
            break;
        case NSEventTypeMouseMoved:
            [parent->View mouseMoved:event];
            break;
        default:
            break;
    }
}

- (void)sendEvent:(NSEvent *_Nonnull)event
{
    // Event-tracking loop for thick titlebar mouse events
    if (event.type == NSEventTypeLeftMouseDown && [self isPointInTitlebar:event.locationInWindow])
    {
        NSEventMask mask = NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp;
        NSEvent *ev = event;
        while (ev.type != NSEventTypeLeftMouseUp)
        {
            [self forwardToAvnView:ev];
            ev = [NSApp nextEventMatchingMask:mask
                                     untilDate:[NSDate distantFuture]
                                        inMode:NSEventTrackingRunLoopMode
                                       dequeue:YES];
        }
        [self forwardToAvnView:ev];
        return;
    }
    
    [super sendEvent:event];

    auto parent = _parent.tryGetWithCast<WindowImpl>();
    /// This is to detect non-client clicks. This can only be done on Windows... not popups, hence the dynamic_cast.
    if(parent)
    {
        switch(event.type)
        {
            case NSEventTypeLeftMouseDown:
            {
                AvnView* view = parent->View;
                NSPoint windowPoint = [event locationInWindow];
                NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil];
                
                auto targetView = [[self findRootView:view] hitTest: windowPoint];
                if(targetView)
                {
                    auto targetViewClass = [targetView className];
                    if([targetViewClass containsString: @"_NSThemeWidget"])
                        return;
                }
                

Review comment (suggestion):
Not calling `[NSApp sendEvent:ev];` for unknown events can and **will** break other things in the framework.

Code after:
            [parent->View otherMouseDragged:event];
            break;
        case NSEventTypeMouseMoved:
            [parent->View mouseMoved:event];
            break;
        default:
            break;
    }
}

- (void)sendEvent:(NSEvent *_Nonnull)event
{
    // Event-tracking loop for thick titlebar mouse events
    if (event.type == NSEventTypeLeftMouseDown && [self isPointInTitlebar:event.locationInWindow])
    {
        NSEventMask mask = NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp;
        NSEvent *ev = event;
        while (ev.type != NSEventTypeLeftMouseUp)
        {
            [self forwardToAvnView:ev];
            [super sendEvent:ev]; 
            ev = [NSApp nextEventMatchingMask:mask
                                     untilDate:[NSDate distantFuture]
                                        inMode:NSEventTrackingRunLoopMode
                                       dequeue:YES];
        }
        [self forwardToAvnView:ev];
        [super sendEvent:ev];
        return;
    }
    
    [super sendEvent:event];

    auto parent = _parent.tryGetWithCast<WindowImpl>();
    /// This is to detect non-client clicks. This can only be done on Windows... not popups, hence the dynamic_cast.
    if(parent)
    {
        switch(event.type)
        {
            case NSEventTypeLeftMouseDown:
            {
                AvnView* view = parent->View;
                NSPoint windowPoint = [event locationInWindow];
                NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil];
                
                auto targetView = [[self findRootView:view] hitTest: windowPoint];
                if(targetView)
                {
                    auto targetViewClass = [targetView className];
                    if([targetViewClass containsString: @"_NSThemeWidget"])
                        return;