From 42d108f0d7f5716794b3654b8ddbf488e4905be7 Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Thu, 24 Nov 2016 17:56:59 +0900 Subject: [PATCH] Add an X button to the 'simple' decoration theme --- userspace/lib/decorations.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/userspace/lib/decorations.c b/userspace/lib/decorations.c index 5892d5f2..ef12e19d 100644 --- a/userspace/lib/decorations.c +++ b/userspace/lib/decorations.c @@ -80,8 +80,10 @@ static void render_decorations_simple(yutani_window_t * window, gfx_context_t * if (decors_active == INACTIVE) { draw_string(ctx, TEXT_OFFSET_X, TEXT_OFFSET_Y, TEXTCOLOR_INACTIVE, title); + draw_string(ctx, window->width - 20, TEXT_OFFSET_Y, TEXTCOLOR_INACTIVE, "✕"); } else { draw_string(ctx, TEXT_OFFSET_X, TEXT_OFFSET_Y, TEXTCOLOR, title); + draw_string(ctx, window->width - 20, TEXT_OFFSET_Y, TEXTCOLOR, "✕"); } for (uint32_t i = 0; i < window->width; ++i) { @@ -92,7 +94,11 @@ static void render_decorations_simple(yutani_window_t * window, gfx_context_t * } static int check_button_press_simple(yutani_window_t * window, int x, int y) { - return 0; /* no buttons in simple mode */ + if (x >= window->width - 20 && x <= window->width - 2 && y >= 2) { + return DECOR_CLOSE; + } + + return 0; } static void initialize_simple() {