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

Don't draw widget when size is 0 or less.

This commit is contained in:
Dave Davenport 2017-01-04 10:47:37 +01:00
parent 8f6a323ed6
commit 8bbf1b36d5
2 changed files with 6 additions and 0 deletions

View file

@ -797,6 +797,7 @@ void rofi_view_update ( RofiViewState *state, gboolean qr )
if ( !widget_need_redraw ( WIDGET ( state->main_window ) ) && !widget_need_redraw ( WIDGET ( state->overlay ) ) ) { if ( !widget_need_redraw ( WIDGET ( state->main_window ) ) && !widget_need_redraw ( WIDGET ( state->overlay ) ) ) {
return; return;
} }
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Redraw view" );
TICK (); TICK ();
cairo_t *d = CacheState.edit_draw; cairo_t *d = CacheState.edit_draw;
cairo_set_operator ( d, CAIRO_OPERATOR_SOURCE ); cairo_set_operator ( d, CAIRO_OPERATOR_SOURCE );

View file

@ -88,6 +88,11 @@ void widget_draw ( widget *widget, cairo_t *d )
{ {
// Check if enabled and if draw is implemented. // Check if enabled and if draw is implemented.
if ( widget && widget->enabled && widget->draw ) { if ( widget && widget->enabled && widget->draw ) {
// Don't draw if there is no space.
if ( widget->h < 1 || widget->w < 1 ){
widget->need_redraw = FALSE;
return;
}
// Store current state. // Store current state.
cairo_save ( d ); cairo_save ( d );
int margin_left = distance_get_pixel ( widget->margin.left, ORIENTATION_HORIZONTAL ); int margin_left = distance_get_pixel ( widget->margin.left, ORIENTATION_HORIZONTAL );