Fixed window resize by to long text in inputbox.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 25 Oct 2014 00:31:52 +0000 (02:31 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 25 Oct 2014 00:32:24 +0000 (02:32 +0200)
The GTK3 text view grows with it's content and forces the whole main window to
increase. To fix this, the text view is put into a scrolled window. This might
be a hack, because we do not use the scrolled window itself, but this restores
the behaviour of the plain text view of GTK2.

src/main.c

index d0ab663..1a0fb0d 100644 (file)
@@ -819,7 +819,17 @@ static void init_core(void)
 
     gtk_box_pack_start(gui->box, scroll, true, true, 0);
     gtk_box_pack_start(gui->box, gui->eventbox, false, false, 0);
+
+#ifdef HAS_GTK3
+    /* use a scrolled window to hide overflowing text in inputbox like GTK2 */
+    GtkWidget *inputscroll = gtk_scrolled_window_new(NULL, NULL);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(inputscroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
+    gtk_container_add(GTK_CONTAINER(inputscroll), gui->input);
+
+    gtk_box_pack_end(gui->box, inputscroll, false, false, 0);
+#else
     gtk_box_pack_end(gui->box, gui->input, false, false, 0);
+#endif
 
     /* init some state variable */
     vb.state.enable_register = false;