summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-07 17:33:12 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-07 17:33:12 +0100
commitb61207757c3d5d4ba0a12d1bf5fc6af46ef51514 (patch)
tree9b42b4ae1739c92cd8a2e9cca1b3a2cc8f28f99e
parent94feb37301c336070fbc1c5d2fee40a890ae07e5 (diff)
Add --show-dirty argument
The new --show-dirty argument enables render-debugging and marks cells which got redrawn. This is very useful to debug libtsm ageing support. Apart from that, it's a very useless feature. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/wlterm.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/wlterm.c b/src/wlterm.c
index 2301c37..411b042 100644
--- a/src/wlterm.c
+++ b/src/wlterm.c
@@ -72,6 +72,8 @@ struct term {
unsigned int exited : 1;
};
+static gboolean show_dirty;
+
static void err(const char *format, ...)
{
va_list list;
@@ -328,6 +330,7 @@ static gboolean term_redraw_cb(GtkWidget *widget, cairo_t *cr, gpointer data)
start = g_get_monotonic_time();
memset(&ctx, 0, sizeof(ctx));
+ ctx.debug = show_dirty;
ctx.rend = term->rend;
ctx.cr = cr;
ctx.face = term->face;
@@ -523,12 +526,27 @@ static void term_hide(struct term *term)
gtk_widget_hide(term->window);
}
+static GOptionEntry opts[] = {
+ { "show-dirty", 0, 0, G_OPTION_ARG_NONE, &show_dirty, "Mark dirty cells during redraw", NULL },
+ { NULL }
+};
+
int main(int argc, char **argv)
{
struct term *term;
int r;
-
- gtk_init(&argc, &argv);
+ GOptionContext *opt;
+ GError *e = NULL;
+
+ opt = g_option_context_new("- Wayland Terminal Emulator");
+ g_option_context_add_main_entries(opt, opts, NULL);
+ g_option_context_add_group(opt, gtk_get_option_group(TRUE));
+ if (!g_option_context_parse(opt, &argc, &argv, &e)) {
+ g_print("cannot parse arguments: %s\n", e->message);
+ g_error_free(e);
+ r = -EINVAL;
+ goto error;
+ }
r = term_new(&term);
if (r < 0)