summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2009-09-28 13:08:50 -0400
committerKristian Høgsberg <krh@redhat.com>2009-09-28 13:08:50 -0400
commit12308a49973c54e1524cdbfe4e297759faa3bd74 (patch)
tree3e31a507b8257cc2d80375c4955e227c353210b2
parent1b8b66f9387fe08dd5d0f38398f72f0d5fab2776 (diff)
downloadwayland-12308a49973c54e1524cdbfe4e297759faa3bd74.tar.gz
wayland-12308a49973c54e1524cdbfe4e297759faa3bd74.tar.xz
wayland-12308a49973c54e1524cdbfe4e297759faa3bd74.zip
Add color scheme support
-rw-r--r--terminal.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index 8e878e7..d1e57fc 100644
--- a/terminal.c
+++ b/terminal.c
@@ -35,6 +35,7 @@
#include <linux/input.h>
#include <cairo-drm.h>
+#include "wayland-util.h"
#include "wayland-client.h"
#include "wayland-glib.h"
@@ -65,6 +66,7 @@ struct terminal {
int margin;
int fullscreen;
int focused;
+ struct color_scheme *color_scheme;
};
static char *
@@ -122,6 +124,10 @@ terminal_resize(struct terminal *terminal, int width, int height)
terminal->start = 0;
}
+struct color_scheme { struct { double r, g, b, a; } fg, bg; }
+ matrix_colors = { { 0, 0.7, 0, 1 }, { 0, 0, 0, 0.9 } },
+ jbarnes_colors = { { 1, 1, 1, 1 }, { 0, 0, 0, 1 } };
+
static void
terminal_draw_contents(struct terminal *terminal)
{
@@ -137,10 +143,18 @@ terminal_draw_contents(struct terminal *terminal)
window_create_surface(terminal->window, &rectangle);
cr = cairo_create(terminal->surface);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_rgba(cr, 0, 0, 0, 0.9);
+ cairo_set_source_rgba(cr,
+ terminal->color_scheme->bg.r,
+ terminal->color_scheme->bg.g,
+ terminal->color_scheme->bg.b,
+ terminal->color_scheme->bg.a);
cairo_paint(cr);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
- cairo_set_source_rgba(cr, 0, 0.7, 0, 1);
+ cairo_set_source_rgba(cr,
+ terminal->color_scheme->fg.r,
+ terminal->color_scheme->fg.g,
+ terminal->color_scheme->fg.b,
+ terminal->color_scheme->fg.a);
cairo_select_font_face (cr, "mono",
CAIRO_FONT_SLANT_NORMAL,
@@ -476,6 +490,7 @@ terminal_create(struct display *display, int fullscreen)
memset(terminal, 0, sizeof *terminal);
terminal->fullscreen = fullscreen;
+ terminal->color_scheme = &jbarnes_colors;
terminal->window = window_create(display, "Wayland Terminal",
500, 100, 500, 400);
terminal->display = display;