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

Fix redrawing (call queue redraw, not need redraw) fix end of string check.

This commit is contained in:
Dave Davenport 2016-10-17 20:54:02 +02:00
parent 0f1ba8aca8
commit df26193096

View file

@ -161,7 +161,7 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft )
} }
if ( tb->tbft != tbft ) { if ( tb->tbft != tbft ) {
tb->update = TRUE; tb->update = TRUE;
widget_need_redraw ( WIDGET ( tb ) ); widget_queue_redraw ( WIDGET ( tb ) );
} }
tb->tbft = tbft; tb->tbft = tbft;
} }
@ -229,7 +229,7 @@ void textbox_text ( textbox *tb, const char *text )
} }
tb->cursor = MAX ( 0, MIN ( ( int ) g_utf8_strlen ( tb->text, -1 ), tb->cursor ) ); tb->cursor = MAX ( 0, MIN ( ( int ) g_utf8_strlen ( tb->text, -1 ), tb->cursor ) );
widget_need_redraw ( WIDGET ( tb ) ); widget_queue_redraw ( WIDGET ( tb ) );
} }
// within the parent handled auto width/height modes // within the parent handled auto width/height modes
@ -268,7 +268,7 @@ void textbox_moveresize ( textbox *tb, int x, int y, int w, int h )
// We always want to update this // We always want to update this
pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tb->widget.w - 2 * config.line_padding - offset ) ); pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tb->widget.w - 2 * config.line_padding - offset ) );
tb->update = TRUE; tb->update = TRUE;
widget_need_redraw ( WIDGET ( tb ) ); widget_queue_redraw ( WIDGET ( tb ) );
} }
// will also unmap the window if still displayed // will also unmap the window if still displayed
@ -401,9 +401,9 @@ void textbox_cursor ( textbox *tb, int pos )
int length = ( tb->text == NULL ) ? 0 : g_utf8_strlen ( tb->text, -1 ); int length = ( tb->text == NULL ) ? 0 : g_utf8_strlen ( tb->text, -1 );
tb->cursor = MAX ( 0, MIN ( length, pos ) ); tb->cursor = MAX ( 0, MIN ( length, pos ) );
tb->update = TRUE; tb->update = TRUE;
widget_need_redraw ( WIDGET ( tb ) );
// Stop blink! // Stop blink!
tb->blink = 2; tb->blink = 3;
widget_queue_redraw ( WIDGET ( tb ) );
} }
// move right // move right
@ -434,7 +434,7 @@ static void textbox_cursor_inc_word ( textbox *tb )
break; break;
} }
} }
if ( c == NULL ) { if ( *c == '\0' ) {
return; return;
} }
while ( ( c = g_utf8_next_char ( c ) ) ) { while ( ( c = g_utf8_next_char ( c ) ) ) {
@ -486,12 +486,12 @@ void textbox_cursor_end ( textbox *tb )
if ( tb->text == NULL ) { if ( tb->text == NULL ) {
tb->cursor = 0; tb->cursor = 0;
tb->update = TRUE; tb->update = TRUE;
widget_need_redraw ( WIDGET ( tb ) ); widget_queue_redraw ( WIDGET ( tb ) );
return; return;
} }
tb->cursor = ( int ) g_utf8_strlen ( tb->text, -1 ); tb->cursor = ( int ) g_utf8_strlen ( tb->text, -1 );
tb->update = TRUE; tb->update = TRUE;
widget_need_redraw ( WIDGET ( tb ) ); widget_queue_redraw ( WIDGET ( tb ) );
// Stop blink! // Stop blink!
tb->blink = 2; tb->blink = 2;
} }