From 2de157b4be79e82e3f1d9bf088667b954b6d0c51 Mon Sep 17 00:00:00 2001 From: fliep Date: Wed, 6 May 2009 22:15:26 +0000 Subject: [PATCH] - Text grid windows don't need scrollbars - Set text windows' minimum size request to "as small as possible", otherwise they can't be resized smaller than their contents --- src/window.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/window.c b/src/window.c index ea490c9..45054e0 100644 --- a/src/window.c +++ b/src/window.c @@ -364,22 +364,17 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, case wintype_TextGrid: { - GtkWidget *scrolledwindow = gtk_scrolled_window_new(NULL, NULL); GtkWidget *textview = gtk_text_view_new(); - - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER ); - + gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW(textview), GTK_WRAP_CHAR ); gtk_text_view_set_editable( GTK_TEXT_VIEW(textview), FALSE ); - - gtk_container_add( GTK_CONTAINER(scrolledwindow), textview ); - gtk_widget_show_all(scrolledwindow); + gtk_widget_show(textview); /* Set the window's font */ gtk_widget_modify_font(textview, glk_data->monospace_font_desc); win->widget = textview; - win->frame = scrolledwindow; + win->frame = textview; /* Determine the size of a "0" character in pixels */ PangoLayout *zero = gtk_widget_create_pango_layout(textview, "0"); @@ -460,6 +455,10 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, return NULL; } + /* Set the minimum size to "as small as possible" so it doesn't depend on + the size of the window contents */ + gtk_widget_set_size_request(win->widget, 0, 0); + if(split) { /* When splitting, construct a new parent window -- 2.30.2