From cccf5a5fb76599e4c5dffaae34ec6bda6229f554 Mon Sep 17 00:00:00 2001 From: Marijn van Vliet Date: Sun, 18 Apr 2010 10:56:53 +0000 Subject: [PATCH] Fixed window closing bug #43 git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@236 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/pager.c | 4 ++-- libchimara/stream.c | 2 +- libchimara/window.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libchimara/pager.c b/libchimara/pager.c index d685542..e00daf9 100644 --- a/libchimara/pager.c +++ b/libchimara/pager.c @@ -30,8 +30,8 @@ move_pager_and_get_scroll_distance(GtkTextView *textview, gint *view_height, gin gtk_text_view_get_iter_location(textview, &newpager, &pagerpos); gtk_text_view_get_iter_location(textview, &end, &endpos); - g_printerr("View height = %d\n", visiblerect.height); - g_printerr("End - Pager = %d\n", endpos.y - pagerpos.y); + /*g_printerr("View height = %d\n", visiblerect.height); + g_printerr("End - Pager = %d\n", endpos.y - pagerpos.y);*/ *view_height = visiblerect.height; *scroll_distance = endpos.y - pagerpos.y; diff --git a/libchimara/stream.c b/libchimara/stream.c index afc55be..b0e97f9 100644 --- a/libchimara/stream.c +++ b/libchimara/stream.c @@ -24,7 +24,7 @@ stream_new_common(glui32 rock) /* Add it to the global stream list */ glk_data->stream_list = g_list_prepend(glk_data->stream_list, str); str->stream_list = glk_data->stream_list; - + return str; } diff --git a/libchimara/window.c b/libchimara/window.c index 6c63539..15f8f4b 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -26,7 +26,7 @@ window_new_common(glui32 rock) win->window_stream->type = STREAM_TYPE_WINDOW; win->window_stream->window = win; win->window_stream->style = "normal"; - + win->echo_stream = NULL; win->input_request_type = INPUT_REQUEST_NONE; win->line_input_buffer = NULL; @@ -826,7 +826,12 @@ glk_window_close(winid_t win, stream_result_t *result) if(pair_node != NULL) { gboolean new_child_on_left = ( pair_node == g_node_first_sibling(pair_node) ); - GNode *sibling_node = pair_node->children; /* only one child left */ + + /* Lookup our sibling */ + GNode *sibling_node = pair_node->children; + if(sibling_node == win->window_node) + sibling_node = sibling_node->next; + GNode *new_parent_node = pair_node->parent; g_node_unlink(pair_node); g_node_unlink(sibling_node); @@ -844,6 +849,7 @@ glk_window_close(winid_t win, stream_result_t *result) g_node_append(new_parent_node, sibling_node); } + stream_close_common( ((winid_t) pair_node->data)->window_stream, NULL ); window_close_common( (winid_t) pair_node->data, TRUE); } else /* it was the root window */ -- 2.30.2