From: Kristian Høgsberg Date: Wed, 16 May 2012 01:52:25 +0000 (-0400) Subject: window: Compute title vertical position based on font extents X-Git-Tag: 20120702.1049~188 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9931880c5beeced085e156279a7cab3598ff400;p=profile%2Fivi%2Fweston.git window: Compute title vertical position based on font extents We just fudged it before. --- diff --git a/clients/window.c b/clients/window.c index 5eca1f4..3dec950 100644 --- a/clients/window.c +++ b/clients/window.c @@ -1424,6 +1424,7 @@ frame_redraw_handler(struct widget *widget, void *data) struct frame *frame = data; cairo_t *cr; cairo_text_extents_t extents; + cairo_font_extents_t font_extents; cairo_surface_t *source; int x, y, width, height; struct window *window = widget->window; @@ -1461,8 +1462,13 @@ frame_redraw_handler(struct widget *widget, void *data) CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(cr, 14); cairo_text_extents(cr, window->title, &extents); + cairo_font_extents (cr, &font_extents); x = (width - extents.width) / 2; - y = frame->margin + 8 - extents.y_bearing; + y = frame->margin + + (frame->titlebar_height - + font_extents.ascent - font_extents.descent) / 2 + + font_extents.ascent; + if (window->keyboard_device) { cairo_move_to(cr, x + 1, y + 1); cairo_set_source_rgb(cr, 1, 1, 1);