Index: uspace/lib/gui/button.c
===================================================================
--- uspace/lib/gui/button.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/gui/button.c	(revision 296e124ed71cc3d8a1fb740bd2b6f54384eeb944)
@@ -36,45 +36,57 @@
 #include <str.h>
 #include <malloc.h>
-
 #include <drawctx.h>
 #include <surface.h>
-
+#include "common.h"
 #include "window.h"
 #include "button.h"
 
-static void paint_internal(widget_t *w)
-{
-	button_t *btn = (button_t *) w;
-
+static pixel_t color_highlight = PIXEL(255, 255, 255, 255);
+static pixel_t color_shadow = PIXEL(255, 85, 85, 85);
+
+static void paint_internal(widget_t *widget)
+{
+	button_t *btn = (button_t *) widget;
+	
 	surface_t *surface = window_claim(btn->widget.window);
-	if (!surface) {
+	if (!surface)
 		window_yield(btn->widget.window);
+	
+	source_t source;
+	source_init(&source);
+	
+	drawctx_t drawctx;
+	drawctx_init(&drawctx, surface);
+	
+	drawctx_set_source(&drawctx, &btn->background);
+	drawctx_transfer(&drawctx, widget->hpos, widget->vpos,
+	    widget->width, widget->height);
+	
+	if ((widget->width >= 8) && (widget->height >= 8)) {
+		drawctx_set_source(&drawctx, &source);
+		draw_bevel(&drawctx, &source, widget->hpos + 3, widget->vpos + 3,
+		    widget->width - 6, widget->height - 6, color_highlight,
+		    color_shadow);
+		
+		drawctx_set_source(&drawctx, &btn->foreground);
+		drawctx_transfer(&drawctx, widget->hpos + 4, widget->vpos + 4,
+		    widget->width - 8, widget->height - 8);
 	}
-
-	drawctx_t drawctx;
-
-	drawctx_init(&drawctx, surface);
-	drawctx_set_source(&drawctx, &btn->foreground);
-	drawctx_transfer(&drawctx, w->hpos, w->vpos, w->width, w->height);
-
-	if (w->width >= 6 && w->height >= 6) {
-		drawctx_set_source(&drawctx, &btn->background);
-		drawctx_transfer(&drawctx,
-		    w->hpos + 3, w->vpos + 3, w->width - 6, w->height - 6);
-	}
-
+	
 	sysarg_t cpt_width;
 	sysarg_t cpt_height;
 	font_get_box(&btn->font, btn->caption, &cpt_width, &cpt_height);
-	if (w->width >= cpt_width && w->height >= cpt_height) {
-		drawctx_set_source(&drawctx, &btn->foreground);
+	
+	if ((widget->width >= cpt_width) && (widget->height >= cpt_height)) {
+		sysarg_t x = ((widget->width - cpt_width) / 2) + widget->hpos;
+		sysarg_t y = ((widget->height - cpt_height) / 2) + widget->vpos;
+		
+		drawctx_set_source(&drawctx, &btn->text);
 		drawctx_set_font(&drawctx, &btn->font);
-		sysarg_t x = ((w->width - cpt_width) / 2) + w->hpos;
-		sysarg_t y = ((w->height - cpt_height) / 2) + w->vpos;
-		if (btn->caption) {
+		
+		if (btn->caption)
 			drawctx_print(&drawctx, btn->caption, x, y);
-		}
 	}
-
+	
 	window_yield(btn->widget.window);
 }
@@ -90,7 +102,6 @@
 {
 	button_t *btn = (button_t *) widget;
-
+	
 	deinit_button(btn);
-	
 	free(btn);
 }
@@ -117,7 +128,7 @@
 {
 	button_t *btn = (button_t *) widget;
-	if (event.key == KC_ENTER && event.type == KEY_PRESS) {
+	
+	if (event.key == KC_ENTER && event.type == KEY_PRESS)
 		sig_send(&btn->clicked, NULL);
-	}
 }
 
@@ -126,18 +137,17 @@
 	button_t *btn = (button_t *) widget;
 	widget->window->focus = widget;
-
+	
 	// TODO make the click logic more robust (mouse grabbing, mouse moves)
 	if (event.btn_num == 1) {
-		if (event.type == POS_RELEASE) {
+		if (event.type == POS_RELEASE)
 			sig_send(&btn->clicked, NULL);
-		}
 	}
 }
 
-bool init_button(button_t *btn, widget_t *parent,
-    const char *caption, uint16_t points, pixel_t background, pixel_t foreground)
+bool init_button(button_t *btn, widget_t *parent, const char *caption,
+    uint16_t points, pixel_t background, pixel_t foreground, pixel_t text)
 {
 	widget_init(&btn->widget, parent);
-
+	
 	btn->widget.destroy = button_destroy;
 	btn->widget.reconfigure = button_reconfigure;
@@ -146,42 +156,45 @@
 	btn->widget.handle_keyboard_event = button_handle_keyboard_event;
 	btn->widget.handle_position_event = button_handle_position_event;
-
+	
 	source_init(&btn->background);
 	source_set_color(&btn->background, background);
+	
 	source_init(&btn->foreground);
 	source_set_color(&btn->foreground, foreground);
-
-	if (caption == NULL) {
+	
+	source_init(&btn->text);
+	source_set_color(&btn->text, text);
+	
+	if (caption == NULL)
 		btn->caption = NULL;
-	} else {
+	else
 		btn->caption = str_dup(caption);
-	}
+	
 	font_init(&btn->font, FONT_DECODER_EMBEDDED, NULL, points);
-
+	
 	sysarg_t cpt_width;
 	sysarg_t cpt_height;
 	font_get_box(&btn->font, btn->caption, &cpt_width, &cpt_height);
-	btn->widget.width_min = cpt_width + 8;
-	btn->widget.height_min = cpt_height + 8;
-	btn->widget.width_ideal = cpt_width + 28;
-	btn->widget.height_ideal = cpt_height + 8;
-
+	btn->widget.width_min = cpt_width + 10;
+	btn->widget.height_min = cpt_height + 10;
+	btn->widget.width_ideal = cpt_width + 30;
+	btn->widget.height_ideal = cpt_height + 10;
+	
 	return true;
 }
 
-button_t *create_button(widget_t *parent,
-    const char *caption, uint16_t points, pixel_t background, pixel_t foreground)
+button_t *create_button(widget_t *parent, const char *caption, uint16_t points,
+    pixel_t background, pixel_t foreground, pixel_t text)
 {
 	button_t *btn = (button_t *) malloc(sizeof(button_t));
-	if (!btn) {
+	if (!btn)
 		return NULL;
-	}
-
-	if (init_button(btn, parent, caption, points, background, foreground)) {
+	
+	if (init_button(btn, parent, caption, points, background, foreground,
+	    text))
 		return btn;
-	} else {
-		free(btn);
-		return NULL;
-	}
+	
+	free(btn);
+	return NULL;
 }
 
