From bbdf178a1151a4dbaef3ab7e90fb4739bc0272aa Mon Sep 17 00:00:00 2001 From: Felix Kratz Date: Thu, 16 Nov 2023 13:56:36 +0100 Subject: [PATCH] protect against windows which break the rounded rect --- makefile | 2 +- src/border.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index ec2a995..bf92833 100644 --- a/makefile +++ b/makefile @@ -4,7 +4,7 @@ LIBS = -framework AppKit -F/System/Library/PrivateFrameworks/ -framework SkyLigh all: | bin clang -std=c99 -O3 -g $(FILES) -o bin/borders $(LIBS) -debug: +debug: | bin clang -std=c99 -O0 -g -DDEBUG $(FILES) -o bin/debug $(LIBS) bin: diff --git a/src/border.c b/src/border.c index 7782e3e..3ce1be6 100644 --- a/src/border.c +++ b/src/border.c @@ -50,8 +50,9 @@ void border_draw(struct border* border) { -g_settings.border_width, -g_settings.border_width ); - if (frame.size.width < 2.f * inner_border_radius - || frame.size.height < 2.f * inner_border_radius) { + CGRect smallest_rect = CGRectInset(window_frame, 1.0, 1.0); + if (smallest_rect.size.width < 2.f * inner_border_radius + || smallest_rect.size.height < 2.f * inner_border_radius) { return; }