Make HildonWindow request always the full size of the screen
authorAlberto Garcia <agarcia@igalia.com>
Wed, 1 Apr 2009 14:37:46 +0000 (16:37 +0200)
committerAlberto Garcia <agarcia@igalia.com>
Fri, 15 May 2009 11:30:40 +0000 (13:30 +0200)
* hildon/hildon-window.c (hildon_window_size_request):
Always request the full size of the screen (minus the title bar if
not in fullscreen mode).

Fixes: NB#107486 (HildonWindow should size itself properly)

ChangeLog
hildon/hildon-window.c

index c1178b9..6469b61 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-05-15  Alberto Garcia  <agarcia@igalia.com>
+
+       * hildon/hildon-window.c (hildon_window_size_request):
+       Always request the full size of the screen (minus the title bar if
+       not in fullscreen mode).
+
+       Fixes: NB#107486 (HildonWindow should size itself properly)
+
 2009-05-14  Claudio Saavedra  <csaavedra@igalia.com>
 
        * hildon/hildon-note-private.h: Add idle_handler to the private data.
index 8d8e2f5..531e8a2 100644 (file)
@@ -689,45 +689,29 @@ static void
 hildon_window_size_request                      (GtkWidget *widget, 
                                                  GtkRequisition *requisition)
 {
+    GdkScreen *screen = gtk_widget_get_screen (widget);
     HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (widget);
+    GtkWidget *child;
+    GtkRequisition req;
     g_assert (priv);
 
-    GtkWidget *child = GTK_BIN (widget)->child;
-    GtkRequisition req2 = { 0 };
-    gint border_width = GTK_CONTAINER(widget)->border_width;
+    child = gtk_bin_get_child (GTK_BIN (widget));
 
-    if (! priv->borders)
-    {
-        hildon_window_get_borders (HILDON_WINDOW (widget));
-    }
-
-    if (child)
-        gtk_widget_size_request (child, requisition);
-
-    if (priv->vbox != NULL)
-        gtk_widget_size_request (priv->vbox, &req2);
+    if (child != NULL && GTK_WIDGET_VISIBLE (child))
+        gtk_widget_size_request (child, &req);
 
-    requisition->height += req2.height;
-    requisition->width = MAX (requisition->width, req2.width);
+    if (priv->vbox != NULL && GTK_WIDGET_VISIBLE (priv->vbox))
+        gtk_widget_size_request (priv->vbox, &req);
 
     if (priv->edit_toolbar != NULL && GTK_WIDGET_VISIBLE (priv->edit_toolbar))
-    {
-        GtkRequisition req;
         gtk_widget_size_request (priv->edit_toolbar, &req);
-        requisition->height += req.height;
-        requisition->width = MAX (requisition->width, req.width);
-    }
 
-    requisition->width  += 2 * border_width;
-    requisition->height += 2 * border_width;
+    /* Request the full size of the screen */
+    requisition->width = gdk_screen_get_width (screen);
+    requisition->height = gdk_screen_get_height (screen);
 
     if (! priv->fullscreen)
-    {
-        requisition->height += priv->borders->top;
-        if (req2.height == 0)
-            requisition->height += priv->borders->bottom;
-        requisition->width += priv->borders->left + priv->borders->right;
-    }
+        requisition->height -= HILDON_WINDOW_TITLEBAR_HEIGHT;
 }
 
 static void