diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-06-08 08:46:16 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-06-08 08:46:16 +0200 |
commit | ad91f9a1241ade8cfaf9bb54a6df6cacffb77315 (patch) | |
tree | a26f06fda0f613a5c05104f8d923b3700024508e | |
parent | 47c75186562b11216d7f36dd5bbf1e00bb775aea (diff) |
[TextBox] Calculate yalign based on actual side, not estimated size.
-rw-r--r-- | source/dialogs/drun.c | 6 | ||||
-rw-r--r-- | source/widgets/textbox.c | 13 |
2 files changed, 9 insertions, 10 deletions
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 2840a16c..a9d6bd5c 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -459,14 +459,14 @@ static gpointer drun_icon_fetch ( gpointer data ) // this should be fine running in another thread. DRunModePrivateData *pd = (DRunModePrivateData *) data; DRunModeEntry *dr; - gsize i = 0; - const gchar *themes[4]; + gsize i = 0; + const gchar *themes[4]; if ( config.drun_icon_theme != NULL ) { themes[i++] = config.drun_icon_theme; } themes[i++] = "Adwaita"; themes[i++] = "gnome"; - themes[i] = NULL; + themes[i] = NULL; while ( ( dr = g_async_queue_pop ( pd->icon_fetch_queue ) ) != &( pd->quit_entry ) ) { if ( dr->icon_name == NULL ) { diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index c247b388..9a084499 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -413,14 +413,16 @@ static void textbox_draw ( widget *wid, cairo_t *draw ) } // Skip the side MARGIN on the X axis. - int x = widget_padding_get_left ( WIDGET ( tb ) ); + int x = widget_padding_get_left ( WIDGET ( tb ) ); int top = widget_padding_get_top ( WIDGET ( tb ) ); - int y = ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE; + int y = ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE; + int line_width = 0, line_height = 0; + // Get actual width. + pango_layout_get_pixel_size ( tb->layout, &line_width, &line_height ); if ( tb->yalign > 0.001 ) { - int height = ( pango_font_metrics_get_ascent ( tb->metrics ) + pango_font_metrics_get_descent ( tb->metrics ) ) / PANGO_SCALE; int bottom = widget_padding_get_bottom ( WIDGET ( tb ) ); - top = ( tb->widget.h - bottom - height - top ) * tb->yalign + top; + top = ( tb->widget.h - bottom - line_height - top ) * tb->yalign + top; } y += top; @@ -442,9 +444,6 @@ static void textbox_draw ( widget *wid, cairo_t *draw ) x += offset; if ( tb->xalign > 0.001 ) { - int line_width = 0; - // Get actual width. - pango_layout_get_pixel_size ( tb->layout, &line_width, NULL ); int rem = MAX ( 0, tb->widget.w - widget_padding_get_padding_width ( WIDGET ( tb ) ) - line_width ); x = tb->xalign * rem + widget_padding_get_left ( WIDGET ( tb ) ); } |