From: Philip Chimento Date: Sun, 3 May 2009 15:22:18 +0000 (+0000) Subject: Now pays attention to the GtkContainer "border-width" property when allocating size X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=3ce28af89401461eac6d03cb6a898dd7c9e9abd9;p=rodin%2Fchimara.git Now pays attention to the GtkContainer "border-width" property when allocating size git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@42 ddfedd41-794f-dd11-ae45-00112f111e67 --- diff --git a/src/chimara-glk.c b/src/chimara-glk.c index fd5d065..57846cb 100644 --- a/src/chimara-glk.c +++ b/src/chimara-glk.c @@ -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 */ diff --git a/src/main.c b/src/main.c index 13de35c..bbad7e3 100644 --- a/src/main.c +++ b/src/main.c @@ -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);