comparison mac/dw.m @ 2849:de56f1d265b3

Mac: Fix tree node icon and text overlapping on MacOS 13 Ventura. The NSTableCellView frame reports a size of 0x0 on Ventura. This causes our calculations to generate a negative value... So check that the width is not zero before calculating.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 13 Nov 2022 19:54:17 +0000
parents 8752d65e2dc0
children 2934b2fdcd8e
comparison
equal deleted inserted replaced
2848:6790bea27685 2849:de56f1d265b3
2465 { 2465 {
2466 NSImageView *iv = [result imageView]; 2466 NSImageView *iv = [result imageView];
2467 NSImage *icon = [iv image]; 2467 NSImage *icon = [iv image];
2468 NSTextField *tf = [result textField]; 2468 NSTextField *tf = [result textField];
2469 NSRect rect = result.frame; 2469 NSRect rect = result.frame;
2470 int width =[icon size].width; 2470 CGFloat width = [icon size].width;
2471 2471
2472 [iv setFrame:NSMakeRect(0,0,width,rect.size.height)]; 2472 [iv setFrame:NSMakeRect(0,0,width,rect.size.height)];
2473 2473
2474 /* Adjust the rect to allow space for the image */ 2474 /* Adjust the rect to allow space for the image */
2475 rect.origin.x += width; 2475 rect.origin.x += width;
2476 rect.size.width -= width; 2476 if(rect.size.width)
2477 rect.size.width -= width;
2477 [tf setFrame:rect]; 2478 [tf setFrame:rect];
2478 } 2479 }
2479 } 2480 }
2480 #endif 2481 #endif
2481 2482