Moving window between HiDPI and LowDPI screens broken on macOS (DEF-2819)

This happens on a build with the HiDPI checkbox checked:

Thanks! Added as DEF-2819

This was annoying me, so I managed to make a workaround:

    window = dmGraphics::GetNativeOSXNSWindow();
    NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
    [center addObserverForName:NSWindowDidChangeScreenProfileNotification object:window queue:nil usingBlock:^(NSNotification *note) {
        id delegate = window.delegate;
        if ([delegate respondsToSelector:@selector(windowDidResize:)]) {
            // We need afterDelay: to schedule the call to the next run loop iteration
            // because otherwise old screen metrics are used
            [delegate performSelector:@selector(windowDidResize:) withObject:note afterDelay:0.0f];
        }
    }];
3 Likes