Don't hardcode the background colour
It can be now overriden in the user's gtk.css.
This commit is contained in:
parent
fa7b1631f0
commit
a6972e4c6e
|
@ -116,12 +116,10 @@ fastiv_view_draw(GtkWidget *widget, cairo_t *cr)
|
|||
|| !gtk_cairo_should_draw_window(cr, gtk_widget_get_window(widget)))
|
||||
return TRUE;
|
||||
|
||||
// TODO(p): Make this adjustable later.
|
||||
cairo_set_source_rgb(cr, 0, 0, 0);
|
||||
cairo_paint(cr);
|
||||
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation(widget, &allocation);
|
||||
gtk_render_background(gtk_widget_get_style_context(widget), cr,
|
||||
0, 0, allocation.width, allocation.height);
|
||||
|
||||
int w = get_display_width(self);
|
||||
int h = get_display_height(self);
|
||||
|
@ -180,6 +178,7 @@ fastiv_view_class_init(FastivViewClass *klass)
|
|||
|
||||
// TODO(p): Later override "screen_changed", recreate Pango layouts there,
|
||||
// if we get to have any, or otherwise reflect DPI changes.
|
||||
gtk_widget_class_set_css_name(widget_class, "fastiv-view");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
6
fastiv.c
6
fastiv.c
|
@ -425,6 +425,12 @@ main(int argc, char *argv[])
|
|||
|
||||
gtk_window_set_default_icon_name(PROJECT_NAME);
|
||||
|
||||
const char *style = "fastiv-view { background: black; }";
|
||||
GtkCssProvider *provider = gtk_css_provider_new();
|
||||
gtk_css_provider_load_from_data(provider, style, strlen(style), NULL);
|
||||
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
|
||||
GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g.view = g_object_new(FASTIV_TYPE_VIEW, NULL);
|
||||
g.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect(g.window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
||||
|
|
Loading…
Reference in New Issue