[nautilus/wip/antoniof/draw-shadow-directly: 10/10] canvas-item: Fix black corner glitch in selected thumbnails




commit 7e22b73f01b187d809f2736de7026804d8ff7528
Author: António Fernandes <antoniof gnome org>
Date:   Tue Mar 1 21:37:56 2022 +0000

    canvas-item: Fix black corner glitch in selected thumbnails
    
    The  canvas item style includes a 5px border-radius for the rectangle
    around labels when the item is selected.
    
    However, this is also affecting the icon, causing black artifacts in
    the corners of selected thumbnails and custom icons. Previously, this
    wasn't visible for thumbnails because they used to have rounded frames.
    
    Explicitly set the 5px for the box label alone and ensure the icons
    (before applying the shadow) have sharp corners.

 src/nautilus-canvas-item.c    | 1 +
 src/resources/css/Adwaita.css | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-canvas-item.c b/src/nautilus-canvas-item.c
index 436f813d7..d833b6d49 100644
--- a/src/nautilus-canvas-item.c
+++ b/src/nautilus-canvas-item.c
@@ -1384,6 +1384,7 @@ nautilus_canvas_item_draw (EelCanvasItem  *item,
     cairo_surface_destroy (temp_surface);
 
     /* Draw the label text. */
+    gtk_style_context_add_class (context, "label-text");
     draw_label_text (canvas_item, cr, icon_rect);
 
     gtk_style_context_restore (context);
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index d259921ce..f96cddc19 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -9,9 +9,11 @@
 }
 
 .nautilus-canvas-item {
-    border-radius: 5px;
+    border-radius: 0px;
 }
 
+.nautilus-canvas-item.label-text {
+    border-radius: 5px;
 }
 
 .nautilus-canvas-item.dim-label {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]