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

Make wrap an extra option for textbox

This commit is contained in:
QC 2015-09-23 20:44:24 +02:00
parent 5cc695e186
commit 29e81fdb07
3 changed files with 5 additions and 4 deletions

View file

@ -30,6 +30,7 @@ typedef enum
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
} TextboxFlags;
typedef enum

View file

@ -1017,7 +1017,7 @@ MenuReturn menu ( Switcher *sw, char **input, char *prompt, unsigned int *select
state.message_tb = NULL;
if ( message ) {
state.message_tb = textbox_create ( main_window, &vinfo, map, TB_AUTOHEIGHT | TB_MARKUP,
state.message_tb = textbox_create ( main_window, &vinfo, map, TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP,
( config.padding ), state.top_offset, state.w - ( 2 * ( config.padding ) ),
-1, NORMAL, message );
textbox_show ( state.message_tb );
@ -1370,7 +1370,7 @@ void error_dialog ( const char *msg, int markup )
menu_calculate_window_and_element_width ( &state, &mon );
state.max_elements = 0;
state.text = textbox_create ( main_window, &vinfo, map, TB_AUTOHEIGHT + ( ( markup ) ? TB_MARKUP : 0 ),
state.text = textbox_create ( main_window, &vinfo, map, TB_AUTOHEIGHT|TB_WRAP + ( ( markup ) ? TB_MARKUP : 0 ),
( config.padding ), ( config.padding ),
( state.w - ( 2 * ( config.padding ) ) ), 1, NORMAL, ( msg != NULL ) ? msg : "" );
textbox_show ( state.text );

View file

@ -108,7 +108,7 @@ textbox* textbox_create ( Window parent, XVisualInfo *vinfo, Colormap map, Textb
pango_font_description_free ( pfd );
textbox_font ( tb, tbft );
if ( ( flags & TB_MARKUP ) == TB_MARKUP ) {
if ( ( flags & TB_WRAP ) == TB_WRAP ) {
pango_layout_set_wrap ( tb->layout, PANGO_WRAP_WORD_CHAR );
}
textbox_text ( tb, text ? text : "" );
@ -207,7 +207,7 @@ void textbox_moveresize ( textbox *tb, int x, int y, int w, int h )
if ( ( tb->flags & TB_EDITABLE ) == TB_EDITABLE ) {
pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_MIDDLE );
}
else if ( ( tb->flags & TB_MARKUP ) != TB_MARKUP ) {
else if ( ( tb->flags & TB_WRAP ) != TB_WRAP ) {
pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_END );
}
}