Tighten the scope searched for sub views

This commit is contained in:
Kovid Goyal 2025-09-28 19:46:11 +05:30
parent b6f9080486
commit 8bef718c9a
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -3280,9 +3280,9 @@ @implementation NSView (FindByIdentifier)
static
void clear_title_bar_background_views(NSWindow *window) {
#define tag @"kitty-for-transparent-titlebar"
NSView *contentView = window.contentView, *titlebarContainer = contentView ? contentView.superview : nil;
if (titlebarContainer) {
for (NSView *subview in [titlebarContainer viewsWithIdentifier:tag]) [subview removeFromSuperview];
NSView *contentView = window.contentView;
if (contentView) {
for (NSView *subview in [contentView viewsWithIdentifier:tag]) [subview removeFromSuperview];
}
}
@ -3290,7 +3290,7 @@ void clear_title_bar_background_views(NSWindow *window) {
set_title_bar_background(NSWindow *window, NSColor *backgroundColor) {
NSView *contentView = window.contentView, *titlebarContainer = contentView ? contentView.superview : nil;
if (!titlebarContainer) return;
for (NSView *subview in [titlebarContainer viewsWithIdentifier:tag]) [subview removeFromSuperview];
for (NSView *subview in [contentView viewsWithIdentifier:tag]) [subview removeFromSuperview];
if (!backgroundColor) return;
const CGFloat height = title_bar_and_tool_bar_height(window);