X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fwindow.c;h=b3995f09189b8234982a3df80977ef9114f487b8;hb=ef9854e6a969e9d5c082fcd1b4cda78f74ba44dd;hp=7dd14c7b3d53d6e22e7538d2eadea855469c0e92;hpb=4f03c8413a60636e8c953ac694337a782e6a173f;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/window.c b/libchimara/window.c index 7dd14c7..b3995f0 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -35,7 +35,7 @@ window_new_common(glui32 rock) } static void -window_close_common(winid_t win) +window_close_common(winid_t win, gboolean destroy_node) { ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); @@ -45,7 +45,8 @@ window_close_common(winid_t win) win->disprock.ptr = NULL; } - g_node_destroy(win->window_node); + if(destroy_node) + g_node_destroy(win->window_node); win->magic = MAGIC_FREE; g_free(win); } @@ -458,6 +459,7 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, case wintype_TextGrid: { GtkWidget *textview = gtk_text_view_new(); + GtkTextBuffer *textbuffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(textview) ); gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW(textview), GTK_WRAP_NONE ); gtk_text_view_set_editable( GTK_TEXT_VIEW(textview), FALSE ); @@ -479,6 +481,9 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, /* Connect signal handlers */ win->keypress_handler = g_signal_connect( G_OBJECT(textview), "key-press-event", G_CALLBACK(on_window_key_press_event), win ); g_signal_handler_block( G_OBJECT(textview), win->keypress_handler ); + + /* Create the styles available to the window stream */ + style_init_textgrid(textbuffer); } break; @@ -522,7 +527,7 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, (for line input) */ gtk_text_buffer_create_tag(textbuffer, "uneditable", "editable", FALSE, "editable-set", TRUE, NULL); - /* Create the default styles available to the window stream */ + /* Create the styles available to the window stream */ style_init_textbuffer(textbuffer); /* Mark the position where the user will input text */ @@ -656,7 +661,7 @@ free_winids_below(winid_t win) free_winids_below(win->window_node->children->data); free_winids_below(win->window_node->children->next->data); } - window_close_common(win); + window_close_common(win, FALSE); } /** @@ -770,14 +775,14 @@ glk_window_close(winid_t win, stream_result_t *result) g_node_append(new_parent_node, sibling_node); } - window_close_common( (winid_t) pair_node->data ); + window_close_common( (winid_t) pair_node->data, TRUE); } else /* it was the root window */ { glk_data->root_window = NULL; } - window_close_common(win); + window_close_common(win, FALSE); /* Schedule a redraw */ g_mutex_lock(glk_data->arrange_lock);