diff options
| author | Victor Kareh <[email protected]> | 2026-02-26 11:35:27 -0500 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-05-21 08:00:54 -0400 |
| commit | 61d712ecfb992739ee0d8d1754a2c36b58ee47ef (patch) | |
| tree | 0d511cd69395f8640ef62dd1a8994506663d365c | |
| parent | 93e25128ae954a44837d442b2749936ced592ba5 (diff) | |
| download | caja-61d712ecfb992739ee0d8d1754a2c36b58ee47ef.tar.bz2 caja-61d712ecfb992739ee0d8d1754a2c36b58ee47ef.tar.xz | |
icon-view: Display hidden files with transparency
Render hidden files with some transparency to visually distinguish them
from regular files. Files become fully opaque when selected or
highlighted.
Fixes #1872
| -rw-r--r-- | libcaja-private/caja-icon-canvas-item.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c index 3bb2db11..942f7147 100644 --- a/libcaja-private/caja-icon-canvas-item.c +++ b/libcaja-private/caja-icon-canvas-item.c @@ -48,6 +48,7 @@ #include "caja-file-utilities.h" #include "caja-global-preferences.h" #include "caja-icon-private.h" +#include "caja-file.h" #define EMBLEM_SPACING 2 @@ -1912,6 +1913,7 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, GdkPixbuf *emblem_pixbuf; cairo_surface_t *temp_surface; GtkStyleContext *context; + gboolean render_as_hidden = FALSE; container = CAJA_ICON_CONTAINER (item->canvas); gboolean is_rtl; @@ -1933,9 +1935,34 @@ caja_icon_canvas_item_draw (EelCanvasItem *item, temp_surface = map_surface (icon_item); - gtk_render_icon_surface (context, cr, - temp_surface, - icon_rect.x0, icon_rect.y0); + /* Check if we should render hidden files as transparent */ + if (!details->is_highlighted_for_selection && !details->is_highlighted_for_drop) + { + CajaIcon *icon = (CajaIcon *) icon_item->user_data; + if (icon != NULL && icon->data != NULL) + { + CajaFile *file = CAJA_FILE (icon->data); + if (caja_file_is_hidden_file (file)) + { + render_as_hidden = TRUE; + } + } + } + + if (render_as_hidden) + { + /* Render with 55% opacity for hidden files */ + cairo_save (cr); + cairo_set_source_surface (cr, temp_surface, icon_rect.x0, icon_rect.y0); + cairo_paint_with_alpha (cr, 0.55); + cairo_restore (cr); + } + else + { + gtk_render_icon_surface (context, cr, + temp_surface, + icon_rect.x0, icon_rect.y0); + } cairo_surface_destroy (temp_surface); draw_embedded_text (icon_item, cr, icon_rect.x0, icon_rect.y0); |
