1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Allow textbox to be added in theme

This commit is contained in:
Dave Davenport 2017-05-28 18:05:02 +02:00
parent fff06fc880
commit 28f116b4a2
3 changed files with 9 additions and 4 deletions

View file

@ -394,7 +394,8 @@ if ( queue == NULL ){
<PROPERTIES>(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;}
<PROPERTIES>{PNNUMBER}\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;}
<PROPERTIES>{PNNUMBER} { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;}
<PROPERTIES>\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strdup(&yytext[1]); return T_STRING;}
<PROPERTIES>\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;}
<PROPERTIES>@{WORD} {
yylval->sval = g_strdup(yytext);
return T_LINK;

View file

@ -1678,8 +1678,10 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
}
g_free(strbutton);
}
}
else {
} else if ( g_ascii_strncasecmp ( name, "textbox", 7) == 0 ){
textbox *t = textbox_create ( str, TB_WRAP, NORMAL, "");
box_add ( (box *)parent_widget, WIDGET(t), TRUE, 0);
} else {
wid = box_create ( strbox, BOX_VERTICAL );
box_add ( (box *)parent_widget, WIDGET ( wid ), TRUE, 0 );
//g_error("The widget %s does not exists. Invalid layout.", name);

View file

@ -154,7 +154,9 @@ textbox* textbox_create ( const char *name, TextboxFlags flags, TextBoxFontType
if ( ( flags & TB_WRAP ) == TB_WRAP ) {
pango_layout_set_wrap ( tb->layout, PANGO_WRAP_WORD_CHAR );
}
textbox_text ( tb, text ? text : "" );
const char *txt = rofi_theme_get_string ( WIDGET ( tb ), "str", text);
textbox_text ( tb, txt? txt: "" );
textbox_cursor_end ( tb );
// auto height/width modes get handled here