From 423537b97fc488b35c115c428439a41a43d5d699 Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Thu, 31 May 2012 22:31:15 -0400 Subject: [PATCH] Clean up position_overlay_cb. --- termite.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/termite.c b/termite.c index 2d04c88..70d19c4 100644 --- a/termite.c +++ b/termite.c @@ -144,21 +144,18 @@ static void window_title_cb(VteTerminal *vte, GtkWindow *window) { #endif static gboolean position_overlay_cb(GtkOverlay *overlay, GtkWidget *widget, GdkRectangle *alloc) { - GtkWidget *main_widget = gtk_bin_get_child(GTK_BIN(overlay)); + GtkWidget *vte = gtk_bin_get_child(GTK_BIN(overlay)); - GtkAllocation main_alloc; - main_alloc.x = 0; - main_alloc.y = 0; - main_alloc.width = gtk_widget_get_allocated_width(main_widget); - main_alloc.height = gtk_widget_get_allocated_height(main_widget); + int width = gtk_widget_get_allocated_width(vte); + int height = gtk_widget_get_allocated_height(vte); GtkRequisition req; gtk_widget_get_preferred_size(widget, NULL, &req); - alloc->x = main_alloc.width - req.width - 40; + alloc->x = width - req.width - 40; alloc->y = 0; - alloc->width = MIN(main_alloc.width, req.width); - alloc->height = MIN(main_alloc.height, req.height); + alloc->width = MIN(width, req.width); + alloc->height = MIN(height, req.height); return TRUE; }