From: Marijn van Vliet Date: Sun, 22 Nov 2009 14:28:51 +0000 (+0000) Subject: Fixed style_init() related errors X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=0c75df5f3c9b9dce26f54dfceaefd71a48a8a392;p=rodin%2Fchimara.git Fixed style_init() related errors git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@175 ddfedd41-794f-dd11-ae45-00112f111e67 --- diff --git a/libchimara/style.c b/libchimara/style.c index 24e9833..e4169d6 100644 --- a/libchimara/style.c +++ b/libchimara/style.c @@ -826,6 +826,10 @@ get_current_font(guint32 wintype) ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); GtkTextTag *normal; + if( G_UNLIKELY(!glk_data->style_initialized) ) { + style_init(); + } + switch(wintype) { case wintype_TextGrid: normal = g_hash_table_lookup(glk_data->current_styles->text_grid, "normal"); diff --git a/libchimara/window.c b/libchimara/window.c index 5740690..edb241f 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -474,7 +474,8 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, gtk_text_view_set_editable( GTK_TEXT_VIEW(textview), FALSE ); gtk_widget_show(textview); - /* Set the window's font */ + /* Create the styles available to the window stream */ + style_init_textgrid(textbuffer); gtk_widget_modify_font( textview, get_current_font(wintype) ); win->widget = textview; @@ -496,9 +497,6 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, gtk_widget_add_events( textview, GDK_BUTTON_RELEASE_MASK ); win->mouse_click_handler = g_signal_connect_after( G_OBJECT(textview), "button-release-event", G_CALLBACK(on_window_button_release_event), win ); g_signal_handler_block( textview, win->mouse_click_handler ); - - /* Create the styles available to the window stream */ - style_init_textgrid(textbuffer); } break; @@ -519,7 +517,8 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, gtk_container_add( GTK_CONTAINER(scrolledwindow), textview ); gtk_widget_show_all(scrolledwindow); - /* Set the window's font */ + /* Create the styles available to the window stream */ + style_init_textbuffer(textbuffer); gtk_widget_modify_font( textview, get_current_font(wintype) ); win->widget = textview; @@ -548,9 +547,6 @@ 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 styles available to the window stream */ - style_init_textbuffer(textbuffer); - /* Mark the position where the user will input text */ GtkTextIter end; gtk_text_buffer_get_end_iter(textbuffer, &end);