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 ) ) ) {
return;
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Redraw view" );
TICK ();
cairo_t *d = CacheState.edit_draw;
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.
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.
cairo_save ( d );
int margin_left = distance_get_pixel ( widget->margin.left, ORIENTATION_HORIZONTAL );