[gtk+] Don't request window sizes with zero width or height



commit c5d086117982b1997389afd08a52ddaf2fdf8254
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Oct 5 22:07:06 2009 +0200

    Don't request window sizes with zero width or height
    
    Zero width/height is unsupported and will magically be turned into one.
    For instance, gtk_widget_size_allocate() will eventually do this magic
    on the value stored in widget->allocation.
    
    However, if we don't do this magic conversion early, then the value
    returned from gtk_window_compute_configure_request() will not be
    comparable with whats stored in widget->allocation. (I.E. they will
    differ if width or height are zero).
    
    This is dangerous, as we do such a comparison in gtk_window_move_resize().
    Currently a change from e.g. 10x1 (current allocation) to 10x0 (new size)
    will be expected to produce a ConfigureNotify, when it actually won't,
    thus never thawing the frozen toplevel.
    
    Fixes bug #588059

 gtk/gtkwindow.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index c0815a9..36c5a65 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5648,6 +5648,13 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
       if (info->resize_height > 0)
         *height = info->resize_height;
     }
+
+  /* Don't ever request zero width or height, its not supported by
+     gdk. The size allocation code will round it to 1 anyway but if
+     we do it then the value returned from this function will is
+     not comparable to the size allocation read from the GtkWindow. */
+  *width = MAX (*width, 1);
+  *height = MAX (*height, 1);
 }
 
 static GtkWindowPosition



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]