diff options
author | Dave Davenport <qball@gmpclient.org> | 2021-01-23 19:13:48 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2021-01-23 19:13:48 +0100 |
commit | fd769378fe30c0b49af3af4ab2204b72044740d0 (patch) | |
tree | edcc3df6257fe2c54000ed194d6742195ba3996c /source/widgets | |
parent | 0eb3abd657509d59e7783d32a5bce95808a3d359 (diff) | |
parent | 8999d94850d4276f0220074f75c7e13aa8725597 (diff) |
Merge remote-tracking branch 'origin/next' into deprecate
Diffstat (limited to 'source/widgets')
-rw-r--r-- | source/widgets/textbox.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 8e52b327..a5112755 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -136,6 +136,7 @@ static void textbox_initialize_font ( textbox *tb ) tbfc->metrics = pango_context_get_metrics ( p_context, tbfc->pfd, NULL ); PangoLayout *layout = pango_layout_new ( p_context ); + pango_layout_set_font_description ( layout, tbfc->pfd ); pango_layout_set_text ( layout, "aAjb", -1 ); PangoRectangle rect; pango_layout_get_pixel_extents ( layout, NULL, &rect ); @@ -182,10 +183,17 @@ textbox* textbox_create ( widget *parent, WidgetType type, const char *name, Tex textbox_initialize_font ( tb ); - if ( ( flags & TB_WRAP ) == TB_WRAP ) { + if ( ( tb->flags & TB_WRAP ) == TB_WRAP ) { pango_layout_set_wrap ( tb->layout, PANGO_WRAP_WORD_CHAR ); } + // Allow overriding of markup. + if ( rofi_theme_get_boolean ( WIDGET ( tb ), "markup", (tb->flags&TB_MARKUP) == TB_MARKUP ) ) { + tb->flags |= TB_MARKUP; + } else { + tb->flags &= (~TB_MARKUP); + } + const char *txt = rofi_theme_get_string ( WIDGET ( tb ), "str", text ); if ( txt == NULL || ( *txt ) == '\0' ) { txt = rofi_theme_get_string ( WIDGET ( tb ), "content", text ); @@ -202,7 +210,7 @@ textbox* textbox_create ( widget *parent, WidgetType type, const char *name, Tex tb->blink_timeout = 0; tb->blink = 1; - if ( ( flags & TB_EDITABLE ) == TB_EDITABLE ) { + if ( ( tb->flags & TB_EDITABLE ) == TB_EDITABLE ) { if ( rofi_theme_get_boolean ( WIDGET ( tb ), "blink", TRUE ) ) { tb->blink_timeout = g_timeout_add ( 1200, textbox_blink, tb ); } |