Use a checkerboard pattern on item background

This commit is contained in:
Přemysl Eric Janouch 2021-11-10 20:53:24 +01:00
parent fc4eb97218
commit 405f975899
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 18 additions and 5 deletions

View File

@ -248,7 +248,6 @@ draw_row(FastivBrowser *self, cairo_t *cr, const Row *row)
border.left + extents.width + border.right, border.left + extents.width + border.right,
border.top + extents.height + border.bottom); border.top + extents.height + border.bottom);
// TODO(p): See if a mild checkerboard pattern would not look nice.
gtk_render_background( gtk_render_background(
style, cr, border.left, border.top, extents.width, extents.height); style, cr, border.left, border.top, extents.width, extents.height);

View File

@ -335,10 +335,24 @@ main(int argc, char *argv[])
gtk_window_set_default_icon_name(PROJECT_NAME); gtk_window_set_default_icon_name(PROJECT_NAME);
const char *style = "fastiv-view, fastiv-browser { background: #222; }" // This is incredibly broken https://stackoverflow.com/a/51054396/76313
"fastiv-browser { padding: 5px; } fastiv-browser.item {" // thus resolving the problem using overlaps.
"border: 1px solid rgba(255, 255, 255, 0.5); " const char *style = "@define-color fastiv-tile #3c3c3c; \
"margin: 10px; color: #000; background: #444; }"; fastiv-view, fastiv-browser { background: #222; } \
fastiv-browser { padding: 5px; } \
fastiv-browser.item { \
border: 1px solid rgba(255, 255, 255, 0.5); \
margin: 10px; color: #000; \
background: #333; \
background-image: \
linear-gradient(45deg, @fastiv-tile 26%, transparent 26%), \
linear-gradient(-45deg, @fastiv-tile 26%, transparent 26%), \
linear-gradient(45deg, transparent 74%, @fastiv-tile 74%), \
linear-gradient(-45deg, transparent 74%, @fastiv-tile 74%); \
background-size: 40px 40px; \
background-position: 0 0, 0 20px, 20px -20px, -20px 0px; \
}";
GtkCssProvider *provider = gtk_css_provider_new(); GtkCssProvider *provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(provider, style, strlen(style), NULL); gtk_css_provider_load_from_data(provider, style, strlen(style), NULL);
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),