Now pays attention to the GtkContainer "border-width" property when allocating size
authorPhilip Chimento <philip.chimento@gmail.com>
Sun, 3 May 2009 15:22:18 +0000 (15:22 +0000)
committerPhilip Chimento <philip.chimento@gmail.com>
Sun, 3 May 2009 15:22:18 +0000 (15:22 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@42 ddfedd41-794f-dd11-ae45-00112f111e67

src/chimara-glk.c
src/main.c

index fd5d0658976c1e0850ca851f72478fad4812952a..57846cb25c9b40f30da265a94bb6978e93e9253a 100644 (file)
@@ -228,11 +228,16 @@ chimara_glk_size_request(GtkWidget *widget, GtkRequisition *requisition)
     ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(widget);
     
     /* For now, just pass the size request on to the root Glk window */
-    if(priv->root_window)
+    if(priv->root_window) 
+       {
                request_recurse(priv->root_window->data, requisition);
-       else {
-        requisition->width = CHIMARA_GLK_MIN_WIDTH;
-        requisition->height = CHIMARA_GLK_MIN_HEIGHT;
+               requisition->width += 2 * GTK_CONTAINER(widget)->border_width;
+               requisition->height += 2 * GTK_CONTAINER(widget)->border_width;
+       } 
+       else 
+       {
+        requisition->width = CHIMARA_GLK_MIN_WIDTH + 2 * GTK_CONTAINER(widget)->border_width;
+        requisition->height = CHIMARA_GLK_MIN_HEIGHT + 2 * GTK_CONTAINER(widget)->border_width;
     }
 }
 
@@ -342,8 +347,14 @@ chimara_glk_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
     
     widget->allocation = *allocation;
             
-    if(priv->root_window)
-               allocate_recurse(priv->root_window->data, allocation);
+    if(priv->root_window) {
+               GtkAllocation child;
+               child.x = allocation->x + GTK_CONTAINER(widget)->border_width;
+               child.y = allocation->y + GTK_CONTAINER(widget)->border_width;
+               child.width = allocation->width - 2 * GTK_CONTAINER(widget)->border_width;
+               child.height = allocation->height - 2 * GTK_CONTAINER(widget)->border_width;
+               allocate_recurse(priv->root_window->data, &child);
+       }
 }
 
 /* Recursively invoke callback() on the GtkWidget of each non-pair window in the tree */
index 13de35c7fb809eb5916932a790fd1eb464cedf69..bbad7e31967cfe41b27babb2094a7a4883869710 100644 (file)
@@ -72,6 +72,7 @@ create_window(void)
        gtk_builder_connect_signals(builder, NULL);
        
        glk = chimara_glk_new();
+       g_object_set(glk, "border-width", 6, NULL);
        chimara_glk_set_default_font_string(CHIMARA_GLK(glk), "Sans 11");
        chimara_glk_set_monospace_font_string(CHIMARA_GLK(glk), "Monospace 10");
        g_signal_connect(glk, "started", G_CALLBACK(on_started), NULL);