From 514558409c4ec2a4ee643dc6bb1b8125167c9d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 12 Feb 2022 16:58:06 +0100 Subject: [PATCH] boxpointer: Make drawing arrow background optional We currently use get_color(), which assumes the color exists in the stylesheet (and prints a warning if it doesn't). Switch to lookup_color() and skip filling the background if no such colors exits. Part-of: --- js/ui/boxpointer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index 1db8e56af..b3b98f83a 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -278,8 +278,6 @@ var BoxPointer = GObject.registerClass({ let halfBorder = borderWidth / 2; let halfBase = Math.floor(base / 2); - let backgroundColor = themeNode.get_color('-arrow-background-color'); - let [width, height] = area.get_surface_size(); let [boxWidth, boxHeight] = [width, height]; if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM) @@ -422,8 +420,12 @@ var BoxPointer = GObject.registerClass({ Math.PI, 3 * Math.PI / 2); } - Clutter.cairo_set_source_color(cr, backgroundColor); - cr.fillPreserve(); + const [hasColor, bgColor] = + themeNode.lookup_color('-arrow-background-color', false); + if (hasColor) { + Clutter.cairo_set_source_color(cr, bgColor); + cr.fillPreserve(); + } if (borderWidth > 0) { let borderColor = themeNode.get_color('-arrow-border-color');